diff --git a/README.md b/README.md index 95de16f..6cebd05 100644 --- a/README.md +++ b/README.md @@ -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 section of the report } }); }; diff --git a/index.js b/index.js index efa712b..3aef3a8 100644 --- a/index.js +++ b/index.js @@ -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 @@ -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) {