Forum Discussion

Judychen2020's avatar
Judychen2020
Occasional Contributor
4 years ago

How to automatically stop the whole test project when one step is dead

Now we are using Test complete for embedded software testing. we write a dll for communicating with the product. When doing robustness test, some step may cause the product crashed down. Then we can't get any response for the next step. Then the whole test project is crashed. Do we have any way to setting the timeout for the whole project?

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    Not sure, but maybe Runner.Stop / Runner.Halt method(s) will help...

     

    • Judychen2020's avatar
      Judychen2020
      Occasional Contributor

      Thanks for your nice help. But it seems the runner.stop does not help.

       

      The script is as below:

      Function gettime()
      Err.Clear
      On Error Resume Next

      i=1
      while i<100
      BuiltIn.Delay(1000)
      if Err.Number<>0 Then
      Log.Error Err.Description
      Runner.Stop(CurrentTestOnly=True)
      'Else
      'Log.Message(" no error")
      end If
      i = i+1
      wend

      End Function

       

      and I tried to use this function as below. I set a timeout for the project Save Result File to 1 min. But the whole test executed for 100s. And it seems the Runner.stop() does not help. Do you have any good advice?

       

       

      Thanks

      -Judy

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi Judy,

         

        I set a timeout for the project Save Result File to 1 min.

        Could you clarify what exact setting you have set to 1 minute?

         

        Notes as for your code:

        -- On Error Resume Next at the beginning of a function is extremely not recommended approach in VBScript because it obscures all possible problems. Error handling in VBScript is miles away from been convenient and the recommended sequence is like this:

        On Error Resume Next
        <code that might fail with runtime error>

        iErr = Err.Number

        IF(iErr <> 0) Then

          strErrDescr = Err.Description

          On Error GoTo 0

          ...

        End IF

        On Error GoTo 0

        ...

        The reason for the above code is that Err object is internally (re)set after every executed line of code and thus one must store the state of the Err object *immediately* after execution of the line that might fail and then continue to work not with the Err object itself, but with the saved 'copy' of it.

         

        -- if Err.Number<>0 Then

        I see nothing in your code that might fail during runtime with *runtime* error and thus it is expected for me that your code never enters this IF block and thus Runner.Stop() is not called.