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 GallioMbUnit 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.
Sadly it appears that Pex will not generate NUnit 2.5alpha3 tests. Any hope of this in the near future?
Pex would be able to generate 2.5 tests, however you will have to do some additional work. The Pex Extensions project will help. The binary releases are built against 2.4.8, however you can manually rebuild the project for 2.5 and then Pex will be able to generate code.
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
It worked. Thanks for your help.
Pex version 0.11 and up supports NUnit, MbUnit and xUnit.net out of the box.