Sys.WaitProcess hanging intermittently
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sys.WaitProcess hanging intermittently
We have a script setup to run after each of our tests that shuts down any applications that might still be running. These are the tested applications but also other applications that may have been started during the test.
Mostly this works fine, but occasionally when we run the tests in TestExecute it will appear to just hang with the test indicating "Waiting on AppX". TestExecute doesn't move beyond this and the test run doesn't complete. What's more TestExecute refuses to shut down and we have to manually kill the TestExecute process or reboot the machine. This doesn't happen often and isn't reproducible, but we are now up to approx 60 tests in the test run and it is happening about a quarter of the test runs and therefore this is becoming a major issue for us. In most instances the app that it is waiting on is not even running.
Below is the code we are using to do this. Does anyone have any guidance on what we are doing wrong or how we can improve this?
function EventControl_OnStopTest(Sender)
{
Log.Enabled = false;
TestedApps.TerminateAll();
TerminateProcess("AppX");
TerminateProcess("AppY");
TerminateProcess("AppZ");
// Delete the settings files
aqFileSystem.DeleteFile(aqEnvironment.GetEnvironmentVariable("LocalAppData") + "\\MyAppData\\*.*");
Log.Enabled = true;
}
function TerminateProcess(processName){
var p = Sys.WaitProcess(processName, 0);
if (p.Exists){
p.Terminate();
}
}
Solved! Go to Solution.
- Labels:
-
Desktop Testing
-
Test Run
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The application it says it is waiting on is not running and not shown in TaskManager.
The TestExecute runner is still showing (see image), but it is not responsive. Clicking on it does nothing. Sometimes TestExecute will show as running in TaskManager and sometimes it doesn't. If it is showing in TaskManager then we can kill the TestExecute task, but if it isn't showing then we have to reset the computer to get it back to a working state.
In this example the application it is waiting on (ExerciseBuilder) was not used in the test and the only place it was referenced was as a process being terminated in the OnStopTest handler.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tough one when it's not reproducible, but here's what I would try
1) Add a little time to the WaitProcess. Rather than 0, maybe 2000.
2) Add an else clause to your if-exists, with just a log message: processName does not exist
Let's see if this either fixes it or gives us some more information to work on.
Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does the user or account holder which TestExecute is running on, have full admin permissions?
