MSBuild, White and nunit-console - Long first test time

Dec 22, 2009 at 4:31 PM

I am using VS2010 Beta 2, White .19 and NUnit on Windows 7 Ultimate to test a WPF application.

I have a test project with four tests. If I use nunit-console from a command window the tests run as expected (as expected meaning the timings seem very much the same as using or the NUnit gui to run the tests - I have been using these tests for several months) - here is my command line

..\support\NUnit\nunit-console bin\Debug\power_calculator_ui_wpf_acceptance_tests.dll

and for comparison to the results below here are the timings from the results file:

<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.power_test_case_one" executed="True" success="True" time="5.736" asserts="1" />
<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.power_test_case_two" executed="True" success="True" time="4.141" asserts="1" />
<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.sample_size_test_case_one" executed="True" success="True" time="5.816" asserts="1" />
<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.sample_size_test_case_two" executed="True" success="True" time="4.347" asserts="1" />

I recently wanted to integrate this test run into my project build so I added the following to my Project file:

<Target Name="AfterBuild">
    <Exec Command='..\..\..\support\NUnit\nunit-console.exe power_calculator_ui_wpf_acceptance_tests.dll' WorkingDirectory='bin\Debug\'>

The build runs as expected and the application launches quite quickly - but then there is a LONG (going to guess 2 minutes or so) pause before any manipulation of the ui happens (Visual Studio just reports busy, no errors show in the build or in the output), once the manipulation starts everything runs about the same as before. The test output is below - note the 146 second time on the first test!

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!--This file represents the results of running a test suite-->
<test-results name="power_calculator_ui_wpf_acceptance_tests.dll" total="4" errors="0" failures="0" not-run="0" inconclusive="0" ignored="0" skipped="0" invalid="0" date="2009-12-22" time="09:33:19"><environment nunit-version="" clr-version="2.0.50727.4927" os-version="Microsoft Windows NT 6.1.7600.0" platform="Win32NT" cwd="C:\Users\cmiles\Documents\Dev\powercalc_white2\src\power_calculator_ui_wpf_acceptance_tests\bin\Debug" machine-name="CMILES-X61" user="cmiles" user-domain="cmiles-x61" />
<culture-info current-culture="en-US" current-uiculture="en-US" />
<test-suite name="power_calculator_ui_wpf_acceptance_tests.dll" executed="True" success="True" time="146.404" asserts="0">
<test-suite name="power_calculator_ui_wpf_acceptance_tests" executed="True" success="True" time="146.368" asserts="0">
<test-suite name="power_calculator_screen_tests" executed="True" success="True" time="146.367" asserts="0">
<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.power_test_case_one" executed="True" success="True" time="131.550" asserts="1" />
<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.power_test_case_two" executed="True" success="True" time="4.716" asserts="1" />
<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.sample_size_test_case_one" executed="True" success="True" time="5.221" asserts="1" />
<test-case name="power_calculator_ui_wpf_acceptance_tests.power_calculator_screen_tests.sample_size_test_case_two" executed="True" success="True" time="4.827" asserts="1" />

Does anyone have any idea what might be causing the long delay? I don't believe anything in my white config is set with a delay this long, I don't get any errors or useful output from NUnit to tell me what is happening and I am at a bit of a loss about how to debug this. I do not have an easy way to run this in VS2008 for comparison.

Thanks for any suggestions/help/pointers/comments,

Charles Miles