Closed alvassin closed 9 years ago
it is not recommended to rename testcases directly in pytest, cause it may lead to unknown consequences. but you could rename testcases in allure report. smh like this:
@pytest.fixture(autouse=True, scope="module")
def renamer(request):
config = request.config
my_super_suffix = 'ololo'
if hasattr(config, '_allurelistener'):
config._allurelistener.impl.testsuite.name += '[%s]' % my_super_suffix
@mavlyutov why you can't just change title?
@baev just imagine a situation, when you have one test and you want to run it on different platforms. x86 and x64 for example
what's the problem with different platforms?
you'll have report with main page containing these testsuites: my_super_test my_super_test
in my case, you could achieve that one: my_super_test[x32] my_super_test[x64]
ok, I got it. This other situation. But I still don't understand why you can't change title. An example, in JUnit we can use @Title
annotation:
@Title("Hi, I'm custom test name")
@Test
public void myTestWithCustimTitle() {
//some staff
}
and in report you got Hi, I'm custom test name
.
We have parameters logic - https://github.com/allure-framework/allure-core/wiki/Parameters. U can use it to mark test with some data, such as platform etc
Btw, maybe we remove titles from model, https://github.com/allure-framework/allure-core/issues/408.
hmm, I'm going to look at it, thank you!
@mavlyutov Thank you very much! Very useful!
@baev how do we specify those parameters via XML?
Btw... finally i got another result:
ololo[data0]
ololo[data1]
@mavlyutov is it possible to change parameter string in the allure report? data0 or data1 to my custom?
hmm.. looks like you want to discover parameter ids. see http://pytest.org/latest/parametrize.html#_pytest.python.Metafunc.parametrize ids – list of string ids each corresponding to the argvalues so that they are part of the test id. If no ids are provided they will be generated automatically from the argvalues.
I set item name in conftest.py:
but in xml it stays with old names:
Can i somehow rename testcase name?