Forum Discussion

chdittmer's avatar
chdittmer
Occasional Contributor
11 years ago
Solved

Knowing when a network suite job fails

I have a script that I need to run alternately on two machine. The machines use the same piece of hardware that only has enough resources for one at a time so I used a network suite with two jobs that aletrnately execute on the machines. The script needs to run infinitely untill something fails. I run the script in a loop that looks something like this:



While (run ==true) {

NetworkSuite.Jobs.Items(0).Run(True);

Delay(5000);  //the hardware needs to time to release resources

NetworkSuite.Jobs.Items(1).Run(True);

Delay(5000);  //the hardware needs to time to release resources

}



The problem I am having is I need the script to stop if one of the jobs fail. As it is the scripts will keep running if one of them fail. Should I be using a different approach? Is there a way for me to check if the last run of one of the jobs failed?



Thanks in advance.



  • Hi Carl,



    The answer may depend on your definition of the job failure.

    As a possibly acceptable approach, you may create the handler for the OnLogError event (see TC help for more details on this) and stop test run via Runner.Stop from within the handler.

2 Replies

  • AlexKaras's avatar
    AlexKaras
    Icon for Champion Level 1 rankChampion Level 1
    Hi Carl,



    The answer may depend on your definition of the job failure.

    As a possibly acceptable approach, you may create the handler for the OnLogError event (see TC help for more details on this) and stop test run via Runner.Stop from within the handler.