I need to create the NUnit Test case automatically from my .Net Solution file. Morover this needs to be done , from command line. I heard Pex create test cases automatically. Let know
Create NUnit test cases automatically from Pex
Asked Answered
The following steps should get you there:
- Add a reference to Pex.NUnit.dll in your test project
- In your test project's AssemblyInfo.cs, add the attribute -
[assembly: Pex.NUnit.PexNUnitPackage]
- Build your solution (either from Visual Studio or using msbuild from the command line)
- run Pex from the command line:
pex.exe bin\Debug\TestProjectName.dll
- The tests are placed under
reports\TestProjecName.#####.#####\tests
.
You can read more about this in Exercise 5 of Parameterized Unit Testing with Microsoft Pex
Ryan Gross' answer points to the right direction.
However Pex.exe generates Unit Tests from Parameterized Unit Tests, not from application classes itself.
To generate Parameterized Unit Tests you need to run pexwizard.exe
pexwizard.exe <your assembly name> options
Possible options are described in http://testoriented.googlecode.com/svn-history/r89/suitability/trunk/Tools/Pex-0.22.50128.1/pexwizard.txt
© 2022 - 2024 — McMap. All rights reserved.