IntelliTest simplifies writing and maintaining unit tests

Wendy Breiding (SHE/HER)

Writing a suite of unit tests that exhaustively exercise and validate the logic of the code is not easy. It can even be considered too expensive to do at all. Fortunately, IntelliTest addresses both concerns: it helps you achieve high code coverage at a fraction of the cost, and now in Preview, this Enterprise feature supports projects that target .NET6 and will run on x64.

When you run on your .NET code, it generates test cases by dynamically analyzing the code. For every statement in the code, it crafts an input that will reach that statement, doing a case analysis for every conditional branch—if statements, assertions, and all operations that can throw exceptions—much like white box testing. The goal is to generate a test suite covering all branches of your code, and so every time it crafts an input that increases coverage, it emits that concrete value as a test case using C# and MSTest (xUnit and NUnit  to come) as the test framework. The result is a compact suite of tests with high coverage that you didn’t have to write from scratch.

This updated version of IntelliTest is powered by the latest version of the and it generates a varied set of inputs (scoped to those that improve code coverage) that are then plugged into what we call parameterized unit tests for each of your methods. When you Generate Tests, you can select which tests you’d like to preserve into a test project that can serve as your regression suite. As your code is updated, you can rerun IntelliTest to keep the generated tests in sync with your code.

Previous implementations of this Enterprise Edition feature only supported code targeting .NET Framework and did not support x64 configuration. This updated version includes the following:

Give it a try on your projects today by enabling the feature through Tools > Manage Preview Features and selecting IntelliTest support for NetFx and Net6 using Z3 v4 (requires restart).

Screenshot of setting in Visual Studio to turn on IntelliTest

Then in your code, right click within a method and select IntelliTest (Preview) and either Create Project to create a project where your tests can be saved or Generate Tests to generate a set of tests to review and decide which ones to keep.

1 Edit Code; Invoke IntelliTest - 2 Inspect input/output behavior with test outcomes - 3 Save as regular unit tests

Whether you are evolving existing/legacy code and try out IntelliTest to generate a safety net of test before beginning refactoring or exploring existing/new code and use IntelliTest to understand the input/output behavior of the code against various data values, try the updated IntelliTest today!



Discussion is closed. Login to edit/delete existing comments.

  • Muhammad Miftah 4

    Tried this once using the trial version of the Enterprise edition and it wasn’t totally useless. Supporting 64-bit and .NET Standard libraries and .NET 6+ would make it a more valuable feature. That said, please bring this to the Professional edition.

    • Jorge Morales Vidal 1

      That would be awesome, Professional edition licenses are a bit affordable than the Enterprise ones 😭 I’m looking forward for having IntelliTest and Live Unit Testing in the Professional edition.

  • Ola Ekstrand 2

    Running VS 2022 but I don’t see that feature in the “Manage preview features” window, is this for the preview version of Visual Studio?

    • Steve Crane 0

      Neither do I, running VS2022 Enterprise and upgraded to 17.7.4 but still not seeing Intellitest under Tools | Manage Preview Features.

      • Mark Chipman 1

        It’s definitely there (on the latest preview edition).

  • Jacques Doubell 5

    Enterprise only 🙁 Would be nice if Professional was supported as well.

  • Kerry Patrick 2

    Very nice to see that the legacy of the old Pex research project continues at Microsoft.

Feedback usabilla icon