How to use the junit-report-builder.testSuite function in junit-report-builder

To help you get started, we’ve selected a few junit-report-builder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mucsi96 / nightwatch-cucumber / lib / cucumber-junit-report.js View on Github external
features.forEach(function (feature) {
    // create new feature
    const suite = builder
                    .testSuite()
                    .name(options.suiteNamePrefix + feature.name)

    // quit here if feature is empty
    if (!feature.elements) { return }
    // loop over scenarios
    feature.elements.forEach(function (scenario) {
      let result = false
      const messages = []
      // loop over steps
      scenario.steps.forEach(function (step) {
        // quit if steps are empty
        if (step.result) {
          // on failure
          if (step.result.status === 'failed') {
            result = 'failure'
github okta / okta-signin-widget / test / e2e / util / junit-reporter.js View on Github external
module.exports = function (result, outFile) {
  var suite = junitReportBuilder.testSuite()
    .name(result.url)
    .timestamp(new Date().getTime())
    .time(new Date().toGMTString());

  var packageName = result.url;

  result.violations.forEach(function (ruleResult) {

    ruleResult.nodes.forEach(function (violation) {
      var failure = ruleResult.help + ' (' + ruleResult.helpUrl + ')\n';
      var stacktrace = 'Target: ' + violation.target + '\n\n' +
        'HTML: ' + violation.html + '\n\n' +
        'Summary:\n';

      if (violation.any.length) {
        stacktrace += 'Fix any of the following:\n';
github bbc / a11y-tests-web / test / lib / lighthouse.js View on Github external
return lighthouseRunner.run().then(() => {
          sandbox.assert.calledWith(
            reportBuilder.testSuite().testCase().failure,
            'Error on http://www.bbc.co.uk/path/2\n' +
            'Image alt help text\n\n' +
            'Failing elements:\n' +
            'button &gt; svg[role="img"] - <svg class="cta__icon cta__icon--left" role="img">'
          );
        });
      });</svg>
github bbc / a11y-tests-web / test / lib / lighthouse.js View on Github external
return lighthouseRunner.run().then(() => {
          sandbox.assert.calledTwice(reportBuilder.testSuite);
          sandbox.assert.calledWith(reportBuilder.testSuite().name, 'base.url./path/1');
          sandbox.assert.calledWith(reportBuilder.testSuite().name, 'base.url./path/2');
        });
      });
github bbc / a11y-tests-web / test / lib / lighthouse.js View on Github external
return lighthouseRunner.run().then(() => {
          sandbox.assert.calledTwice(reportBuilder.testSuite);
          sandbox.assert.calledWith(reportBuilder.testSuite().time, 6000);
        });
      });
github bbc / a11y-tests-web / lib / lighthouse.js View on Github external
.then((results) => {
      const suiteName = url.replace(/.*?:\/\//g, '').replace('\/', './');
      const suite = reportBuilder.testSuite();
      suite.name(suiteName);

      const { audits, timing: { total: suiteDuration } } = results;

      suite.time(suiteDuration);

      const auditKeys = Object.keys(audits).filter((auditKey) => !audits[auditKey].manual);
      const testCaseTime = (suiteDuration / auditKeys.length);

      auditKeys.forEach((auditKey) => {
        const { score, manual, description, helpText, details = {}, extendedInfo = {} } = audits[auditKey];
        const testCase = suite.testCase();
        testCase.className(suiteName);
        testCase.name(description);
        testCase.time(testCaseTime);
github bbc / a11y-tests-web / lib / junit-reporter.js View on Github external
JUnitReport.prototype.pageChecked = function(page, validationResult) {
  var suiteName = page.url;
  suiteName = suiteName.replace(/.*?:\/\//g, "").replace('\/', './');
  var suite = builder.testSuite().name(suiteName)

  validationResult.results.forEach(function(standardResult) {
    var standard = standardResult.standard
    var testName = standard.section.title + ': ' + standard.name
    var docsUrl = standard.section.documentationUrl
    var testcase = suite.testCase().className(suiteName).name(testName)

    if (standardResult.errors.length > 0) {
      var errors = standardResult.errors.map(prettyErrorOutput)
      testcase.failure('Error on ' + page.url + errors.join('') + '\nMore info at ' + docsUrl)
    }
  })
}
github bbc / a11y-tests-web / lib / bbcA11YJUnitReporter.js View on Github external
JUnitReport.prototype.pageChecked = function (page, validationResult) {
  const suiteName = page.url.replace(/.*?:\/\//g, '').replace('\/', './');
  const suite = builder.testSuite();
  suite.name(suiteName);

  validationResult.results.forEach((standardResult) => {
    const standard = standardResult.standard;
    const testName = standard.section.title + ': ' + standard.name;
    const docsUrl = standard.section.documentationUrl;
    const testCase = suite.testCase();
    testCase.className(suiteName);
    testCase.name(testName);

    if (standardResult.errors && standardResult.errors.length) {
      const errors = standardResult.errors.map(prettyErrorOutput);
      testCase.failure('Error on ' + page.url + errors.join('') + '\nMore info at ' + docsUrl);
    }
  });
};
github garris / BackstopJS / core / command / report.js View on Github external
function writeJunitReport (config, reporter) {
  logger.log('Writing jUnit Report');

  var builder = require('junit-report-builder');
  var suite = builder.testSuite()
    .name(reporter.testSuite);

  for (var i in reporter.tests) {
    if (!reporter.tests.hasOwnProperty(i)) {
      continue;
    }

    var test = reporter.tests[i];
    var testCase = suite.testCase()
      .className(test.pair.selector)
      .name(' ›› ' + test.pair.label);

    if (!test.passed()) {
      var error = 'Design deviation ›› ' + test.pair.label + ' (' + test.pair.selector + ') component';
      testCase.failure(error);
      testCase.error(error);

junit-report-builder

Aimed at making it easier to build Jenkins compatible JUnit XML reports in plugins for testing frameworks

MIT
Latest version published 3 months ago

Package Health Score

74 / 100
Full package analysis