How do I send an email when the e2e protractor test case fails?

I am writing test cases for the e2e protractor. When running test cases, if any test fails, it should send an email. How to do it?

Thanks in advance.

+3


source to share


1 answer


Following Leo's comments.

This is not something you need to solve on the level protractor

. protractor

itself is a browser automation testing framework that simulates user action to test your website.

The usual way to report test bugs by email is to do so on a continuous integration server like jenkins

or bamboo

. The idea is to use a reporter JUnitXmlReporter

jasmine-reporters

to generate a report Junit XML

that jenkins

either bamboo

knows how to read and analyze. Then send your test results by email.



Call JUnitXmlReporter

in your function onprepare()

in the protractor config :

onPrepare: function() {
    // The require statement must be down here, since jasmine-reporters
    // needs jasmine to be in the global and protractor does not guarantee
    // this until inside the onPrepare function.
    require('jasmine-reporters');
    jasmine.getEnv().addReporter(
      new jasmine.JUnitXmlReporter('xmloutput', true, true));
},

      

0


source







All Articles