-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wdio-allure-reporter: capture before each and all hooks #3536
wdio-allure-reporter: capture before each and all hooks #3536
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3536 +/- ##
==========================================
+ Coverage 97.7% 97.75% +0.04%
==========================================
Files 133 133
Lines 2969 2978 +9
Branches 651 655 +4
==========================================
+ Hits 2901 2911 +10
+ Misses 64 63 -1
Partials 4 4
Continue to review full report at Codecov.
|
@mgrybyk what about jasmine adapter? Did you check that reporter works as well with wdio-jasmine? |
@BorisOsipov no, Jasmine logic should not be affected at all. Previous logic was only ignoring mocha all and each hooks.
I changed logic to capture only that mocha hooks and only for allure reporter. If we need to change something in other adapters/reporters fee free to submit issue and assign to me. |
If there are no comments let's merge! :) |
return false | ||
} | ||
|
||
this.allure.startCase(hook.title) | ||
// todo: describe what are we doing here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose, it was backported from v4, as you I am no sure it is required or can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure as well. I'd better keep existing logic as is for now.
We can improve it in different PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BorisOsipov removed // todo: describe what are we doing here
and refactored that code.
There is one issue why hooks are ignored. If you report hooks as test - it will significantly increase end user tests count - and it is bad because hooks aren't tests |
@BorisOsipov why significantly? At least before hook in testing is called precondition which is a part of test case. We should always show before hooks, but I can't say the same for after hooks. We can print after hooks only if there is some error which will be useful to understand why tests have failed. On the other hand showing before and after hooks will provide better explanation in terms of timing. |
Let me hide passed after hooks. P.s. |
In any project I worked we had before\all hooks. So if we have N tests, if we enable reporting than we will have + N tests in report - It isn't good. Also we will have misleading with e.g. spec reporter, who doens't count hooks as tests.
Yes, I totally agree with you, but it hard to implement, because AFAIK
yes it will be good. I suppose it already implemented? isn't it? |
Actually nope, only if there are suite level before/after hooks. beforeEach and afterEach are not added as tests so they won't bother user.
Not really, have to adjust implementation so that failed after hook will be shown only in case of error. |
With current implementation of this PR we have in report something like that. (As you might see each hooks are not spamming report.)
I want to change it to
|
Is this fine? @BorisOsipov |
No, sorry. We must not report hooks as tests. It will cause misleading and question about test counts in different reporters. But I think reporting failed hooks is really important to do. So can we make in that way?
what do you think? cc @christian-bromann, maybe you have some ideas |
I think that part of the test should be reported explicitly. However I agree that there will be questions to test count, so I should not show hooks as tests. As a conclusion: if I won't be able to add before as test step properly I'll only shown that hooks in case of failures as you've suggested. |
@mgrybyk 👍 |
@BorisOsipov behavior is now simplified: beforeEach/afterEach hooks are added to test as steps all the other hooks (mocha before/after or whatever) are added as tests only in case of failure or if hook has steps (added with allure.addStep(...)). Steps are controlled by user, in order to have passed hook in report user has to trigger allure.addStep(...) in before/after or any other hook (except of mocha beforeEach or afterEach of course). |
@BorisOsipov so you have some more comments? |
I will review at the weekends, I bit busy now
…On Thu, Feb 14, 2019 at 1:47 PM Mykola Grybyk ***@***.***> wrote:
@@BorisOsipov <https://github.com/BorisOsipov> so you have some more
comments?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3536 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AGNmZFvOmXYlrkKMN2fuBc673-28bUxgks5vNT7PgaJpZM4ay2Td>
.
--
--
Best regards,
Boris Osipov
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome 👍
Proposed changes
Capture before all and after all hooks in Allure report as tests in case:
Capture beforeEach and afterEach hooks in Allure report as test steps.
No global hooks will not appear in report.
fix for #3517
Types of changes
Checklist
Further comments
Allure report example with mentioned changes
example with beforeEach failure and afterEach pass as test steps
example with failure in the very first before
more examples here #3536 (comment)
Reviewers: @webdriverio/technical-committee