How to run the pex explorations in Visual Studio
For a more in depth look at pex please goto
this site.
Running pex is not too dissimilar to running MSTest inside Visual Studio.
To run pex on a an existing test method that is marked as a pex test method you can do the following :-
- Navigate to a test method marked with a [PexMethod] attribute (the [PexMethod] attribute is is used to mark test method that be used by pex for exploration).
- Right click in the pex test method then in the context menu select 'Pex Explorations' the explorations will begin.
- When the pex explorations are running and an exploration that pex deems a unit test you'll see appear in the explorations pane.
- Once pex has finished you can click on each row to look at the unit test that pex generated for each exploration.
Generating a test project from a pex exploration
- Navigate to a public method and right click inside the method.
- In the context menu select pex->Create parametrised tests. You'll then be presented with series of dialogue boxes just accept the defaults. You should now have a test project created that you can use for unit testing.