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);
});
});
Allure Report is a flexible, lightweight multi-language test reporting tool. It provides clear graphical reports and allows everyone involved in the development process to extract the maximum of information from the everyday testing process.
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.Note : If the report is in loading state, please try to open in different browsers
If the allure report is available then the report can be viewed with the below command
allure generate 'available report folder path' && allure open
I got the solution, an easy 1,
Allure setup in your system
Step to generated allure report
The above command is used to only view the report
If we have generated the "allure-report" folder using the command
allure generate path_of_allure-report_folder_generated --clean -o allure-report
then there are chances that the index.html might not display any report due to browser constraints, so to open this index.html it is always good practice to open it from the command prompt using below command
allure open path_of_'allure-report'_folder_generated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With