Browse Source

If/Else bug resolved and pytest updated

Akash 3 years ago
parent
commit
91a8246c5f
2 changed files with 5 additions and 3 deletions
  1. 2 2
      baangt/TestSteps/TestStepMaster.py
  2. 3 1
      tests/test_ServiceTest.py

+ 2 - 2
baangt/TestSteps/TestStepMaster.py

@@ -99,11 +99,11 @@ class TestStepMaster:
         :param ifis:
         :return:
         """
-        if condition.upper() == "IF":
+        if condition.upper() == "IF" or condition.upper() == "IF_":
             self.ifConditions += 1
             self.ifLis.append(ifis)
             self.elseLis.append(False)
-        elif condition.upper() == "ELSE":
+        elif condition.upper() == "ELSE" or condition.upper() == "ELSE_":
             self.elseLis[-1] = True
         elif condition.upper() == "ENDIF":
             self.ifConditions -= 1

+ 3 - 1
tests/test_ServiceTest.py

@@ -61,6 +61,7 @@ def execute(run_file, globals_file):
     # Execute the program using TestRun
     lUUID = uuid4()
     lTestRun = TestRun(run_file, globalSettingsFileNameAndPath=globals_file, uuid=lUUID)
+    return lTestRun
 
 
 # Testing Output Functions
@@ -239,7 +240,8 @@ def test_full_BaangtWebDemo():
 
 def test_NestedIfElse_with_NoBrowser():
     run_file = str(input_dir.joinpath("CompleteBaangtWebdemo_else.xlsx"))
-    execute(run_file, globals_file=Path(input_dir).joinpath("globalsNoBrowser.json"))
+    testRun = execute(run_file, globals_file=Path(input_dir).joinpath("globalsNoBrowser.json"))
+    assert testRun.statistics.teststep_executed == 18, "If/Else/Endif are not working as expected"
     new_file = folder_monitor.getNewFiles()
     assert new_file
     output_file = output_dir.joinpath(new_file[0][0]).as_posix()