Skip to content

Commit

Permalink
Started making test case for Issue damies13#14 + getting images
Browse files Browse the repository at this point in the history
  • Loading branch information
ArekKuczynski committed Aug 21, 2024
1 parent c0b808e commit 8717e07
Show file tree
Hide file tree
Showing 11 changed files with 380 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Tests/Regression/Agent/CommandLine_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@
Resource CommandLine_Common.robot

*** Test Cases ***
Agent Version
[Tags] ubuntu-latest macos-latest windows-latest
# ${result}= Run python3 ${EXECDIR}${/}rfswarm_agent${/}rfswarm_agent.py -v
${result}= Run rfswarm-agent -v
Log to console ${\n}${result}
Should Contain ${result} Version
Should Contain ${result} Agent

Agent Help
[Tags] ubuntu-latest macos-latest windows-latest
# ${result}= Run python3 ${EXECDIR}${/}rfswarm_agent${/}rfswarm_agent.py -h
${result}= Run rfswarm-agent -h
Log to console ${\n}${result}
Should Contain ${result} AGENTNAME
167 changes: 167 additions & 0 deletions Tests/Regression/Manager/GUI_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,173 @@ Suite Setup Set Platform
${scenario_name}= test_scenario

*** Test Cases ***
Manager Command Line PORT -p
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

VAR &{run_settings_data} bind_port_number=8148
VAR @{mngr_options} -p ${run_settings_data}[bind_port_number]
VAR @{agent_options} -m http://localhost:${run_settings_data}[bind_port_number]/

Open Manager GUI ${mngr_options}
Log To Console Check if Agent can connect to the new port number. New port number: ${run_settings_data}[bind_port_number].
Open Agent ${agent_options}
${status}= Run Keyword And Return Status Check If The Agent Is Ready 30
Run Keyword If not ${status} Fail
... msg=The agent did not connect to the new port number!
Log To Console The Agent has connected to the Manager with ${run_settings_data}[bind_port_number] port and this was expected.
Click Tab Plan

[Teardown] Run Keywords
... Run Keyword Close Manager GUI ${platform} AND
... GUI_Common.Stop Agent

Manager Command Line IPADDRESS -e
#[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

${ipv4} ${ipv6} Get IP addresses
Log To Console ${\n}IPV4 address: ${ipv4} ${\n}IPV6 address: ${ipv6}${\n}
VAR @{mngr_options} -e ${ipv4}[0]
VAR @{agent_options} -m http://${ipv4}[0]:8138/

Open Manager GUI ${mngr_options}
Log To Console Check if Agent can connect to the Manager via ${ipv4}[0].
Open Agent ${agent_options}
${status}= Run Keyword And Return Status Check If The Agent Is Ready 30
Run Keyword If not ${status} Fail
... msg=The agent did not connect to the Manager via ${ipv4}[0]!
Log To Console The Agent has connected to the Manager via ${ipv4}[0] and this was expected.
Click Tab Plan

[Teardown] Run Keywords
... Run Keyword Close Manager GUI ${platform} AND
... GUI_Common.Stop Agent

Manager Command Line DIR -d
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

VAR @{mngr_options} -n -d ${global_path}${/}Issue-#14

Create Directory ${global_path}${/}Issue-#14
Open Manager GUI ${mngr_options}
@{dir_list}= List Directories In Directory ${global_path}${/}Issue-#14
Should Be Equal As Strings ${dir_list}[0] PreRun msg=Manager didn't create PreRun directory in the new Results directory!

[Teardown] Run Keywords
... Terminate Process ${process_manager} AND
... Remove Directory ${global_path}${/}Issue-#14 recursive=${True}

Manager Command Line STARTTIME -t
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

VAR @{mngr_options} -t 19:00:00

${current_date}= Get Current Date result_format=%H:%M:%S
Log To Console Current time: ${current_date}
${time_diff}= Subtract Date From Date
... ${current_date} 19:00:00 date1_format=%H:%M:%S date2_format=%H:%M:%S
Log To Console Time diff: ${time_diff}
Run Keyword If ${time_diff} < ${10} Sleep 11
Open Manager GUI ${mngr_options}
${status}= Run Keyword And Return Status
... Wait For manager_${platform}_label_start_time.png timeout=${20}
Take A Screenshot
# vvv CHANGE LATER vvv
# Run Keyword If not ${status} Fail msg=Manager didn't set a scheduled start.

