Parameterized Unit Tests
Andrew Stopford wrote about a Microsoft Research technology called parameterized testing being developed on a project called Pex (Program EXploration). Pex is described as an…
…intelligent assistant to the programmer. By automatically generating unit tests, it allows [one] to find bug early. In addition, it suggests to the programmer hot to fix the bugs.
In addition to specifications, I have been thinking since last spring about how I could better integrate my software with unit-testing. While I am not planning on building a dedicated system like Pex, one common trait that my system may have with Pex is the ability to symbolically analyze a function with unspecified parameters.
Some of the changes that I had been considering included:
- Recognizing calls to the various unit-testing frameworks such as Assert.IsTrue.
- Accepting test methods containing parameters.
- Presenting an NUnit style tree-view interface.
In addition, NStatic would not actually cause any external side-effects to the environment, which may or may not be a benefit. Also, there may also be some cross-pollenation and integration with the specifications work post-V1.
It’s not entirely clear to me at the moment what additional value the last two bullet points have over just performing a regular scan over the codebase (and/or using specifications): Automatic calls to Setup and Teardown? More structured tests? Exploring specific scenarios?
These are just some of my thoughts for the long-term future of my product. None of these features are coming out in the first version.