Cannot rebuild test dll after running tests

9 posts, 0 answers
  1. Joel
    Joel avatar
    11 posts
    Member since:
    Dec 2010

    Posted 13 Jan 2011 Link to this post

    I have a Visual Studio solution that contains a Silverlight application project in addition to a test project that utilizes the WebAii test framework.  Following is my scenario:

    1.  I run the tests successfully.
    2.  I make a change to my test project and rebuild.
    3.  I get the following build error when the test project gets recompiled:  "The process cannot access the file 'bin\Debug\AcceptanceTests.dll' because it is being used by another process." 
    4.  It turns out that the QTAgent.exe process still has a hold of AcceptanceTests.dll.
    5.  I use process explorer to kill the QTAgent.exe process after which the build will now successfully complete.

    Although this is a solution, it is becoming quite annoying.  Is there any way I can get around having to kill QTAgent each time I need to rebuild by test project?

  2. Cody
    Admin
    Cody avatar
    2514 posts
    Member since:
    May 2013

    Posted 13 Jan 2011 Link to this post

    Hello Joel,

    What steps are you taking to run everything? I normally run my tests from a solution that contains just the test project. When I execute my test from Test View, I see QTAgent start up, the test runs, the test finishes and QTAgent immediately exists. It doesn't stick around as you describe.

    What if you separated your projects into two separate solutions? Run two instances of VS, one for your Silverlight app development and the other for your test development. Does that approach work any better?

    Regards,
    Cody
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment

  3.   Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!
  4. Joel
    Joel avatar
    11 posts
    Member since:
    Dec 2010

    Posted 14 Jan 2011 Link to this post

    Hi Cody,

    Either way, I get the same results.  I am running another set of tests against a Silverlight application where the application is in one solution and the tests are in another.

    Is there something special I need to do during test tear down?  Right now, I'm just closing the browser (e.g. ActiveBrowser.Close(); )

    Thanks.

    Joel

  5. Cody
    Admin
    Cody avatar
    2514 posts
    Member since:
    May 2013

    Posted 14 Jan 2011 Link to this post

    Hello Joel,

    How are your tests structured? What type of test are you using? A coded unit test or a WebAii test (i.e. a .aii file)?

    If you're using a pure coded test you need to include the tear down code (and you don't need an ActiveBrowser.Close(); since our tear down code does this for you). Our standard tear down code looks like this:

    // Use TestCleanup to run code after each test has run
    [TestCleanup()]
    public void MyTestCleanup()
    {
     
        //
        // Place any additional cleanup here
        //
     
        #region WebAii CleanUp
     
        // Shuts down WebAii manager and closes all browsers currently running
        // after each test. This call is ignored if recycleBrowser is set
        this.CleanUp();
     
        #endregion
    }
     
    //Use ClassCleanup to run code after all tests in a class have run
    [ClassCleanup()]
    public static void MyClassCleanup()
    {
        // This will shut down all browsers if
        // recycleBrowser is turned on. Else
        // will do nothing.
        ShutDown();
    }

    Regards,
    Cody
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment

  6. Joel
    Joel avatar
    11 posts
    Member since:
    Dec 2010

    Posted 17 Jan 2011 Link to this post

    Cody,

    That fixed it.  Thanks for your help.

    Joel

  7. Di
    Di avatar
    3 posts
    Member since:
    Apr 2011

    Posted 25 May 2011 Link to this post

    Hi!
    I have similar problem, every time I want to rebuild my test project I get "The process cannot access the file because it is being used by another process.", ending QTAgent manually helps, but it's not really convenient solution.
    I use standard webaii test template, so I have in my solution both this.CleanUp() and ShutDown(). Is there anything else I should do?
    Thanks! 

  8. Cody
    Admin
    Cody avatar
    2514 posts
    Member since:
    May 2013

    Posted 25 May 2011 Link to this post

    Hi Daniela,

    It sounds like QTAgent is not shutting down properly at the end of the test. This implies some thread in the test is sticking around and not exiting as it should. Have you manually spawned any threads? Would you mind sending us your test code so we can try to identify the problem?

    Regards,
    Cody
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!

  9. Di
    Di avatar
    3 posts
    Member since:
    Apr 2011

    Posted 07 Jun 2011 Link to this post

    Hi Cody,
    thanks for your reply. I have the application locally so you won't be able to rerun the test, but maybe you'll find something wrong in test initialization code...
    Thank you!

  10. Stoich
    Admin
    Stoich avatar
    1 posts
    Member since:
    Sep 2012

    Posted 10 Jun 2011 Link to this post

    Hi Daniela,
         the initialization for your test is not the problem. It's going to be difficult to get to the bottom of the issue without more info. We can give you a dropbox in private so that you can share your code with us without posting it on this public forum.

    Greetings,
    Stoich
    the Telerik team

    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!

Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!