WPF - recorder + application quit and start again

11 posts, 0 answers
  1. Dmitry
    Dmitry avatar
    29 posts
    Member since:
    Apr 2011

    Posted 05 Aug 2017 Link to this post

         Is it possible to continue recording tests after tested application was restarted in coded step? We need this to ensure that test data created in app are persisted and we restart application to make sure that newly added data is still there, but recorder fails with "process with id cannot be found"- I suppose it still refers to old process which in our case is already gone.
  2. Aaron
    Aaron avatar
    58 posts
    Member since:
    May 2016

    Posted 07 Aug 2017 in reply to Dmitry Link to this post

    I'm not sure how "proper" this solution is, but it works for me. See the attached image for how I do this in a coded step. 

    Before calling Manage.ActiveApplication.Quit(), I make sure my app is in a spot where it can be safely closed (i.e. I put myself back at my login page before quitting the application).

     

  3. Aaron
    Aaron avatar
    58 posts
    Member since:
    May 2016

    Posted 07 Aug 2017 in reply to Dmitry Link to this post

    Last post didn't attach my screenshot...
  4. Aaron
    Aaron avatar
    58 posts
    Member since:
    May 2016

    Posted 07 Aug 2017 Link to this post

    http://prntscr.com/g5ika5
  5. Dmitry
    Dmitry avatar
    29 posts
    Member since:
    Apr 2011

    Posted 08 Aug 2017 Link to this post

    Aaron, thanks for your answer, I tried it, and couple more ideas, but it seems Telerik recorder does not care about other instances of application, and always wants to see the instance it has created at the test start phase.

    I tried to set ActiveApplication in Manager, even via reflection, but Recorder does not care about active application. It has some process id, and it want to see only that process.

  6. Dmitry
    Dmitry avatar
    29 posts
    Member since:
    Apr 2011

    Posted 08 Aug 2017 Link to this post

    Acttually this seems to be issue of TestStudio itself - it calls public method of recorder passing wrong (outdated) process id to it, that's why recorder cannot connect. In my case this means there is no way for TestStudio to continue recording via "run to here" if test has app restart as one the steps...
  7. Aaron
    Aaron avatar
    58 posts
    Member since:
    May 2016

    Posted 08 Aug 2017 in reply to Dmitry Link to this post

    Is there a reason that your process needs to be restarted DURING test recording? Couldn't you record the whole thing as if the process doesn't restart in one go, and then use something similar to my coded step (which should definitely work on playback) as a step manually inserted where you would want the process to restart?
  8. Dmitry
    Dmitry avatar
    29 posts
    Member since:
    Apr 2011

    Posted 08 Aug 2017 in reply to Aaron Link to this post

    What you are suggesting - is the workaround we are forced to use, but I don't think this is a good approach in such an application like TestStudio, that should help making tests, not creating obstacles in a way.

    Also, worth mentioning - wpf recorder has a quite big bug (https://feedback.telerik.com/Project/161/Feedback/Details/225866-recorder-does-not-identify-the-automationids-in-a-custom-wpf-application-when-exe) in it, which forces us to spend much time on a single test, just because of this bug. I mean we are forced to rerecord steps, because DOM representation in recorder is different between recording and executing, but using option "run to here" we can partially solve this problem.

  9. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    308 posts

    Posted 10 Aug 2017 Link to this post

    Hi Dmitry,

    In WPF testing by design it is meant to have only one application per test recording. As you observed if you start second process in the same test the recorder is not launched and attached to it. A workaround could be to use a test as step in the same test or to start a new test when it is necessary to launch the application again.

    The problem you mentioned in your last response is under investigation from our dev team. I hope it would be processed soon.

    @Aaron: Thank you for pointing out right directions on this problem.

    Best Regards,
    Nikolay Petrov
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  10. Dmitry
    Dmitry avatar
    29 posts
    Member since:
    Apr 2011

    Posted 11 Aug 2017 in reply to Nikolay Petrov Link to this post

    Let me disagree, it is a bad design if your recorder cannot attach to an "ActiveApplication" property of Manager (static class property available in coded steps). Why in code I can REPLACE application instance, but recorder cannot take process Id from that manager?
  11. Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    308 posts

    Posted 16 Aug 2017 Link to this post

    Hi Dmitry,

    Thank you for this feedback. As I mentioned previously to have one recorder available per a test script scenario is set by design. If you think that this work-flow could be improved - please add a feedback on our portal that will be reviewed by our management. Thank you in advance.

    Best Regards,
    Nikolay Petrov
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top