robhil / grunt-protractor-cucumber-html-report

Generate html report from JSON file returned by cucumber-js json formatter
MIT License
9 stars 19 forks source link

Does not generate html report on failed status #22

Open nachchid opened 7 years ago

nachchid commented 7 years ago

I am using 'protractor-cucumber-framework' and grunt. For html reports I am using 'protractor-cucumber-html-report'

I am able to generate html reports from 'protractor-cucumber-html-report' only if all my steps pass. The issue is : Failed status, in a step gets reflected in json file but its not generating html reports. I have the result.json file attached below.

Gruntfile.js

'protractor-cucumber-html-report': { default_options: { options: { dest: 'reports',//Where you want to generate the HTML report. output: 'report.html',//File Name testJSONDirectory: 'reports'//Mention where you have generated JSON format. } } },

result.json

[ { "description": " As a user of Protractor\n I should be able to use Cucumber\n In order to run my E2E tests on UnapprovedIncidentDashboardComponent", "elements": [ { "id": "running-cucumber-with-protractor-on-unapprovedincidentdashboardcomponent;protractor-and-cucumber-test-on-unapprovedincidentdashboardcomponent", "keyword": "Scenario", "line": 7, "name": "Protractor and Cucumber Test on UnapprovedIncidentDashboardComponent", "steps": [ { "arguments": [], "keyword": "Given ", "name": "I go to \"http://localhost/\"", "result": { "status": "passed", "duration": 3548859 }, "line": 8, "match": { "location": "Automation\LearningCucumber_Protractor\features\step_definitions\test.stepDefinition1.js:11" } }, { "arguments": [], "keyword": "When ", "name": "The page loads \"UnapprovedIncidentDashboardComponent\"", "result": { "status": "passed", "duration": 1031909 }, "line": 9, "match": { "location": "Automation\LearningCucumber_Protractor\features\step_definitions\test.stepDefinition1.js:16" } }, { "arguments": [], "keyword": "Then ", "name": "Title should match Unapproved Incident Dashboard Component", "result": { "status": "failed", "duration": 2120215837, "error_message": "AssertionError: expected 'Unapproved Incident Dashboard Component' to equal 'Unapproved Incident Dashboard 1Component'" }, "line": 10, "match": { "location": "Automation\LearningCucumber_Protractor\features\step_definitions\test.stepDefinition1.js:20" } } ], "tags": [], "type": "scenario" } ], "id": "running-cucumber-with-protractor-on-unapprovedincidentdashboardcomponent", "keyword": "Feature", "line": 2, "name": "Running Cucumber with Protractor on UnapprovedIncidentDashboardComponent", "tags": [], "uri": "c:\Protractor Automation\LearningCucumber_Protractor\features\test.feature" } ]

package.json { "name": "learning_cucumber_protractor", "version": "1.0.0", "description": "", "main": "protractor.cucumber.conf.js", "dependencies": { "chai": "^3.5.0", "chai-as-promised": "^6.0.0", "cucumber": "^1.3.1", "protractor": "^4.0.9", "protractor-cucumber-framework": "^0.6.0" }, "devDependencies": { "grunt": "^1.0.1", "grunt-contrib-connect": "^1.0.2", "grunt-contrib-jshint": "^1.0.0", "grunt-cucumber": "^0.3.0", "grunt-protractor-cucumber-html-report": "^0.2.8", "grunt-protractor-runner": "^4.0.0", "grunt-protractor-webdriver": "^0.2.5", "load-grunt-tasks": "^3.5.2", "load-tasks": "0.1.0-rc.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" }

maciejkamela commented 7 years ago

HI, Thank you for your message. I noticed that you use cucumber 1.3.1 so I belive that cucumber team has again changed the json structure. I will try to update task accordingly to the new cucumber version. Could you also try to downgrade the cucumber to 1.2.2 and then check whether the report is OK or not?

Tkank you, Maciej Kamela

nachchid commented 7 years ago

I am new to cucumber and protractor ... how to do I downgrade cucumber to 1.2.2.

I tried npm install cucumber@1.2.2 . It did not work

maciejkamela commented 7 years ago

Hi, It should work. Another way is to change cucumber version in package.json to 1.2.2 then removing node_modules directory and again run npm install.

nachchid commented 7 years ago

it worked on version 1.2.2. Will this be fixed to support cucumber 1.3.1?

maciejkamela commented 7 years ago

That's the plan. But don't know yet when exactly is to be done. Stay tunned.

nachchid commented 7 years ago

@maciejkamela : I had it working on 1.2.2. and suddenly it failed generate html report on failed status with cucumber v 1.2.2.

I tried to delete node_modules and did a npm install .. but no luck

package.json file.

{ "name": "learning_cucumber_protractor", "version": "1.0.0", "description": "", "main": "protractor.cucumber.conf.js", "dependencies": { "chai": "^3.5.0", "chai-as-promised": "^6.0.0", "cucumber": "^1.2.2", "protractor": "^4.0.9", "protractor-cucumber-framework": "^0.6.0" }, "devDependencies": { "grunt": "^1.0.1", "grunt-contrib-connect": "^1.0.2", "grunt-contrib-jshint": "^1.0.0", "grunt-cucumber": "^0.3.0", "grunt-protractor-cucumber-html-report": "^0.2.8", "grunt-protractor-runner": "^4.0.0", "grunt-protractor-webdriver": "^0.2.5", "load-grunt-tasks": "^3.5.2", "load-tasks": "0.1.0-rc.0" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" }

maciejkamela commented 7 years ago

hi, I will reconfigure my project's dependencies and will use yours then check wheter I can generate properly report and will let you know. take care

maciejkamela commented 7 years ago

Hi, I checked and your configuration seems to be fine, so problem is somewhere else. Anyway in the next following days I will implement all neccessary tweaks to make the newest cucumber working with my plugin.

Best Regards,

maciejkamela commented 7 years ago

Hi, I've checked generating report with cucumber 1.3.1 and seems to be fine My dependencies are:

"devDependencies": { "chai": "~3.5.0", "chai-as-promised": "~6.0.0", "cucumber": "1.3.1", "extend": "^2.0.0", "grunt": "0.4.5", "grunt-cli": "0.1.13", "grunt-contrib-clean": "^1.0.0", "grunt-contrib-jshint": "^1.0.0", "grunt-contrib-requirejs": "^0.4.4", "grunt-protractor-cucumber-html-report": "0.2.8", "grunt-protractor-runner": "4.0.0", "grunt-template": "^0.2.3", "jshint": "^2.9.1", "jshint-stylish": "^0.4.0", "lodash": "^3.0.0", "load-grunt-configs": "^0.4.0", "load-grunt-tasks": "^0.6.0", "mkdirp": "^0.5.1", "moment": "^2.13.0", "protractor": "^4.0.9", "protractor-cucumber-framework": "^0.6.0", "q": "1.4.1", "request": "^2.73.0", "time-grunt": "^1.0.0" } I use pretty old grunt. Please check and let me know if you notice some errors.

nachchid commented 7 years ago

Thanks! looking fwd for your the new version.

I see that I am using grunt": "^1.0.1", . Do you think that matters. Other than that I don't see anything wrong .

Also to note that after updating my node to 4.0.9 and chrome driver to chromedriver_2.25. I had this issue of reporter not working.

maciejkamela commented 7 years ago

Hi, The grunt should not matter in that case. But do you have still some problems with reporter? Where exactly? Please send me the json file and listed dependencies which you use. Thank you