Episode

Research: Contract Checking and Automated Test Generation with Pex

In theory, Design by Contract and unit testing are excellent approaches to improve code quality. Learn how to use code contracts that express pre-conditions, post-conditions, and object invariants in any managed language that improve testability, enhance static analysis, and serve as checked API documentation. Contracts are leveraged for advanced static analysis and translated into runtime checks. See how automated program exploration (Pex) discovers boundary conditions in code that cause failures and generates traditional unit test suites with high code coverage. Contracts and Pex work together to target contract checks, runtime failures (null dereferences, index out of range, etc.), and any other kind of assertions. Use them to write higher quality software with less effort.

  • Nikolai Tillmann
    Nikolai Tillmann has been with Microsoft Research for 6 years. He is currently leading the Pex project, building an automated test case generation tool for .NET based program analysis. Previously, he worked on Spec Explorer, a model-based testing tool.
  • Mike Barnett
    Mike Barnett has been at Microsoft Research since 1995. He has spent the last several years working on the Spec# project, an advanced verification environment and language for .NET.