Coffeehouse Thread

3 posts

Code Testing Using Contracts and Pex

Back to Forum: Coffeehouse
  • User profile image

    Must code contracts and pex be applied in a tdd fashion? Is it possible to apply these testing techniques to 3rd party or legacy code?

  • User profile image

    For a background, I invite people to watch to get an idea on how Pex/Contracts may work together.

  • User profile image

    My answer would be no. Pex and Contracts can both be applied to 3rd party/legacy code, but they really shine when used together:

        - Pex can explore any regardless whether it's 3rd party or legacy. You can use Pex to generate a regression suite for your legacy code (or use the highly experimental 'fix it' feature to infer missing preconditions).
        - Code Contracts can be defined 'out-of-band', i.e. in separate assemblies. So potentially, you could annotate 3rd party code with Contracts. This point is not so obvious though: how much effort are you willing to invest in 3rd party/legacy code?

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.