Editing a Test Run Configuration XML File

As described in How to: Edit a Test Run Configuration File, you can change a test run configuration in two ways: by using the test run configuration editor or by editing the XML of the test run configuration file. In general, first try to make changes by using the test run configuration editor. If the particular configuration setting that you want to change cannot be changed that way, edit the test run configuration file.

When you change test run configuration settings by using the test run configuration editor, you see those changes reflected in this file. When you change values in this file, you see some, but not all, of the changes reflected in the test run configuration editor.

For more information about how to use the test run configuration editor, see How to: Specify a Test Run Configuration.

Examples

The following sections show how to make specific changes in the XML file that controls test run configuration. You should only make these changes directly in the XML file if you cannot make them by using the test run configuration editor.

  • Adding the Output Directory to Use for All Your Deployment Items

  • Changing Code Coverage Parameters

Adding the Output Directory to Use for All Your Deployment Items

When you run tests, you can add deployment files or directories using the test configuration editor. If you want to specify the output directory for these deployment files, you can add the following lines directly to the XML file. You can also specify the directory on the test method itself, but if you have many unit tests this is quicker to simply specify it in one place if it is the same for all your tests.

Add the following lines within the TestRunConfiguration node:

<Deployment>

<DeploymentItem outputDirectory="MyFolder\" filename="MyFile.exe"/>

<DeploymentItem filename=""/> />

</Deployment>

Changing Code Coverage Parameters

In the test run configuration editor, you can select artifacts to instrument to enable code coverage. Additionally, you can specify whether to instrument them in place, and you can specify a key file to be used to re-sign strong-named assemblies after they have been instrumented.

These settings apply to the entire test run, which means they are applied to all assemblies. If you want to use different settings with individual assemblies, you must do so in the test run configuration XML file.

In this example, you have two code coverage binaries: ClassLibrary1.dll and ClassLibrary2.dll. You can specify, for example, that ClassLibrary1.dll should be instrumented in-place, but not ClassLibrary2.dll.

The following XML shows how to do this. The elements shown here, each of which represents an assembly, are child elements of the <CodeCoverage> element.

<CodeCoverageItem binaryFile="ClassLibrary1\bin\Debug\ClassLibrary1.dll" pdbFile="ClassLibrary1\bin\Debug\ClassLibrary1.pdb" instrumentInPlace="true"  

<CodeCoverageItem binaryFile="ClassLibrary1\bin\Debug\ClassLibrary2.dll" pdbFile="ClassLibrary1\bin\Debug\ClassLibrary1.pdb" instrumentInPlace="false"

See Also

Tasks

How to: Edit a Test Run Configuration File

Concepts

Instrumenting and Re-Signing Assemblies

Other Resources

Command-Line Test Execution