Report¶
Attribute | Required/Optional | Description |
---|---|---|
disable | Optional | Set this attribute to true to disable the report generation (default: false ) |
copyAlsoToBaseFolder | Optional | Set this to true to also copy all the generated reports to the base folder (default: false ) |
Template | Optional | Use this element to define the template(s) used to generate reports. You can specify any number of templates; a report will be generated using each template specified. More details on the available attributes can be found below. |
Template Element¶
Use the <Template>
element to specify the templates used to generate reports and the behaviour of the output file. You can generate multiple reports by defining multiple <Template>
elements, one for each report.
The following attributes are available:
Attribute | Description |
---|---|
name | The path to the template .cshtml file, relative to the base folder |
outputName | The path of the generated report, relative to the base folder. You can use the following placeholders in file names to ensure the name is unique: {now} : A timestamp with the current date and time. For an overview of the available format strings, see Standard Date and Time Format Strings and Custom Date and Time Format Strings in the official Microsoft documentation.{unique_guid} : Unique GUID. The available format strings can be found in the Remarks section under Guid.ToString(String) in the official Microsoft documentation.To apply .NET Format Strings to placeholders, use the aforementioned format strings within the placeholder, e.g.: {now:yyyy-MM-dd} |
existingFileHandlingStrategy | Determines the behaviour if an existing file with the same name already exists. Possible values:Overwrite (default): Overwrites existing files with the same name.IncrementFilename : Follows the Windows paradigm of adding an incremental suffix (e.g. "(1)", "(2)" etc.) to the end of file names. This will retain the existing file with its original name and result in a new file being generated with the appropriate incremental suffix. |
Note: The report template specified in the <Settings> element (reportTemplate
) is used in addition to the templates specified in the <Report>
element.
Examples¶
To disable the report generation:
<TestProfile xmlns="http://www.specrun.com/schemas/2011/09/TestProfile">
<Settings name="Disable Reports" projectName="SpecRun Test Project" />
<Report disable="true"/>
<TestAssemblyPaths>
<TestAssemblyPath>SpecRun.TestProject.dll</TestAssemblyPath>
</TestAssemblyPaths>
</TestProfile>
To output 2 additional reports and copy the reports to the base folder:
<TestProfile xmlns="http://www.specrun.com/schemas/2011/09/TestProfile">
<Settings name="Multiple Reports" projectName="SpecRun Test Project" />
<Report copyAlsoToBaseFolder="true">
<Template name="CustomReportTemplate_1.cshtml" outputName="Report1.html" />
<Template name="CustomReportTemplate_2.cshtml" outputName="Report2.html" />
</Report>
<TestAssemblyPaths>
<TestAssemblyPath>SpecRun.TestProject.dll</TestAssemblyPath>
</TestAssemblyPaths>
</TestProfile>