Forum Discussion

MW_Didata's avatar
MW_Didata
Regular Contributor
3 months ago
Solved

Stop testrun TestExecute/SessionCreator

Our testrun starts with batchscript Sessioncreator in Windows taskscheduler.

23 hours after that another Scheduled task checks if TE is still active and kill the task it to restart the PC so the next run starts fresh.

If TE gets killed this way it will not generate a report.

 

Is there any way to first stop TE give it time to generate the report and then restart?

7 Replies

  • Thanks for the responses and ideas guys.

    It seems like there is no way to use a command to stop TE from another Batchscript.

    I'll check later if I can maybe use the Hotkey idea from justin-bear if it becomes a more common thing.

    For now I'll close the ticket.

  • You should not "kill" applications, unless it has hung. You need to ensure that you are passing in the correct parameters to SessionCreator.exe, so that it can exit after it has fully completed. Also TestExecute should also automatically exit once completed.

    • MW_Didata's avatar
      MW_Didata
      Regular Contributor

      Since 23 hours have passed the only way for TE to still exist is if it hangs, at that point it kinda needs to be killed.

      In normal operations all works fine and TE is closed after testrun is complete.

      This is a just in case condition if my tested appp exists kill it and if TE exists kill that too.

      if TE did exists then the Batchscript also sends a email to me that it could not finish before the restart.

       

      The problem is if I see that mail there is no log to check why it could not finish within 23 hours....

      • rraghvani's avatar
        rraghvani
        Icon for Champion Level 3 rankChampion Level 3

        Also, the logs are only generated once TC/TE has fully completed running through the project suit. I don't think there's any way of gracefully stopping TE. 

        If you think TE has hung, then it could be a bug

  • Hi MW_Didata,

    Do you have AutoHotkey installed on the relevant machine(s)?

    My sense is that utilization of the keyboard shortcut to stop TestExecute, which is SHIFT + F2, should do the trick here.

    Here is what I would try . . .

    1. Install AutoHotkey where applicable (if necessary).
    2. Open (or mass deploy if multiple machines) a text file, and enter the code at the bottom of this post. Do not enter anything else. Save the file as .ahk (not .txt). For the sake of this example, let's say that you have decided to name the file stopTE.ahk . . .
    3. Prior to the line in your .bat file that utilizes taskkill, (or some other method you have chosen for terminating TestExecute), include a new line that executes your stopTE.ahk file, followed by a delay that gives TestExecute enough time to end the test item it is running and produce a test log, which as you noted occurs automatically.

    Additions to your pre-existing .bat file:

    start C:\Users\Public\Documents\stopTE.ahk
    timeout /t <seconds>

    Complete contents of your .ahk file:

    Send, +{F2}

    Let me know how this shakes out. Happy to advise where I can on any roadblocks you might encounter.