[Teardown] Run Keyword Close Manager GUI ${platform}

Manager Command Line SCENARIO -s
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#14${/}Issue-#14.rfs
VAR @{mngr_options} -s ${scenariofile}

Open Manager GUI ${mngr_options}
Open Agent
Check If The Agent Is Ready
Click Tab Plan
Log To Console Run the example scenario to check that it has been loaded.

TRY
Click Button runplay
Wait For manager_${platform}_button_stoprun.png timeout=30
EXCEPT
Press key.enter 1 Times
Fail msg=RFSwarm Manager didn't load and run the the example scenario!
END

[Teardown] Run Keywords
... Run Keyword Close Manager GUI ${platform} AND
... GUI_Common.Stop Agent

Manager Command Line AGENTS -a
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#14${/}Issue-#14.rfs
VAR @{mngr_options} -s ${scenariofile} -a 2

Open Manager GUI ${mngr_options}
Log To Console Run Agents only once, but 2 are needed. The Manager should display a special message.
Open Agent
Check If The Agent Is Ready
Click Tab Plan
Click Button runplay
${status}= Run Keyword And Return Status
... Wait For ${platform}_warning_label_not_enough_agents.png timeout=${10}
Run Keyword If not ${status} Fail msg=The manager didn't display expected prompt dialogue that says: Not enough Agents available to run Robots!
Press key.enter 1 Times

[Teardown] Run Keywords
... Run Keyword Close Manager GUI ${platform} AND
... GUI_Common.Stop Agent

Manager Command Line SCENARIO -r
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

