Reputation: 183
I ask you to consult on the following question about allure: I use jenkins + pytest to run the tests. The same tests run on several virtual machines, these machines differ in operating systems (different linux distributions) and test environment. After running the tests, I want to combine the results from all the machines into one report. - here the question arises - if I put all the reports in one directory and generate a report, then the results from different machines will be considered as rerun of the same test and combined into one. How can I get around this? so as not to be combined and so that it was possible to somehow sort out which result from which machine. Thanks.
Upvotes: 1
Views: 2078
Reputation: 1
I use pytest_addoption
to define additional parameters for capturing device names, and add pytest_collection_modifyitems
in conftest.py
to modify the names of tests/suites.
def pytest_addoption(parser):
parser.addoption("--udid", action="store", help="UDID of the device")
def pytest_collection_modifyitems(config, items):
for item in items:
udid = config.getoption("--udid")
item.name = udid
item._nodeid = udid
Upvotes: 0
Reputation: 3
I ran into a similar issue with behave where Allure was treating each parallel build as a retry of the first build. I realize this isn't the same as pytest, but perhaps it'll help.
I was inspired by the previous answer and started experimenting. By changing the scenario name(s) within the feature, I was able to make Allure recognize each parallel build as separate tests. I accomplished this by adding a before_feature
method to my environment.py file that simply added the hostname to each scenario name within that feature:
def before_feature(context, feature):
for scenario in feature.scenarios:
scenario.name = f'[{socket.gethostname()}] {scenario.name}'
Originally, I tried to directly change scenario.name
in before_scenario
but that seemed to have no effect in Allure.
Upvotes: 0
Reputation: 2814
i have solve this by override the names of tests/suites. Meaning you have to make some code implementation, work with the before listeners, there you can get the current test name and override it. Set the test name by OS + Browser or something unique.
When you combine reports, they will be unique and properly displayed.
Upvotes: 1