Tips and Troubleshooting

Check out Pex FAQs and Pex documentation too!

    • When I create my C# project being put in a network mapped drive, Pex doesn't work
      • Solution: Don't put your C# project in a network mapped drive but put in a local drive
    • When I create my Pex test class with correct Pex annotations by myself, Pex complains that no test class can be found (note by Tao: I don't know why it happens and I once encountered it but you can address the issue with at least the following
      • Solution: Right click on the project in the Solution Explorer -> Pex -> Create Parametrized Unit Test Stubs, and then fill in your Pex test methods there
    • How can I view the coverage report inside Visual Studio?
      • Team Test provides code coverage integrated in the IDE, you simply have to rerun the unit tests with code coverage enabled. To turn on html report,
        • go to Tools -> Options -> Pex pane, select 'Reports' = true.
        • Run Pex 2 x (there is a bug in the refresh of the options)
        • Go to View (in the Pex result view), Open Report.
    • How can I instruct Pex to measure the coverage of my class under test Foo?
      • [PexClass(typeof(Foo))] sets Foo as the Type Under Test for the class. Pex uses that to tune various settings.
    • How can I use set up and tear down methods in my Pex test class?
      • Pex does not monitor set up or tear down methods. Whatever you do in those methods will not be understood by Pex. You can simply keep calling the set up method at the start of each Pex test method or the tear down method at the end of each Pex test method.
    • When I create a factory method for a class, Pex doesn't recognize my factory method.
      • It is very likely that the class is one from the .NET base library (not a user-defined one). Currently Pex doesn't recognize factory methods for a class from the .NET base library.