How to run Unit Test as part of an assembly (non-continuous integration)

I have a Nunit unit test that I need to run as part of my MS build. I know that running the whole test will slow down the build. So, I need to run only the hit test, is there any way to find this ..

+4
source share
3 answers

AFAIK only works with verified tests, it has not yet been completed for NUnit tests. But this is possible for MSTests in Visual Studio 2010 Ultimate / Test Professional:

Recommendation to run tests caused by code changes

You can use Visual Studio Ultimate or Visual Studio Test Professional 2010 to help you determine which tests you may need to run based on the encoding changes that were made to the application under test. To be able to use this functionality, you must use Team Foundation. Build your application and use Microsoft Visual Studio 2010 for version control for your source code.

In any case, you can use the MSBuild Community NUnit Task to run tests from a set of assemblies. You can do this as the dependency target of the standard AfterBuild target by specifying the DependsOnTargets attribute.

 <NUnit Assemblies="..." IncludeCategory="..." ExcludeCategory="..." ToolPath="$(NUnitDllsPath)" ProjectConfiguration="$(Configuration)" OutputXmlFile="$(NUnitOutputPath)\UnitTests.xml" ContinueOnError="true"> 
+2
source

To find out about the tests being tested, you need to track the coverage of the test code code. This is the only way you can check which test is affected by the changes you are checking. I don’t know of any tool that does what you want, besides Microsoft Team Foundation Server.

0
source

Running your tests as part of an assembly can be done through the Build Events properties of your project. You can run the command line tool for NUnit.

But, as PVitt has already pointed out, I don’t know if NUnit can work with Test Impact analysis.

0
source

All Articles