I am new to allure reports and want to generate the allure report. Can anyone help with this?
I am trying with a simple example, my project folder containing config.js and test.js and the allure report installed
when I run the config file it is creating a folder allure-results, in that I can see the screenshots and a xml file. I have no idea what to do from here, I am trying with maven but not able to generate the html report.
I have added the code of my example
config.js
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: 'test.js',
onPrepare: function () {
var AllureReporter = require('jasmine-allure-reporter');
jasmine.getEnv().addReporter(new AllureReporter({
allureReport: {
resultsDir: 'allure-results'
}
}));
jasmine.getEnv().afterEach(function (done) {
browser.takeScreenshot().then(function (png) {
allure.createAttachment('Screenshot', function () {
return new Buffer(png, 'base64');
}, 'image/png')();
done();
});
});
}
};
test.js
describe('angularjs homepage todo list', function () {
var todoList = element.all(by.repeater('todo in todoList.todos'));
it('should add a todo', function () {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
});
it('test 2', function () {
expect(todoList.count()).toEqual(3);
});
it('test 3', function () {
expect(todoList.get(2).getText()).toEqual('write first protractor test');
});
it('test 4', function () {
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
Direct Answer : By using Allure Command Line Tool
you can generate report.
when I run the config file it is creating a folder allure-results, in that I can see the screenshots and a xml file.
As you said, it is generating test result data and screenshot in that folder. You can generate report after this. Follow below steps.
npm install allure-commandline --save-dev
allure-results
folder).allure generate allure-results --clean -o allure-report
in the command promptallure-report
in your directory.index.html
file in FireFox to show the report.