18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

How to terminate executing the test suite

sumeetsumeet Members
edited November -1 in Sahi - Open Source
I have a suite where it has several scripts. First script which add an entity and all other scripts expects the entity to be there. If first script fails to add the entity due some defect there is no point running rest of the tests in suite.

So I need some kind of mechanism or flag where then Sahi or test runner interprets whether to proceed or not.

Thanks,
Sumeet

Comments

  • Hi Sumeet,

    It is not possible to terminate the suite file execution based upon the result of the execution of the First Script.
    If you want to execute the second script based upon the result of the first script,append an Condition at the end of the first script and if satisfies, include the secondScript else logExceptionAsFailure and This can be repeated for all the Script to execute one after another.

    Eg:


    var $a=_exists(Element);
    if($a){
    _include("script2.sah");
    _include("script3.sah");
    .........
    .........
    .............
    }
    _logExceptionAsFailure("Failure");

    This might help you.

    Regards,
    Theeran.
  • Hmm. I remember there are some problems when scripts get too big. I would recommend this Condition at the beginning of the other scripts

    if(_conditon(_exists($element))){
    execute test
    } else {
    skip test
    }
  • I would certainly don't like this approach as we have suite concept in place, it would be nice to have some sort of flag which either take script name as value or comma separated list if any of that script fails.

    OR have capability to set such flag inside the script and the test runner will check it before executing each script if flag is set to terminate it will terminate otherwise it will continue
  • Can somebody from Sahi Team comment, how this can be achieved. OR is there plan to add some sort of dependency which can control the execution of batch run
  • narayannarayan Administrators
    Hi Sumeet,

    Trying to understand your requirement: If tests are run in parallel in a suite, how do you think one script should depend on the other?

    Would it make sense to just split the suites into two, and run the second one only if the first suite passed?

    Regards,
    Narayan
Sign In or Register to comment.