skip execution of folder depending on the condition
Currently, we run automation scripts in the US. I am updating them to run in German. I don't want to wait until everything is updated to run in German local. Is there any way we can run/skip a particular folder depending on the condition (location)? I am already using Project suite variable for identifying a location and to get the translation. I am also using Stop execution for individual scripts. But is there any way we can skip a complete folder.
Solved! Go to Solution.
There's two ways you can do this:
1) turn off the test items you don't want to test before you run the suite. If you have them grouped by folders you can uncheck a folder and none of the tests in that folder will run.
2) write some code in the test item code, which checks for some configuration value and doesn't execute any of the code if the value is set a certain way.
Option 1 is much easier, but if you have regulatory reasons for stating "This test case was not executed for reason X" you'll have go with option 2.
Thank you for your reply.
Option 1 is not suitable for my project as same scripts need to run in the US and not in German.
Option 2 I am using this now for some of the scripts but it is difficult to update in each script so I am looking for better solution.
I've been in the same situation before. The test items are immutable once you hit the "Run" button. The best thing you can do is code around the tests that may not be able to execute under certain configurations and just put a note in the log stating such.
This is why, as convenient as it is for constructing a suite of test cases quickly, I don't like using "Test Items" as the primary driver for what gets executed. You can't dynamically change things in code. Using an SQL data table, Excel spreadsheet, or CSV file to indicate the list of tests to execute is actually very flexible because then all you need to do is alter the file and click "run"... then your tests run. You could even have multiple copies of the file and, depending upon the configuration to run, you just drop in the necessary file or even have your code retrieve the file.
In very high level pseudo code, it could be something like this:
If configuration = US, then file_name = "US Test cases"
if configuration = Germany, then file_name = "Germany test cases"
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
Why automate? I do automated testing because there's only so much a human being can do and remain healthy. Sleep is a requirement. So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.
Mysterious Gremlin Master
Vegas Thrill Rider