${scenariofile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#14${/}Issue-#14.rfs
VAR @{mngr_options} -s ${scenariofile} -r

Open Manager GUI ${mngr_options}
Log To Console Wait for the Agent to connect, after that the scenario should start automatically.
Open Agent
Check If The Agent Is Ready
TRY
Wait For manager_${platform}_button_stoprun.png timeout=30
EXCEPT
Press key.enter 1 Times
Fail msg=RFSwarm Manager didn't run the scenario automatically after connecting to the Agent!
END

[Teardown] Run Keywords
... Run Keyword Close Manager GUI ${platform} AND
... GUI_Common.Stop Agent

Manager Command Line INI -i
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
[Setup] Set Global Filename And Default Save Path ${robot_data}[0]

${inifile}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#14${/}RFSwarmManager.ini
VAR @{mngr_options} -i ${inifile}

Open Manager GUI ${mngr_options}
Log To Console Run Manager with alternate ini file with variable: display_index = True.
Click Tab Run
Log To Console Check that Index check box is selected.
${status}= Run Keyword And Return Status
... Wait For ${platform}_checkbox_checked_default.png timeout=${10}
Take A Screenshot
Run Keyword If not ${status} Fail
... msg=The manager did not load alternate ini file because it cannot find checked check box in the Run tab!

[Teardown] Run Keyword Close Manager GUI ${platform}

Verify the Field Validation Is Working In the Manager Plan Screen
[Tags] windows-latest ubuntu-latest macos-latest Issue #126
[Setup] Run Keywords
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions Tests/Regression/Manager/testdata/Issue-#14/Issue-#14.rfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Scenario]
uploadmode = err
scriptcount = 1
graphlist =

[1]
robots = 10
delay = 0
rampup = 10
run = 30
test = Example Test Case
script = example.robot

21 changes: 21 additions & 0 deletions Tests/Regression/Manager/testdata/Issue-#14/RFSwarmManager.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[GUI]
win_width = 1200
win_height = 600
graph_list =

[Plan]
scriptdir =
scenariodir =
scenariofile =

[Run]
resultsdir =
display_index = True
display_iteration = False
display_sequence = False
display_percentile = 90

[Server]
bindip =
bindport = 8138

7 changes: 7 additions & 0 deletions Tests/Regression/Manager/testdata/Issue-#14/example.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
***Test Cases***
Example Test Case
Test
***Keywords***
Test
[Documentation] 10 seconds
Sleep 10
1 change: 1 addition & 0 deletions Tests/Regression/Reporter/GUI_Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ Open GUI
Get Platform
${keyword}= Set Variable Open GUI ${platform}
Run Keyword ${keyword} @{appargs}
Sleep 3

Get Platform
&{platforms}= Create Dictionary Linux=ubuntu Darwin=macos Java=notsupported Windows=windows
Expand Down
105 changes: 105 additions & 0 deletions Tests/Regression/Reporter/GUI_Features.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,111 @@ Resource GUI_Common.robot
Test Teardown Close GUI

*** Test Cases ***
Reporter Command Line INI -i
#[Tags] ubuntu-latest macos-latest windows-latest Issue #14

${test_dir}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#14
${ini_content}= Get File ${test_dir}${/}RFSwarmReporter.ini
${ini_content}= Replace String ${ini_content} template_here ${test_dir}${/}Issue-#14.template
${ini_content}= Replace String ${ini_content} template_dir_here ${test_dir}
Remove File ${test_dir}${/}RFSwarmReporter.ini
Log ${ini_content}
Append To File ${test_dir}${/}RFSwarmReporter.ini ${ini_content}

Log To Console Run Reporter with alternate ini file with variable: template = ${test_dir}${/}RFSwarmReporter.ini.
Open GUI -i ${test_dir}${/}RFSwarmReporter.ini
Log To Console Check that Robots section exist.
${status}= Run Keyword And Return Status
... Wait For reporter_${platform}_section_robots.png timeout=${10}
Take A Screenshot
Run Keyword If not ${status} Fail
... msg=The Reporter did not load alternate ini file because it cannot find Robots section!

Manager Command Line DIR -d
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
${testdata} Set Variable Issue-#14${/}result_dir
${resultdata} Set Variable 20240622_182505_test_scenario
${basefolder} Set Variable ${CURDIR}${/}testdata${/}${testdata}
${resultfolder} Set Variable ${basefolder}${/}${resultdata}

Open GUI -n -d ${resultfolder}
${inifile}= Get Reporter INI Location
${inifile_content}= Get File ${inifile}
${inifile_content}= Split String ${inifile_content}

${resultdir_offset} Get Index From List ${inifile_content} resultdir
Should Be Equal resultdir ${inifile_content}[${resultdir_offset}] msg=resultdir value is missing!
Should Be Equal ${basefolder} ${inifile_content}[${resultdir_offset + 2}]
... msg=resultdir path value did not save correctly [settings != scenario]!

${results_offset} Get Index From List ${inifile_content} results
Should Be Equal results ${inifile_content}[${results_offset}] msg=results value is missing!
Should Be Equal ${resultfolder}${/}${resultdata}.db ${inifile_content}[${results_offset + 2}]
... msg=results path value did not save correctly [settings != scenario]!

Reporter Command Line TEMPLATE -t
[Tags] ubuntu-latest macos-latest windows-latest Issue #14
${basefolder}= Normalize Path ${CURDIR}${/}testdata${/}Issue-#14
${templatefile}= Normalize Path ${basefolder}${/}Issue-#14.template

Open GUI -n -t ${templatefile}
${inifile}= Get Reporter INI Location
${inifile_content}= Get File ${inifile}
${inifile_content}= Split String ${inifile_content}

${template_offset} Get Index From List ${inifile_content} template
Should Be Equal template ${inifile_content}[${template_offset}] msg=template value is missing!
${inifile_content}[${template_offset + 2}]= Evaluate r"${inifile_content}[${template_offset + 2}]".replace('x35', '#')
Should Be Equal ${templatefile} ${inifile_content}[${template_offset + 2}]
... msg=template path value did not save correctly [settings != scenario]!

${templatedir_offset} Get Index From List ${inifile_content} templatedir
Should Be Equal templatedir ${inifile_content}[${templatedir_offset}] msg=templatedir value is missing!
${inifile_content}[${templatedir_offset + 2}]= Evaluate r"${inifile_content}[${templatedir_offset + 2}]".replace('x35', '#')
Should Be Equal ${basefolder} ${inifile_content}[${templatedir_offset + 2}]
... msg=templatedir path value did not save correctly [settings != scenario]!

Manager Command Line HTML report --html
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
${testdata} Set Variable Issue-#14${/}result_dir
${resultdata} Set Variable 20240622_182505_test_scenario
${basefolder} Set Variable ${CURDIR}${/}testdata${/}${testdata}
${resultfolder} Set Variable ${basefolder}${/}${resultdata}

Open GUI -n -d ${resultfolder} --html
@{result_files}= List Files In Directory ${resultfolder}
Log To Console ${\n}All result files: ${result_files}${\n}
List Should Contain Value ${result_files} ${resultdata}.html

Manager Command Line HTML report --docx
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
${testdata} Set Variable Issue-#14${/}result_dir
${resultdata} Set Variable 20240622_182505_test_scenario
${basefolder} Set Variable ${CURDIR}${/}testdata${/}${testdata}
${resultfolder} Set Variable ${basefolder}${/}${resultdata}

Open GUI -n -d ${resultfolder} --docx
@{result_files}= List Files In Directory ${resultfolder}
Log To Console ${\n}All result files: ${result_files}${\n}
List Should Contain Value ${result_files} ${resultdata}.docx

Manager Command Line HTML report --xlsx
[Tags] windows-latest ubuntu-latest macos-latest Issue #14
${testdata} Set Variable Issue-#14${/}result_dir
${resultdata} Set Variable 20240622_182505_test_scenario
${basefolder} Set Variable ${CURDIR}${/}testdata${/}${testdata}
${resultfolder} Set Variable ${basefolder}${/}${resultdata}

Open GUI -n -d ${resultfolder} --xlsx
@{result_files}= List Files In Directory ${resultfolder}
Log To Console ${\n}All result files: ${result_files}${\n}
List Should Contain Value ${result_files} ${resultdata}.xlsx

Verify That Files Get Saved With Correct Extension And Names
[Tags] ubuntu-latest macos-latest windows-latest Issue #39 Issue #257
${testdata}= Set Variable Issue-#39
Expand Down
41 changes: 41 additions & 0 deletions Tests/Regression/Reporter/testdata/Issue-#14/Issue-#14.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[Report]
order = FACF46783F4,FACF46787E0,FACF48E081E
title = Report Title
dateformat = yyyy-mm-dd
timeformat = HH:MM
timezone = Europe/Warsaw
showtlogo = -1
startoffset = -253
showstarttime = -1
endoffset = 254
showendtime = -1
font = Verdana
fontsize = 12
percentile = 90

[FACF46783F4]
name = Template
parent = TOP
type = note
changed = 1723550921.6244972
note = Define your template by adding sections and configuring the section settingsx12Each section can be:x12 - Note (like this) section, free textx12 - Heading, usefull for grouping sectionsx12 - Contents like a table of contents or figuresx12 - Data Table, with data from test resultsx12 - Data Graph, for graphical representation of test resultsx12x12Each section can also have sub sectionsx12x12The cover page and overall report settings can be found on the settings pane of the Report item abovex12

[FACF46787E0]
name = Test Result Summary
parent = TOP
type = table
changed = 1723551150.6145654
colours = 0
datatype = ResultSummary
sql = SELECT r.result_name as x91Result Namex93 , round(min(rp.elapsed_time),3) 'Minimum', round(avg(rp.elapsed_time),3) 'Average', round(percentile(rp.elapsed_time, 90),3) '90x37ile', round(max(rp.elapsed_time),3) 'Maximum', round(stdev(rp.elapsed_time),3) 'Std. Dev.', count(rp.result) as 'Pass', count(rf.result) as 'Fail', count(ro.result) as 'Other' FROM Results as r LEFT JOIN Results as rp ON r.rowid == rp.rowid AND rp.result == 'PASS' LEFT JOIN Results as rf ON r.rowid == rf.rowid AND rf.result == 'FAIL' LEFT JOIN Results as ro ON r.rowid == ro.rowid AND ro.result <> 'PASS' AND ro.result <> 'FAIL' WHERE r.end_time >= 1723551149 AND r.end_time <= 1723550896 GROUP BY r.result_name ORDER BY x91Result Namex93

[FACF48E081E]
name = Robots
parent = TOP
type = head
changed = 1723551180.4066358

[FACF48E081EL]

[FACF48E081ER]

Loading

0 comments on commit 8717e07

Please sign in to comment.