allure-java
allure-java copied to clipboard
Configuration to exclude SKIPPED tests in Allure Report
I'm submitting a ...
- [x] bug report
- [x] feature request
- [x] support request => Please do not submit support request here, see note at the top of this template.
What is the current behavior?
Current behavior is Allure Tests include skip tests as well
If the current behavior is a bug, please provide the steps to reproduce and if possible a
I have a total of 3 tests out of which 1 PASS, 1 FAIL & 1 SKIPPED When I generate allure report, it says - Total - 3 Pass - 1 Fail - 1 Skipped - 1
Pass percentage - 33.33%
What is the expected behavior?
There should be a way to ignore the Skipped test cases. It will be good to have a configurable parameter to calculate the percentage. In my case I would like the pass percentage to be 50% as the Skipped test did not execute
What is the motivation / use case for changing the behavior?
Please tell us about your environment:
| Allure version | 2.8.1 |
|---|---|
| Test framework | [email protected] |
| Allure integration | [email protected] |
| Generate report using | [email protected] |
Other information
Please let me know if there is already a way to configure this
@baev Hi Dmitry, I also need such functionality. It is possible to exclude skip tests from final pass rate?
A few months ago, I was looking for the same option, to remove skipped tests from the Allure statistics. Couldn't find it, so I ended writing my own statistics to display in the report email and slack channel, but the problem that if somebody clicks on the Allure report link it shows wrong numbers. So, yeah, it would be great to have it as part of the Allure report. Thanks.
I have similar issue, such configuration option would be a blast.
Also need this config, too.
yes please i need it too.
Тоже очень нужна данная функция. Думал, что @Muted должен это делать, но нет. Схожие запросы есть с 2017 года. Не хочется какие-то свои велосипеды горадить.
Is there any workaround to solve this for the time being?
@shridharkalagi, yes, instead of using @Disabled/@Ignore annotations (or any other annotation you might use in your framework to skip tests) I add tag "ignored" to the tests I want to ignore/skip. Like this @Tag("ignored").
Now, when you run your tests just don't run tests with that tag "ignored". For me, because I use mvn to run, it's: mvn clean test -Dgroups="{any tags you want to run, or just keep it empty}" -DexcludedGroups="ignored"
This way no ignored tests will be shown in Allure reports, but they are also won't be part of your total tests that you run. If it’s fine for you, it can be a workaround to keep Allure statistics cleaner.
I also need this functionality
any news here?
Yeah, we need the same functionality. On our project, we need to skip tests on condition and would be nice for them not to appear in the report as the statistic of run shows wrong numbers
same here. please add this functionality or some workaround (in Java)
Is there any workaround to solve this for the time being?
you can use hook in conftest.py, following is the code sample:
def pytest_collection_modifyitems(items, config): deselect_tcs = [] selected_tcs = [] for tc_item in items: res = check_and_disable_test(tc_item) if res is not None: deselect_tcs.append(tc_item) else: selected_tcs.append(tc_item)
config.hook.pytest_deselected(items=deselect_tcs)
items[:] = selected_tcs
Is there any workaround to solve this for the time being?
you can use hook in conftest.py, following is the code sample:
def pytest_collection_modifyitems(items, config): deselect_tcs = [] selected_tcs = [] for tc_item in items: res = check_and_disable_test(tc_item) if res is not None: deselect_tcs.append(tc_item) else: selected_tcs.append(tc_item)
config.hook.pytest_deselected(items=deselect_tcs) items[:] = selected_tcs
Thanks but I mean in Java
@tag("ignored")
I have similar issue, such configuration option would be a blast.
what is the configuration!
Good to have this configuration option in allure
After spending more than two weeks and a long shell script that worked on my local runs, but failed on jenkins... this is what finally worked for me. Just two lines of code:
cd $PWD/target grep -l status.*skipped allure-results/*result.json grep -l status.*skipped allure-results/*result.json | xargs rm
Note: You need https://plugins.jenkins.io/postbuildscript/ jenkins post build and it needs to go right before Allure Report post build. Also, this is only removing the allure json result file that has the skipped status. You can still view the skipped results in the testng or junit reports.
We also need such a configuration.
Just use bash to remove skipped tests from the test results before report generation step:
grep -rl '"status": "skipped"' allure-results | xargs rm -rf
Ok, so i encountered a similar problem recently - ui tests that should be ignored with a specific configuration (e.g. specific browsers)through annotations are marked as Skipped, are displayed in TestOps report and included in the run statistics.
Using Ignore or tags was not an option because as mentioned before, one test is executed in different configs.
I tried to use allure result modification via grep in cmd but we use withAllureUpload function in Jenkins dsl pipeline that wraps the testrun and sends results on the go, so post modification didn't work
After a bit of debugging i found a solution that suites our case - cancel the default behaviour of createFakeResult(final ITestContext context, final ITestNGMethod method) from AllureTestNg listener by overriding it with an empty method
@Override
protected void createFakeResult(ITestContext context, ITestNGMethod method) {
}
This will affect those cases when skipping tests is allowed in your test run and expected in stats.
I need this functionality too
Need this config badly!
Also need this config.
BTW, there is an option for TestNG integration to hide disabled tests from the report. See https://allurereport.org/docs/testng-configuration/#alluretestnghidedisabledtests
From what I see, there are multiple different requests from the community:
- To exclude skipped tests in statistics. This is a language-agnostic report feature.
- Hide disabled tests from TestNG — there is a configuration option; see the link above.
- Some other "hide skipped" requests from other languages — please create a separate issue/discussion for that
I suggest only discussing the number one within the scope of the issue.
After internal discussion, we decided to change the behaviour unconditionally and exclude unknown and skipped statuses from the passed rate calculation. I'll try to include this change in the next release of the Allure Report (aiming to make it this year).
In case of positive feedback from the community, we'll propagate the change to Allure TestOps as well.
The RR https://github.com/allure-framework/allure2/pull/2219
After internal discussion, we decided to change the behaviour unconditionally and exclude
unknownandskippedstatuses from the passed rate calculation. I'll try to include this change in the next release of the Allure Report (aiming to make it this year).
released as 2.25.0
@baev I've downloaded the released version from https://github.com/allure-framework/allure2/releases/download/2.25.0/allure-2.25.0.zip and generated a report on a local machine but I still have the same results as before
I have also updated it to 2.25.0 and skipped tests are still being included in the summary.
Since this is a front-end-only change, please, try to clear the browser cache and check again.
For me it working just fine: