Create NUnit test cases automatically from Pex

為{幸葍}努か 提交于 2019-12-09 13:57:48

问题


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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/5897295/create-nunit-test-cases-automatically-from-pex

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