![]() The following example specifies that only a single assembly should be included in code coverage: The Exclude section takes precedence over the Include section: if an assembly is listed in both Include and Exclude, it will not be included in code coverage.įor example, the following XML excludes a single assembly by specifying its name: If an assembly or member matches a clause in the Exclude section, then it is excluded from code coverage. If the Include section is empty or omitted, then all assemblies that are loaded and have associated PDB files are included. You can include or exclude assemblies or specific types and members from code coverage analysis. Include or exclude assemblies and members pdb files to the same local location as the binary (. Symbol resolution can take time, especially when using a remote file location with many assemblies. When you select Analyze Code Coverage, the configuration information is read from the run settings file. To specify a run settings file for running tests from the command line, see Configure unit tests. To select the run settings file, on the Test menu, choose Select Settings File. If you don't see all the item templates, choose Show All Templates, and then choose the item template.Īdd the content from the example file at the end of this article, and then customize it to your needs as described in the sections that follow. Save the file with a name such as nsettings. In Solution Explorer, on the shortcut menu of your solution, choose Add > New Item, and select XML File. To customize code coverage, follow these steps:Īdd a run settings file to your solution. Advanced code coverage settings are specified in a. The run settings file is the configuration file used by unit testing tools. pdb files for these assemblies and copy them into the same folder as the assembly. To include assemblies that aren't part of your solution, obtain the. To exclude test code from the code coverage results and only include application code, add the ExcludeFromCodeCoverageAttribute attribute to your test class. ![]() For more information, see Use code coverage to determine how much code is tested. We recommend that you use this default behavior, because it works well most of the time. Applies to: Visual Studio Visual Studio for Mac Visual Studio Codeīy default, code coverage analyzes all solution assemblies that are loaded during unit tests.
0 Comments
Leave a Reply. |