locked
Unit test taking a long time to complete RRS feed

  • Question

  • I have created a series of unit tests that instantiate one of our UserControls, adds it to a Window (to make sure all the logic that happens on Loaded occurs), and the tests run fine. I close the window after the tests complete.

     

    Except: it takes 30 seconds to a minute after each test to start the next one. I tried breaking the process after the test is completed to see what it was doing, and it breaks at this:

     

    mscorlib.dll!System.Threading.WaitHandle.InternalWaitOne(System.Runtime.InteropServices.SafeHandle waitableSafeHandle, long millisecondsTimeout, bool hasThreadAffinity, bool exitContext) + 0x2b bytes

     

    Does anyone have any idea what is going on? If I could remove this wait time, it would make our unit tests a lot faster.

    • Moved by Sheldon _Xiao Tuesday, January 3, 2012 5:04 AM (From:Windows Presentation Foundation (WPF))
    Thursday, December 29, 2011 1:28 PM

All replies

  • Hi Troels

    This is not Testing Forum. you can ask your testing Question in below forum. 

    http://social.msdn.microsoft.com/forums/en-US/softwaretesting/threads/

     

    regards

    Raju

    Thursday, December 29, 2011 6:44 PM
  • You're pointing me to an archived forum that is readonly. Also, these problems only occur when testing WPF controls.
    Friday, December 30, 2011 8:10 AM
  • Hi Troels,

     

    Thanks for your post.

     

    It looks like there is a little confusion with your test project.

    As per your description that you want to test a instantiate of WPF user control which is belongs to the UI, we recommend that you should chose the Coded UI Test to build your test project. The unit test should be involved by the Data Layer and the Business Logic Layer.

     

    Please refer to the tutorials from the following link, as this will be helpful:

    http://msdn.microsoft.com/en-us/library/dd286726.aspx

     

    If you have any further questions regarding this issue, please feel free to let me know.


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us
    Friday, January 6, 2012 1:57 AM
  • Hi Vicki,

    We have been using coded UI as well, but these tests are whitebox tests that check very specific properties on controls in our application. And as Coded UI can only check a very limited number of properties, Coded UI is not an option.

    I know I'm in uncharted waters here, but I just wondered if anyone else had tried something similar and discovered a solution to the tests taking too long to complete / clean up.

     

    Monday, January 9, 2012 9:27 AM