Skip to content

Commit

Permalink
Merge branch 'Issue-#126-Validate-fields' into v1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
damies13 committed Mar 6, 2023
2 parents bb891df + d5f73e1 commit 64807ac
Show file tree
Hide file tree
Showing 19 changed files with 246 additions and 0 deletions.
1 change: 1 addition & 0 deletions Tests/Demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
!*.rfs
13 changes: 13 additions & 0 deletions Tests/Demo/demo.rfs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[Scenario]
uploadmode = err
scriptcount = 1
graphlist =

[1]
robots = 2
delay = 0
rampup = 45
run = 60
test = RFSwarm Demo Test
script = rfswarm_demo.robot

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_1_1678091908/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_1_1678091908/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_1_1678091908/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_2_1678091924/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_2_1678091924/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_2_1678091924/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_3_1678091940/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_3_1678091940/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_3_1678091940/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_4_1678091956/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_4_1678091956/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_4_1678091956/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_5_1678091973/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_5_1678091973/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_5_1678091973/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_6_1678091989/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_6_1678091989/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_1_1678091901_6_1678091989/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_1_1678091918/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_1_1678091918/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_1_1678091918/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_2_1678091935/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_2_1678091935/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_2_1678091935/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_3_1678091951/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_3_1678091951/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_3_1678091951/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_4_1678091967/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_4_1678091967/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_4_1678091967/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_5_1678091983/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_5_1678091983/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_2_1678091916_5_1678091983/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_1_1678091935/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_1_1678091935/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_1_1678091935/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_2_1678091951/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_2_1678091951/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_2_1678091951/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_3_1678091967/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_3_1678091967/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_3_1678091967/report.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
==============================================================================
Rfswarm Demo :: This Demo Test is for demonstrating and troubleshooting RFS...
==============================================================================
RFSwarm Demo Test | PASS |
------------------------------------------------------------------------------
Rfswarm Demo :: This Demo Test is for demonstrating and troublesho... | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Output: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_4_1678091983/RFSwarm_Demo_Test_output.xml
Log: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_4_1678091983/log.html
Report: /tmp/rfswarmagent/logs/20230306_183806_demo/rfswarm_demo_1_3_1678091931_4_1678091983/report.html
67 changes: 67 additions & 0 deletions rfswarm_manager/rfswarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2632,6 +2632,19 @@ def ClickPlay(self, _event=None):
base.MetricIDs = {}

base.robot_schedule = {"RunName": "", "Agents": {}, "Scripts": {}}

warnings = self.Pre_Run_Checks()
if len(warnings) > 0:
# report warnings and stop test from running
base.run_abort = False
base.run_end = int(time.time()) - 1
base.run_finish = int(time.time()) - 1

for warning in warnings:
base.debugmsg(0, warning)

return 0

sec2st = base.run_starttime - int(time.time())
if sec2st < 1:
starttime = int(time.time())
Expand Down Expand Up @@ -2690,6 +2703,43 @@ def ClickPlay(self, _event=None):
base.save_metrics("Run_{}".format(grp['Index']), "Scenario", starttime, grp['Test'], grp['Run'])
base.save_metrics(grp['Index'], "Scenario_Run", starttime, grp['Test'], grp['Run'])

def Pre_Run_Checks(self, _event=None):
warnings = []

# good
# grp {'Index': 1, 'Robots': 2, 'Delay': 0, 'RampUp': 45, 'Run': 60, 'Test': 'RFSwarm Demo Test', 'TestVar': <tkinter.StringVar object at 0x7f6a4b911ea0>, 'Script': '/home/dave/Documents/Github/rfswarm/Tests/Demo/rfswarm_demo.robot', 'ScriptHash': '03ad3be39fcfd8f37dfe1db445192728'}
# bad
# grp {'Index': 1, 'Robots': 10, 'Delay': 0, 'RampUp': 1800, 'Run': 7200, 'Test': '', 'TestVar': <tkinter.StringVar object at 0x7f7fe07dfe50>}

base.debugmsg(5, "scriptlist:", base.scriptlist)
for grp in base.scriptlist:
base.debugmsg(5, "grp", grp)
if "Index" in grp.keys():
if "Robots" not in grp.keys() or grp["Robots"] < 1:
warnings.append("Index {} has no Robots".format(grp["Index"]))

# RampUp < 10
if "RampUp" not in grp.keys() or grp["RampUp"] < 10:
warnings.append("Index {} Ramp Up is < 10 sec.".format(grp["Index"]))

if "Run" not in grp.keys() or grp["Run"] < 10:
warnings.append("Index {} Run is < 10 sec.".format(grp["Index"]))

if "Script" not in grp.keys() or len(grp["Script"]) < 1:
warnings.append("Index {} has no Script".format(grp["Index"]))
else:
# ScriptHash
if "ScriptHash" not in grp.keys() or len(grp["ScriptHash"]) < 1:
warnings.append("Index {} Agents don't have Script yet".format(grp["Index"]))

if "Test" not in grp.keys() or len(grp["Test"]) < 1:
warnings.append("Index {} has no Test".format(grp["Index"]))



# warnings.append("Debuging : Don't Run")
return warnings

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Run
Expand Down Expand Up @@ -5206,6 +5256,23 @@ def ClickPlay(self, _event=None):
self.display_run['start_time'].set(" --:--:-- ")
self.display_run['elapsed_time'].set(" --:--:-- ")
self.display_run['finish_time'].set(" --:--:-- ")

warnings = core.Pre_Run_Checks()
if len(warnings) > 0:
# report warnings with warning dialogue and stop test from running
base.run_abort = False
base.run_end = int(time.time()) - 1
base.run_finish = int(time.time()) - 1

warningmsg = ""
for warning in warnings:
base.debugmsg(0, warning)
warningmsg += warning + "\n"

tkm.showwarning("RFSwarm - Warning", warningmsg)

return 0

base.debugmsg(6, "Test Started: ", int(time.time()), "[", datetime.now().isoformat(sep=' ', timespec='seconds'), "]")

self.elements["Run"]["btn_stop"]["image"] = self.icoStop
Expand Down

0 comments on commit 64807ac

Please sign in to comment.