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

Allure report treats passed Mocha beforeAll and afterAll hooks as passed tests #128

Open
MartijnThiele opened this issue Aug 6, 2018 · 20 comments

Comments

@MartijnThiele
Copy link

I am building a ta-framework using

-- wdio-mocha-framework@0.6.2 -- wdio-allure-reporter@0.6.3
`-- webdriverio@4.13.1

My framework has around 20 spec files, most of which make use of mocha's beforeAll and afterAll hooks to do setup and cleanup.

My Allure report (generated by jenkins) sees these hooks as actual tests, reporting them as such. This causes allure to report almost 40 extra tests, which messes up my report

I also found a variation to this behaviour: if a spec file contains one or more skipped tests, the beforeAll method will show up as skipped also. This could have something to do with the freshly fixed bug that causes only 1 skipped test to be shown, but I am not sure.

For reference, the images below are allure report and wdio spec report for the same test run.

image

image

Could the wdio allure reporter be adjusted so that beforeAll and AfterAll hooks are not shown anymore when passing? (a failing hook is a different story, the default mocha way of handling these could use some improvement too)

@BorisOsipov
Copy link
Contributor

BorisOsipov commented Aug 6, 2018

@MartijnThiele

create sample project on github to help me reproduce these issues

@MartijnThiele
Copy link
Author

MartijnThiele commented Aug 7, 2018

@BorisOsipov

created a sample project here:

https://github.com/MartijnThiele/wdioAllureSampleProjectIssue-128

Thanks for taking the time to look into this.

Please let me know if there are any questions

@BorisOsipov
Copy link
Contributor

@MartijnThiele thank you. I will have look into it

@BorisOsipov
Copy link
Contributor

yes, it is a bug.

@MartijnThiele
Copy link
Author

I suspected as much. Anything you can fix?

@BorisOsipov
Copy link
Contributor

BorisOsipov commented Aug 10, 2018

I think we can disable\enable reporting hooks at all with configuration option.

Anything you can fix?

I am not sure. I don't have plans to support this version much.
Recently I port this to v5 and will continue adding fixes\improvements only for v5

@MartijnThiele
Copy link
Author

Pity, can you point me towards this configuration option? I am not sure what you mean by this.

@BorisOsipov
Copy link
Contributor

I mean if you want to make PR to fix this bug, I suppose the best solution is to create a new option to disable reporting hooks at all.

@MartijnThiele
Copy link
Author

OK, thanks for the info. That would sound like a good solution. I'm afraid I am not experienced enough to solve something like this myself, but I will have a go and see what I can do.

@sanyco92
Copy link

Hello guys! Is this issue fixed? I'm experiencing the same issue. Hooks "before all" and other are marked as test cases and including to the total number of tests.

@BorisOsipov
Copy link
Contributor

@sanyco92

Is this issue fixed?

nope

@brownad
Copy link

brownad commented Aug 28, 2019

Can this be ported?
allure-framework/allure-js@cbbb449

@christian-bromann
Copy link
Contributor

Can this be ported?

Feel free to provide a PR

@BorisOsipov
Copy link
Contributor

It is fixed in v5

@brownad
Copy link

brownad commented Aug 28, 2019

unfortunately still stuck on v4 for a while longer thanks for the update @BorisOsipov

@christian-bromann
Copy link
Contributor

still stuck on v4 for a while longer

Why is that? It is really not much work to update.

@brownad
Copy link

brownad commented Aug 28, 2019

v4 is wrapped up in our own tooling suite in a way that requires more work than anticipated to move but, that was based on beta v5 last time we looked. Going to start the move / assessment again.
thanks @christian-bromann

@just-boris
Copy link
Collaborator

Can this be ported?
allure-framework/allure-js@cbbb449

@brownad the commit fixed the handling for beforeEach/afterEach hooks. That was a regression in 2.0.0 version comparing to 1.x. The before and after hooks are not addressed yet.

I created an issue to track this work: allure-framework/allure-js#48

P.S. Please note that 2.0 version is not yet stable and there may be breaking changes. I advice not to use the dependency in your projects until the stable release is shipped.

@qwez
Copy link

qwez commented Sep 13, 2019

It is fixed in v5

@BorisOsipov I use v5 and still have this issue

"devDependencies": {
    "@wdio/allure-reporter": "^5.12.1",
    "webdriverio": "^5.12.5"
  }

My report:
image

@BorisOsipov
Copy link
Contributor

fix @qwez relesed in v5.13.0

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

No branches or pull requests

7 participants