2. Pex & Moles
White box unit testing tool for .Net
Microsoft Research
Visual Studio 2008/2010 add-in
Free for personal use or with MSDN
license
Support multiple testing frameworks
2
lunes 21 de junio de 2010
3. Pex = Project Exploration
Helps with writing unit tests
Analyze the branch conditions
Create simple parameterized unit tests
automatically
Uses a constraint solver to
systematically generate relevant inputs
3
lunes 21 de junio de 2010
4. Pex
The result is a minimal test
suite with maximum code
coverage
4
lunes 21 de junio de 2010
5. ¿What is Moles?
Lightweight mocking
Allows replacing any .NET method with
a delegate
Isolate from environment dependencies
such as time, file system, database…
Two Types: Stub & Moles Type
5
lunes 21 de junio de 2010
6. Stub Type
Rely on virtual method dispatch
Cannot be used for static methods,
non-virtual methods, sealed virtual
methods, methods in sealed types..
Self-contained
Provide implementations of interfaces
and abstract methods
6
lunes 21 de junio de 2010
7. Moles Type
Rely on runtime code rewriting
Significant performance degradation in
execution time
CLR profiler
Cannot instrument interfaces and
abstract methods
7
lunes 21 de junio de 2010