Forum Discussion

fujunxu's avatar
fujunxu
Contributor
9 years ago

With error message "The process ... was not found" Runner.Stop(true) stop the whold test.

I have two testitems.  Testitem1 is the real testing script.  Testitem2 is the one send result to users and cleanup...  I used the Runner.Stop(true)in GenaralEvents_OnLogError() so when the first testitem failed I can stop and move on to testitem2 (send result to users).  It works fine for most of the time. 

But sometimes I found if my application was crashed during testing the whole test stopped.  It looks like when my script run “myprocess= Sys.Process("My Application")” and at the same time my application was crashed my testscript will stop the whole test(it will not run testitem2).

It looks like Runner.Stop(true) couldn't handle "The process ... was not found" error  or have I miss somthing ? 

 

Thanks,

 

 

  • NisHera's avatar
    NisHera
    Valued Contributor

    What will happens if you run 2nd test wihout opening your application?

     

    if second test depend on your applications process, I would suggest using Sys.WaitProcess(ProcessName, Timeout, ProcessIndex)  method to improve stability.

    • fujunxu's avatar
      fujunxu
      Contributor

      2nd test item only send logs using email.  It doesn't communicate with my application.  

      TC behave differently:

      1.  I killed my application(process) when the script tried to find the my process using (Sys.Process()). it would raised the "The process ... was not found " and Runner.Stop(true) stopped the whole project.

      2.  I killed the process when the script tried to find certain window.  It would raised "control not found..." and Runner.Stop() stopped the 1st test item and then go to start 2nd test item.

      I thought Runner.Stop should always stop the current testitem and go to next testitem.

      Thank.

  • .Is it a good idea to check whether the tested app is still running before calling the Runner.stop call?

    If(myprocess.Exists)

    {

    Runner.Stop(true)

    }

    • fujunxu's avatar
      fujunxu
      Contributor

      I need to call Runner.stop even the tested app is not running.  I can check if the process is Exists and then rasie my own error message to make sure it didn't raise the "The process ... was not found" error.  But I want to know why Sys.Process caused the Runner.Stop behaved differently.  Maybe I miss something ...

      Thanks.