Create NUnit test cases automatically from Pex

一个人想着一个人 提交于 2019-12-03 21:33:31

The following steps should get you there:

  1. Add a reference to Pex.NUnit.dll in your test project
  2. In your test project's AssemblyInfo.cs, add the attribute - [assembly: Pex.NUnit.PexNUnitPackage]
  3. Build your solution (either from Visual Studio or using msbuild from the command line)
  4. run Pex from the command line: pex.exe bin\Debug\TestProjectName.dll
  5. The tests are placed under reports\TestProjecName.#####.#####\tests.

You can read more about this in Exercise 5 of Parameterized Unit Testing with Microsoft Pex

Michael Freidgeim

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!