none
Visual studio 2010 Ulitimate Test System

    Question

  • Iam working with MS VS 2010 ulitimate edition.I developed some unit test cases with VS unit test framework.
    I need a help in configuring C# unit testing to run after post-build
    in cases: when developer doing build on own PC and when doing nightly build on buildserver) and need to find out how to configure things for unit testing .
    Monday, March 07, 2011 12:12 PM

Answers

All replies

  • Hi Vijay,

    This blog should help you get started with configuring unit tests in the build http://geekswithblogs.net/jakob/archive/2009/06/03/tfs-team-build-2010-running-unit-tests.aspx

    Thanks,

    Anuj

    Monday, March 07, 2011 6:52 PM
  • Thanks for your reply Anuj..

    Is there any way to configure unit test cases in build when developer doing build on own PC  using VS 2010

    Thanks

    Vijay

     

    Tuesday, March 08, 2011 2:07 AM
  • Hi Vijay,

    You can ask the developers to run the unit tests from the vsmdi. This will first build the dev code and then run the tests.

    You could also write a batch file which first calls msbuild to build the dev code and then calls mstest to run the tests. You can then ask the devs to run this batch file for generating the builds.

    Thanks,

    Anuj

    Tuesday, March 08, 2011 2:17 AM
  • Hi

    Can we  specify to run unit tests in post-build event command line in VS 2010 IDE.

    Can anyone help how to do to that?

     

    Thanks

    Vijay

     

     

    Tuesday, March 08, 2011 4:53 AM
  • Hi Vijay,

    You can create a batch file which calls mstest (refer http://msdn.microsoft.com/en-us/library/ms182489(v=vs.80).aspx )

    You can then call this batch file in the post build event.

    Thanks,

    Anuj

    • Marked as answer by Vijay_0901 Wednesday, March 09, 2011 5:12 AM
    Tuesday, March 08, 2011 11:49 PM
  • Add this to your the test project's post build event:

    "$(DevEnvDir)mstest.exe" /testcontainer:"$(TargetPath)" /detail:errormessage

     

    When ever you build it will display the test results in the build log.

    • Proposed as answer by J. Robinson Thursday, February 16, 2012 12:17 AM
    Saturday, January 07, 2012 8:04 PM
  • Add this to your the test project's post build event:

    "$(DevEnvDir)mstest.exe" /testcontainer:"$(TargetPath)" /detail:errormessage

     

    When ever you build it will display the test results in the build log.

    Be mindful to add the doube qoutes " as djs24356 has it. When it runs you will see error code 1 (if you have any failing tests) in your Error List, just switch over to the Output window to see the test results.

    If you get error code 9009, ensure that you aren't missing any of the double qoutes, especially if your mstest.exe is in a path that has spaces.

    To customise the display for the test results, you can see all the information for /detail in the link proposed by Anuj.

    Thanks everyone, great suggestions.

    Thursday, February 16, 2012 12:24 AM