Including and excluding test methods/projects

Live Unit Testing always runs in the background to give you real-time data of the unit testing result and code coverage. But there exist some cases where you don't want to run all the cases. This may be because of some projects, classes, or methods in a solution that you don't modify for a prolonged period. Unnecessarily running all those cases is just an overhead.

Visual Studio 2017 provides you with an option to include/exclude a specific method, class, or a test project selectively. You can right-click inside a method, select Live Tests from the context menu, and then Include or Exclude. This will internally mark the selected method to be included or excluded from Live Unit Testing as per your choice and save the information in the user settings. When you reopen the solution, the same information will be remembered by Visual Studio:

If you want to include/exclude a specific class, do these same steps by right-clicking inside a class but outside a method. To include/exclude an entire file, right-click outside the class but within the file. All test cases in that file will be either included or excluded, based on your choice.

You can also individually include/exclude a test project. Right-click on that project and from the context menu select Live Tests and then Include or Exclude, as shown in the following screenshot:

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

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