Testing with Pex

Yan Cui

I help clients go faster for less using serverless technologies.

Some time ago I read about (might be on DotNetRocks) a little gem coming out of Microsoft’s research lab called Pex, which is a framework for doing automated White Box Testing in .Net. It’s still in its early days (despite having been around for more than 2 years now) but packs a bag of potential judging by what I’ve seen of the demo materials and been able to use myself!

In short, Pex is able to analyze your methods and work out the boundary conditions, etc. and derive a series of tests that can be used to test your method with as high a coverage as possible. The download package also includes a lightweight framework for test stubs and detours (which basically allows you to replace any .Net method with your own delegate) called Stubs and Moles. It also comes with the ability to automatically generate test project for you in MSTest and NUnit though I haven’t tested out the NUnit generation as it didn’t support NUnit generation the last time I played around it.

I won’t go into detail on how to use it as there are a ton of documentation and demo material on its site and I have barely scratched the surface myself, but do check it out if you haven’t done so already!


 

Whenever you’re ready, here are 4 ways I can help you:

  1. If you want a one-stop shop to help you quickly level up your serverless skills, you should check out my Production-Ready Serverless workshop. Over 20 AWS Heroes & Community Builders have passed through this workshop, plus 1000+ students from the likes of AWS, LEGO, Booking, HBO and Siemens.
  2. If you want to learn how to test serverless applications without all the pain and hassle, you should check out my latest course, Testing Serverless Architectures.
  3. If you’re a manager or founder and want to help your team move faster and build better software, then check out my consulting services.
  4. If you just want to hang out, talk serverless, or ask for help, then you should join my FREE Community.

 


Leave a Comment

Your email address will not be published. Required fields are marked *