Recently Microsoft released Update 2 for Visual Studio 2012. If you installed the Update 2, you will get a new project template, under Windows Phone, Windows Phone Unit Test App. This will help you to create unit test project for Windows Phone 8 applications. Once you create the project, necessary references will be added to [...]
Posts Tagged: Unit Testing
How to exclude test assembly from code coverage in VS 2012
If you are using VS 2012, by default Code coverage results are available for Test assembly also. There is no direct way to disable this behavior, either you need to use the ExcludeFromCodeCoverage attribute or you need to use the runsettings file. The ExcludeFromCodeCoverage is pretty straight forward; you need to decorate all the unit [...]
How to return value based on condition in Moq
Today I while writing unit test for one class I got a problem, I have factory method, which will return values based on the input given, and I want to mock this method. I was using Moq for mocking. And I found a solution like this. Happy Programming
How to execute ms tests in parallel on multi-cpu / core machines
VS 2010 supports running MS Tests in parallel. Most of the machines available in the market are multi-cpu / core machines. This will help us to increase the number of tests executing in same time, which will reduce total test time. But while writing tests, developers should make sure the tests are thread safe, if [...]
MSTest.exe does not deploy all items
Today while working on some regression build issues, me and my lead noticed one problem with MS Tests, we are running MSTest.exe from commandline to execute few tests. The problem was MSTest.exe was is not copying all the referenced assemblies to the Out folder, and this is causing failures. We initially thought the issue with [...]
Debugging NUnit Tests in Visual Studio 2010
If you are using NUnit with .Net 4.0 assemblies in Visual Studio 2010, while debugging, you will get this warning from breakpoints locations, “The breakpoint will not currently be hit. No symbols have been loaded for this document” This issues is because of NUnit loads up in .Net 2.0 and then has to load up [...]