Hi,

We want to update the test result automatically from pytest to a web 
application, we run pytest from Jenkins currently , and our plan is to run a 
script as post step to make this happen.

We have thousands of test cases in an excel file, and now they were all 
imported to the web tool(the tool generated a unique id for each test), the 
problem is, the test name in web tool and from pytest are not exactly the same, 
and so far we don't have plan as well as hands to make them the same....

Our thoughts is to pass the test id to each pytest test case, so that from 
output result, the id becomes part of test name, then we have the map from 
pytest test cases to the web tool.

We are looking for a feature from pytest, which can help achieve following 
requirements:

1.       Can easily inject an external id to each test case, both 
non-parameterized and parameterized test.

2.       The injected id will be part of test name in output

3.       Without impacting existing parameterized mechanism (or need minor 
modification is fine)

For parameterized test, I tried to use 
@pytest.mark.parametrize(('name'),create_data,ids=['DEMO-1','DEMO-2']), of 
them, "DEMO-1" and "DEMO-2" are ids from the test cases in web tool, I got this 
as output:


platform linux2 -- Python 2.7.3 -- pytest-2.3.4



collected 2 items



<Module 'test_demo.py'>



  <Class 'TestDemo'>



    <Instance '()'>



      <Function 'test_generatekeypair[DEMO-1]'>



      <Function 'test_generatekeypair[DEMO-2]'>



However, for non-parameterized test, seems this solution is less decent, 
although we can pass the parameter without using it, still seems ugly...



Is there a better way we can do this?


The information contained in this electronic mail transmission 
may be privileged and confidential, and therefore, protected 
from disclosure. If you have received this communication in 
error, please notify us immediately by replying to this 
message and deleting it from your computer without copying 
or disclosing it.


_______________________________________________
Pytest-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to