How to have Pex generate NUnit, MbUnit and XUnit tests
By default, Pex will generate MSTEST tests, however that doesn't mean you are constrained to using MSTEST for your project. The Pex Extensions project on CodePlex has a set of extensions which allows Pex to generate code for the three main test frameworks. I've just committed some changes to make the code work against the newly released Pex 0.6. In order to generate tests for a particular framework, you need to follow these instructions.
XUnit
2) In your test project's AssemblyInfo.cs. Add the attribute - [assembly: Pex.Xunit.PexXunitPackage]
3) Pex will now start generating xUnit tests.
NUnit
2) In your test project's AssemblyInfo.cs. Add the attribute - [assembly: Pex.NUnit.PexNUnitPackage]
3) Pex will now start generating NUnit tests.
MbUnit v3
1) Reference Pex.MbUnit.dll
2) In your test project's AssemblyInfo.cs. Add the attribute - [assembly: Pex.MbUnit.PexMbUnitPackage]
3) Pex will now start generating MbUnit v3 tests. A MbUnit extension is also included within the Gallio\MbUnit package.
Note: At the moment, you need to download the source code from codeplex and compile the binaries yourself, there is a single solution file which will build everything.
You also need to ensure both the extensions and your test project are built against the same version of the unit testing framework, otherwise there will be a type mismatch and Pex won't be able to generate any tests.
Labels: Pex





Blogger comments
Read this wiki page on how to do it:
http://www.codeplex.com/Pex/Wiki/View.aspx?title=build&referringTitle=Home
Hope this helps, if you want to know anything else please let me know.
Ben