How it works

In this recipe, we showed you how the live unit test execution is designed to analyze incremental product and test changes and execute only the subset of tests in the unit test projects, which could be semantically affected by those changes. As mentioned in the introduction section of this chapter, LUT uses the Roslyn APIs to analyze these incremental code updates from your prior test runs. These are the same set of analysis APIs that are used by the Visual Studio IDE diagnostic engine to incrementally update the intellisense/live diagnostics in the error list and squiggles in the editor.

In this recipe, we started with a single class, Class1, in the ClassLibrary project and a single unit test class, UnitTest1, in UnitTestProject. UnitTest1 contains two methods TestMethod1 and TestMethod2, that tested methods Method1 and Method2 in Class1, respectively. We added a new class, Class2, in ClassLibrary project with methods Method5 and Method6. Then, we added a new unit test class, UnitTest2 containing methods TestMethod5 and TestMethod6, that test methods Method5 and Method6, respectively. On adding these methods, LUT determined that the existing tests in type UnitTest1 are unaffected by newly added Class2 and UnitTest2 and hence did not re-execute them. Subsequently, when we edited Class1.Method1, LUT only re-executed UnitTest1.TestMethod1 and UnitTest1.TestMethod2 but not the test methods in UnitTest2.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset