Skip to content
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.

Split pending and skipped tests #34

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Split pending and skipped tests #34

wants to merge 2 commits into from

Conversation

just-boris
Copy link

@just-boris just-boris commented Sep 18, 2016

This is a first step to solve webdriverio-boneyard/wdio-allure-reporter#26

Now skipped tests will be reported with skipped status. The pending status is still there for really pending tests (tests with empty implementation).

@just-boris
Copy link
Author

just-boris commented Sep 18, 2016

But the pending tests are still broken. They are firing test:start event that still breaks Allure.
I don't know how widely pending feature is used, but we need to find a solution for this as well.

Fixed that, now they are all also are saved as skipped for sake of consistency

@just-boris
Copy link
Author

⚠️ Breaking change: after that fix, all reporters, like spec will stop report skipped steps as pending. To bring the previous behavior back, they should listen to new test:skipped event.

@just-boris
Copy link
Author

ping @christian-bromann

@christian-bromann
Copy link
Contributor

To bring the previous behavior back, they should listen to new test:skipped event.

Let's make sure first to have all reporters updated before landing this change.

@@ -84,7 +84,8 @@ class CucumberReporter {
case Cucumber.Status.PENDING:
case Cucumber.Status.SKIPPED:
case Cucumber.Status.AMBIGUOUS:
e = 'pending'
e = 'skipped'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@just-boris I still don't know why we change the event name here, can't we handle this in the allure reporter only?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pending status is still there for really pending tests (tests with empty implementation)

According to this change, pending, skipped and ambiguous tests are still treated equally.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of this change is normalizing behavior of Cucumber with other frameworks.

Neither Mocha nor Jasmine doesn't emit test:start for pending tests.
I tried to cancel test:start event for pending test, but Cucumber API is designed in a way that doesn't let us know about pending test in advance.

This is why I came up with the current solution

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that the base reporter does not trigger if the event name is skipped, see https://github.com/webdriverio/webdriverio/blob/master/lib/utils/BaseReporter.js#L114

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the allure reporter is the only reporter that has problems with it why not just fixing it there?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a valid point, but then here is a different problem.
Mocha framework doesn't fire test:start event for pending tests, but Cucumber does.
Allure is the only reporter that suffers from it just because it is the only reporter from the standard set, that uses this event, but there is a general problem in inconsistency, that I am trying to mitigate.

@esclapes
Copy link

I just bumped into this issue. Allure is not able to generate the reports from our cucumber features and this patch seems to fix the issue. As I understand the malformed XML files are missing stop and status attributes. Is there any way we can get those from current events?

How could I help?

@christian-bromann
Copy link
Contributor

@esclapes @just-boris we need to mitigate the inconsistencies between all frameworks and make sure that they all fire the same events

@esclapes
Copy link

esclapes commented Apr 13, 2017

I have had a look at the different framework adapters to check how/when are they emitting events. There are indeed some inconsistencies. I might have missed something, but here are my two cents:

  • there seems to be no test:end event sent in the cucumber adapter. Is that right?
  • cucumber seems to have many more status so the bundling makes the abstraction more leaky. Would it hurt to add new states on the wdio side even if they do not map to all frameworks?
  • in terms of implementation a more explicit mapping of framework events like the one in MochaAdapter::EVENTS would make it easier to standardize and spot the differences. It is specially difficult to know what is emitted when doing things like var e = 'test:' + test.status.replace(/ed/, '')

This is the overview.

baseReporter cucumber mocha jasmine qunit
suite:start x Before feature and scenario suite suiteStarted suiteStart
suite:end x After feature and scenario suite end testStart
test:start x Before step test specStarted testStart
test:end x - test end specDone: any testEnd
test:fail x Handle: FAILED & UNDEFINED fail specDone: failed testEnd: “other”
test:pass x Handle: PASSED pass specDone: passed testEnd: passed
test:pending x Handle: PENDING, SKIPPED & AMBIGUOUS pending specDone: pending testEnd: pending
test:disabled? - specDone: disabled
hook:start x - hook ?
hook:start x - hook end ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants