Example tags with:
Implementation of test cases: pytest test suite name -m label name
Import pytest '' ' Use Case Tags: @ pytest.mark tag name. test is performed: pytest test suite name -m name tag so the implementation of a warning, suggesting that the label is not registered registration tags: one way: to create a profile pytest.ini [pytest ] markers = tag1: # label describes the description tag, you can not write tag2: Second way: create conftest.py documents, stored in the current directory command line DEF pytest_configure (config): config.addinivalue_line ( 'markers', 'regression testing') config.addinivalue_line ( 'markers',' name tag ') ' '' @ pytest.mark.smoketest DEF test_01 (): Print ( ' begin test 1 ' ) @ pytest.mark.Smoke deftest_02 (): Print ( ' begin to execute test cases 2 ' ) @ pytest.mark regression testing. DEF test_03 (): Print ( ' started test case 3 ' )
Label registration documents:
pytest.ini
[pytest] markers = Tag1: Tag Description # label described, can not write Tag2: Tag2 SmokeTest: smoke:
configtest.py
DEF pytest_configure (config): config.addinivalue_line ( ' markers ' , ' regression testing ' ) config.addinivalue_line ( ' markers ' , ' label name ' )