Pex automatically generates test suites with high code coverage. Right from the Visual Studio code editor, Pex finds interesting input-output values of methods, which can be saved as a small test suite with high code coverage. Microsoft Pex is a Visual Studio add-in for testing .NET Framework applications.Pex is coming under Microsoft Power Tools and its a result of one of Microsoft research projects. Here’s the link for Pex http://research.microsoft.com/en-us/projects/pex/
Following example will give a brief introduction on Pex and will be useful to get an idea on how it works.
Simple WPF application has ben created and it accepts two parameters(expecting two integers) from its silverlight page and displays addition of those two integers. There is a seperate Class called “Calculation” in the same namespace and it has “CalculateResult” method which adding two integers and return the result back. The program is working properly with two integers but as developers we cannot expect that the end user will always enters two integers and in this program it has not handled. In any parameterized method in a program, there can be unhandled scenarios like this(actually not simple like this more complicated than this 🙂 )
|Following method will get two parameters and will try to return sum of those two.|
|Lets run Pex against the CalculateResults method.|
|Continue reading “Pex – Step in to Automated Exploratory Testing for .NET”|