Main Content

matlab.unittest.plugins.XMLPlugin.producingJUnitFormat

Class: matlab.unittest.plugins.XMLPlugin
Package: matlab.unittest.plugins

Construct plugin to write test results in XML format

Syntax

xmlPlugin = matlab.unittest.plugins.XMLPlugin.producingJUnitFormat(xmlFile)
xmlPlugin = matlab.unittest.plugins.XMLPlugin.producingJUnitFormat(xmlFile,'OutputDetail',OutputDetail)

Description

xmlPlugin = matlab.unittest.plugins.XMLPlugin.producingJUnitFormat(xmlFile) returns a plugin that produces JUnit-style XML output to the specified XML file. Using this plugin, you can integrate MATLAB® Unit Test results into third-party systems that recognize JUnit-style XML. For example, you can integrate test results with continuous integration systems like Jenkins®, TeamCity®, or Microsoft® Team Foundation Server.

The XML file is overwritten every time you run the test suite with this plugin.

xmlPlugin = matlab.unittest.plugins.XMLPlugin.producingJUnitFormat(xmlFile,'OutputDetail',OutputDetail) returns a plugin that displays failing events with the amount of detail specified by OutputDetail.

Input Arguments

expand all

Name of the test-result file, specified as a character vector or string scalar. If xmlFile exists, the test framework overwrites the file.

Example: XMLPlugin.producingJUnitFormat('myTestResults.xml')

Data Types: char | string

Detail level for recorded events, specified as an integer value from 0 through 4, as a matlab.unittest.Verbosity enumeration member, or as a string or character vector corresponding to the name of a matlab.unittest.Verbosity enumeration member. Integer values correspond to the members of the matlab.unittest.Verbosity enumeration.

The plugin records failing events with the amount of detail specified by OutputDetail. By default, the plugin records events at the matlab.unittest.Verbosity.Detailed level (level 3).

Numeric RepresentationEnumeration Member NameVerbosity Description
0None

No information

1Terse

Minimal information

2Concise

Moderate amount of information

3Detailed

Some supplemental information

4Verbose

Lots of supplemental information

Output Arguments

expand all

Plugin that writes test results to a file in JUnit-style XML format, returned as a matlab.unittest.plugins.XMLPlugin object.

Attributes

Statictrue

To learn about attributes of methods, see Method Attributes.

Examples

Create Plugin to Create XML Output File

import matlab.unittest.plugins.XMLPlugin;
import matlab.unittest.Verbosity;
 
% Create a XML plugin that sends XML Output to a file
plugin = XMLPlugin.producingJUnitFormat('MyXMLFile.xml');
 
% Create a XML plugin that produces a concise amount of output detail
plugin = XMLPlugin.producingJUnitFormat('MyXMLFile.xml','OutputDetail',Verbosity.Concise);

For more examples, see matlab.unittest.plugins.XMLPlugin.

Version History

Introduced in R2015b