Skip to content

Commit

Permalink
feat: Add support for additional properties to add to the report section
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Ng committed Apr 5, 2016
1 parent bed96c4 commit b67d234
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module.exports = function(config) {
suite: '', // suite will become the package name attribute in xml testsuite element
useBrowserName: true, // add browser name to report and classes names
nameFormatter: undefined, // function (browser, result) to customize the name attribute in xml testcase element
classNameFormatter: undefined // function (browser, result) to customize the classname attribute in xml testcase element
classNameFormatter: undefined // function (browser, result) to customize the classname attribute in xml testcase element,
properties: {} // key value pair of properties to add to the <properties> section of the report
}
});
};
Expand Down
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var JUnitReporter = function (baseReporterDecorator, config, logger, helper, for
var useBrowserName = reporterConfig.useBrowserName
var nameFormatter = reporterConfig.nameFormatter
var classNameFormatter = reporterConfig.classNameFormatter
var properties = reporterConfig.properties

var suites
var pendingFileWritings = 0
Expand Down Expand Up @@ -45,8 +46,15 @@ var JUnitReporter = function (baseReporterDecorator, config, logger, helper, for
.att('id', 0)
.att('hostname', os.hostname())

suite.ele('properties')
.ele('property', {name: 'browser.fullName', value: browser.fullName})
var propertiesElement = suite.ele('properties')
propertiesElement.ele('property', {name: 'browser.fullName', value: browser.fullName})

// add additional properties passed in through the config
for (var property in properties) {
if (properties.hasOwnProperty(property)) {
propertiesElement.ele('property', {name: property, value: properties[property]})
}
}
}

var writeXmlForBrowser = function (browser) {
Expand Down

0 comments on commit b67d234

Please sign in to comment.