A plugin to generate an Allure report out of Jasmine tests.
Using Allure Reporter in Jasmine2Add the lib into package.json
and then configure the plugin:
// conf.js var AllureReporter = require('jasmine-allure-reporter'); jasmine.getEnv().addReporter(new AllureReporter({ resultsDir: 'allure-results' }));Using Allure Reporter in Protractor
Put the above code into the onPrepare
inside of your conf.js
:
// conf.js exports.config = { framework: 'jasmine2', onPrepare: function() { var AllureReporter = require('jasmine-allure-reporter'); jasmine.getEnv().addReporter(new AllureReporter({ resultsDir: 'allure-results' })); } }Generate HTML report from Allure results
The Reporter will generate xml files inside of a resultsDir
, then we need to generate HTML out of them.
Add the allure-commandline
dependency in your current project by running the below command.
npm install allure-commandline --save-dev
After this, you can add "posttest": "allure generate allure-results --clean -o allure-report"
section into your package.json
. So when running the test by using npm test
, the command mensioned in the posttest
will help you to generate the report. You can refer a sample script
section of package.json
file.
"scripts": { "pretest": "rm -rf allure-report", "test": "protractor conf.js", "posttest": "allure generate allure-results --clean -o allure-report || true" }
Added the bash ||
operator in posttest
to overcome this issue
Otherwise choose one of other ways to generate HTML.
Adding Screenshot in the end of each testonPrepare: function () { var AllureReporter = require('jasmine-allure-reporter'); jasmine.getEnv().addReporter(new AllureReporter()); jasmine.getEnv().afterEach(function(done){ browser.takeScreenshot().then(function (png) { allure.createAttachment('Screenshot', function () { return new Buffer(png, 'base64') }, 'image/png')(); done(); }) }); }
Note done
callback!
allure-js-commons
.See the system tests to quickly check how the reporter works in real life: node_modules/protractor/bin/protractor ./test/system/conf.js
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4