This is a migrated thread and some comments may be shown as answers.

ArtOfTestRunner Breaking On WPF Detach Function

5 Answers 57 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Itree
Top achievements
Rank 1
Itree asked on 08 Feb 2016, 04:47 AM

Hi!

We have automated tests setup for our WPF application. Our application has a self updating process that closes itself, replaces its exe with an updated exe and then restarts itself. We have implemented a way to test this procedure by using a mock application at startup and then feeding in our actual application as mentioned in your KB (http://docs.telerik.com/teststudio/advanced-topics/coded-samples/wpf/connect-to-running-app). We use the Manager.ActiveApplication.Detach(false) function to free the exe from the testing framework, we then update it and then reattach to the application when it restarts using the same method used when we feed in our actual application at startup.

This process works perfectly when running it via a Test List in the Telerik Test Studio IDE Runner. Unfortunately, this process only works on a single run through when we run the very same code on the ArtOfTestRunner.exe on our CI server. It will then refuse to work again until we restart the server. When we run the Manager.ActiveApplication.Detach(false) function, the ArtOfTestRunner.exe will immediately begin the next test in the Test List, instead of running the next step in the currently executing test (which is to hook back into the application after it restarts). 

Do you have any insight as to why this is happening? Why would it work the first time, but continue to fail there after until the server has been restarted?

Hope to hear back soon

5 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 11 Feb 2016, 07:40 AM
Hi,

Does that happen only on your CI server?

What happens if you run it with ArtOfTest.Runner.exe on your local machine? Do you experience the same issue?

Hope to hear from you soon.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Itree
Top achievements
Rank 1
answered on 18 Feb 2016, 02:59 AM

Hi Boyan,

I tested this on my local machine using ArtOfTestRunner (completely bypassing the IDE) and the test list could be run over and over again without an issue.

When I repeated the exact same steps on our CI server, it completed fine the first time. As usual though, on the second run it fired off the next test when it reached the detachment part (instead of continuing to the next step which is to wait for 20 seconds). The detach function here is probably the culprit.

The only difference I can think of that might be causing this to happen is that the ArtOfTestRunner on my local machine was installed via the IDE installation, whilst the one on our CI server was installed with the 'Standalone' runner installer (no IDE). Could this have something to do with why these runners are operating differently?

0
Boyan Boev
Telerik team
answered on 22 Feb 2016, 12:25 PM
Hello,

That shouldn't make any difference. You can try installing it in the same way however I cannot guarantee that this will resolve the issue.

Unfortunately we have never tried such approach with the detach function. Could you please send us the test so we can try reproduce this issue locally and give you a solution.

Hope to hear from you soon.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Itree
Top achievements
Rank 1
answered on 29 Feb 2016, 10:02 PM

Apologies for the late reply, but we dug a little deeper and found the problem.

Turns out that the detach function was throwing a null pointer exception. Our program was being shutdown by the updater quicker than Telerik could run the detach function. As I understand it, unhandled exceptions are considered a failure which is why the next test kicked off automatically. We simply removed the detach function and everything started working as expected. I'm assuming that the detach function was used before we implemented the mock application that gets fed in in place of our actual application. The test runner locks onto the mock application instead of our fed in one. This is why we can now manipulate the fed in one without needing to execute the detach function anymore. 

0
Boyan Boev
Telerik team
answered on 02 Mar 2016, 01:19 PM
Hi,

I am very happy to hear that.

If you need further assistance please let us know.

Regards,
Boyan Boev
Telerik
 
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Itree
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Itree
Top achievements
Rank 1
Share this question
or