Monitor automated runs - NextensArelB/SwaggerGenerationTool GitHub Wiki

Objective When scripts are added to the pipeline, they will run automatically without any manual interference, except that the execution needs to be monitored to check if there are any failures. In case there are failures the team needs to take action

Who DEV and QA involved in test automation or a person in the team assigned to check the results

What The results out of the automated runs and more specifically, the failures

When Each time when a deployment takes place, the tests are automatically run and a report is created

How The best way is to get an notification a Teams channel for that team with the results of the tests, but at least the outcome needs to be checked by the Tester, or the person who has started the run of the Pipeline.

In the Pipeline for the product involved you can send the test results from for example Karate API test to a specific notifications channel: image.png

##How to implement (technically)

One solution is to create an Javascript function that is able to publish the results to MS Teams channel like this example below.

In the Pipeline a powershell script will start the Karate test and generate the results.

image.png

And will invoke this Javascript to publish a summary of the results:

function postResults(results, options) {
  let xhr = new XMLHttpRequest();
  let url = options.msTeamsIncomingWebhookUrl;
  xhr.open("POST", url, true);
  xhr.setRequestHeader("Content-Type", "application/json");
  xhr.onreadystatechange = function () {
    if (xhr.readyState === 4 && xhr.status === 200) {
      console.log("Posted to MS Teams channel successfully");
    }
    else {
      console.log("Failed to post to MS Teams channel. Status code: " + xhr.status);
    }
  };

  let data = JSON.stringify({
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "summary": options.cardSummary,
    "sections": [{
        "activityTitle": options.cardTitle,
        "activitySubtitle": options.cardSubtitle,
        "activityImage": options.activityImage,
        "facts": [{
            "name": "Feature count",
            "value": results.featureCount
        }, {
            "name": "Number of failed tests",
            "value": results.featureFailure
        }, {
          "name": "Success %",
          "value": results.successPercent + "%"
        }],
        "markdown": true
    }],
      "potentialAction": [{
        "@type": "OpenUri",
        "name": options.actionName,
        "targets": [{
            "os": "default",
            "uri": options.actionOpenUrl
        }]
    }]
  })

  xhr.send(data);
}

function buildAndPost(options) {
  var results = gatherInfo(options.fileLocation);
  postResults(results, options);
}

Tools

  • Azure
  • ....
⚠️ **GitHub.com Fallback** ⚠️