IntelliTest (Smart Unit Tests) – Parameterized unit tests will be supported in Visual Studio 2015


facebooktwittergoogle_pluslinkedinmail

Recent release of Visual Studio 2015 RC came out with name change of  Smart Unit Tests – now they will be called IntelliTest.

In general, IntelliTest is a parameterized unit test – PUT. It is a generalization of a unit test which use parameters. A PUT makes statements about the code’s behaviour for an entire set of possible input values, instead of just a single exemplary input value.

IntelliTests are based on previous Microsoft research called ‘Pex’. It’s engine uses white-box code analyses  in order to synthesize test inputs that will execute all code paths. Next the inputs are persisted as a collection of traditional unit tests. This guarantees high coverage. The persisted test suite is evolved as the tested code evolves.

void TestAdd(ArrayList list, object element)
{
    PexAssume.IsNotNull(list);
    list.Add(element);
    PexAssert.IsTrue(list.Contains(element));
}

Limitations:

  • Analyzes .NET applications but generates only C# code.
  • Assumes that the tested code is deterministic.
  • Doesn’t handle multithreaded applications.
  • Doesn’t understand x86 instructions (P/Invoke calls).
  • Constraint solver is limited – can’t reason precisely about floating point arithmetic.

You can find more in Build Better Software with Smart Unit Tests article.

facebooktwittergoogle_pluslinkedinmail

Leave a comment

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