cancel
Showing results for 
Search instead for 
Did you mean: 

Issues when closing my application using test script

SOLVED
Highlighted
Frequent Contributor

Issues when closing my application using test script

I am trying to close my application at the end of the test and running into some issues:

 

Issue#1

TestedApps.MyApplication.Close();

This is not closing my application. It seems to not do anything.

 

Issue#2 (Sys.WaitProcess("MyApplication").Exists seems to not give expected results)

Because of issue#1, I changed that line. Using object spy, I got the alias name of the main application window and I applied to it the close method. This is closing the application as expected. After closing the application, I want to confirm that the application is closed, so I use sys.waitprocess("myapplication").exists but this is where the issue is. It closes the application, then at the step p.Exists, it returns True but I am expecting a False since the application is closed. I ran the script and noted that the application closes, but for some reason sys.waitprocess still thinks that the application exists. I even checked my task manager and confirmed that the application was not present there.

Aliases.MyApplication.MainWindow.Close();
aqUtils.Delay(1000);
var p = Sys.WaitProcess("MyApplication");
if(p.Exists){
Log.Message("My application did not close. Trying to close the application using taskkill command.")
}
else{
Log.Message("Success: My application is now closed.")
return;
}

 

Issue#3

While investigating the above issue, I checked my Event Viewer and I see an error which is pointing to "C:\WINDOWS\System32\ucrtbase.dll" which is the Universal C Runtime in Windows

 

Error log:

Faulting application name: MyApplication.exe, version: 2.6.0.15350, time stamp: 0x00000000
Faulting module name: ucrtbase.dll, version: 10.0.17763.404, time stamp: 0x490b0aeb
Exception code: 0xc0000409
Fault offset: 0x000000000006e91e
Faulting process id: 0x4704
Faulting application start time: 0x01d52baa39f508c6
Faulting application path: C:\Program Files\........\MyApplication.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report Id: 24cd6551-a43e-4e97-8e18-758f7a52723c
Faulting package full name:
Faulting package-relative application ID:

 

I read online about this error and found some answer:

https://superuser.com/questions/1397010/application-crash-due-to-ucrtbase-dll?rq=1

 

Maybe these issues are unrelated but I am not sure.

 

Thank you any suggestions!!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Manager

Re: Issues when closing my application using test script

Hi @sameerjade,

 

Thanks for posting your questions. I recommend that you create one topic per question in the future - you will get the answers much faster.

 

As for the issues,

#1

Will Terminate work?

https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/tested-apps/testedap...

 

#2

I recommend that you specify the timeout parameter in the WaitProcess method.

Sys.WaitProcess("MyApplication", 10000).Exists

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/sys/waitprocess-metho...

 

#3

Could you please clarify when exactly you get this exception?

---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!

View solution in original post

2 REPLIES 2
Community Manager

Re: Issues when closing my application using test script

Hi @sameerjade,

 

Thanks for posting your questions. I recommend that you create one topic per question in the future - you will get the answers much faster.

 

As for the issues,

#1

Will Terminate work?

https://support.smartbear.com/testcomplete/docs/reference/project-objects/items/tested-apps/testedap...

 

#2

I recommend that you specify the timeout parameter in the WaitProcess method.

Sys.WaitProcess("MyApplication", 10000).Exists

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/sys/waitprocess-metho...

 

#3

Could you please clarify when exactly you get this exception?

---------
Tanya Gorbunova
SmartBear Community Manager

 Join SmartBear Connect next April in Boston to meet with software development, API and testing experts from around the world! Get your ticket today!

View solution in original post

Frequent Contributor

Re: Issues when closing my application using test script

Thank you! Terminate worked for me.