Hello. I would like to know whether there is a possibility to stop the execution of a test case from within an Eggplant script. Because using “exit all” only stops the current script. But what if the test case contains more scripts? I would like to stop test case execution as a whole when for example the tested version number of the software does not meat a minimum requirement.
The ideal solution would not make the test case result a failure in this case.
When you add scripts as separate steps within a single DAI Test Case, the following is true:
- Values from global variables are available to each step within the case.
- Throwing an exception within any step stops the execution of the case.
If you were willing to mark the Test Configuration as a failure when any test steps are skipped, the easiest solution would be to throw an exception at the point where you currently have your Exit All. Because you prefer not to mark the Test Configuration as a failure, you will need to communicate to each successive step that it should be skipped. My recommendation would be to replace your Exit All with these lines of code:
put "TRUE" into global SkipStep
Exit All
Then at the start of any script that may need to be skipped add this:
if global SkipStep then Exit All
Hope this helps.
Dave
1 Like
Thank you this will certainly work.
As a solution I have put “run” calls to each script of the test case into a new script.
setup.assertRequiredCcmVersion "24.2"
run "test-cases/metadata-dialog/xray-8212/init"
run "test-cases/metadata-dialog/xray-8212/iteration1"
run "test-cases/metadata-dialog/xray-8212/iteration2"
run "test-cases/metadata-dialog/xray-8212/iteration3"
run "test-cases/metadata-dialog/xray-8212/quit"
At the very beginning the check is done and since “exit all” inside the check aborts this main script too the subsequent calls to the other scripts is also aborted.