jemishgopani / wdio-json-reporter

A WebdriverIO plugin. Report results in json format. http://webdriver.io
13 stars 32 forks source link

Only counts and outputs first scenario in a Cucumber test using a table for scenarios #4

Closed thedevelopnik closed 8 years ago

thedevelopnik commented 8 years ago

Using Cucumber as the test runner, you can use a table and a Scenario Outline to run multiple similar tests, like so:

Scenario Outline: User enters invalid information into the login form Given User is on login page And User enters on the login page And User clicks log in button Then User should see on the login page

Examples: 
| invalid data                         | error message                          |
| valid email, wrong password          | Invalid email or password.             | 
| valid email, password < 8            | Password must have 8 to 20 characters. |
| valid email, password > 20           | Password must have 8 to 20 characters. |
| unregistered email, valid password   | Invalid email or password.             |
| unregistered email, invalid password | Password must have 8 to 20 characters. |
| not an email, valid password         | Please provide a valid e-mail address. |
| not an email, invalid password       | Please provide a valid e-mail address. |
| empty email, empty password          | This field is required.                |
| valid email, empty password          | This field is required.                |
| empty email, valid password          | This field is required.                |

However, the output from the JSON reporter is only the first scenario, like so:

{ "name": "User enters invalid information into the login form", "duration": 8269, "start": "2016-07-29T21:11:10.897Z", "end": "2016-07-29T21:11:19.166Z", "tests": [ { "name": "User is on login page", "start": "2016-07-29T21:11:10.902Z", "duration": 8409, "state": "pass" }, { "name": "User enters on the login page empty email, valid password", "start": "2016-07-29T21:11:16.776Z", "duration": 2535, "state": "pass" }, { "name": "User clicks log in button", "start": "2016-07-29T21:11:16.976Z", "duration": 2335, "state": "pass" }, { "name": "User should see on the login page This field is required.", "start": "2016-07-29T21:11:17.070Z", "duration": 2241, "state": "pass" } ] }

Also, in the test above, overall it runs through 40 steps (4 per scenario in the table), but JSON reporter will only report that 4 passed.

I'm going to fork the repo and try to add the right functionality. I think in the end it might not be compatible with standard test reporting expectations, so it may need to be a specific tool like wdio-json-cucumber-reporter or something? We'll see.

fijijavis commented 8 years ago

I think you're right. This was ported from the wdio-junit-reporter.