ArtOfTestRunner Breaking On WPF Detach Function

6 posts, 0 answers
  1. Itree
    Itree avatar
    4 posts
    Member since:
    Nov 2015

    Posted 07 Feb Link to this post

    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

  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 11 Feb Link to this post

    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!
  3. Itree
    Itree avatar
    4 posts
    Member since:
    Nov 2015

    Posted 17 Feb in reply to Boyan Boev Link to this post

    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?

  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 22 Feb Link to this post

    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!
  5. Itree
    Itree avatar
    4 posts
    Member since:
    Nov 2015

    Posted 29 Feb in reply to Boyan Boev Link to this post

    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. 

  6. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 02 Mar Link to this post

    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!
Back to Top