0
我正在使用pytest来运行python-appium的appium测试。根据命令行参数修改测试名称
我在不同的设备上运行测试,并使用命令行参数通过pytest_addoption
选择设备。
我通过--junitxml
输出测试结果。之后我收集jenkins的测试结果。
如果测试名称的前缀是平台名称,那将非常有用。
这怎么能在py.test中完成?
我正在使用pytest来运行python-appium的appium测试。根据命令行参数修改测试名称
我在不同的设备上运行测试,并使用命令行参数通过pytest_addoption
选择设备。
我通过--junitxml
输出测试结果。之后我收集jenkins的测试结果。
如果测试名称的前缀是平台名称,那将非常有用。
这怎么能在py.test中完成?
修改测试名称的简单方法是向灯具添加参数。
所以,现在我做:
@pytest.fixture(scope="session", params= pytest.devices)
def env():
...
,并在我的conftest.py:
def pytest_addoption(parser):
parser.addoption("--device", action="store",
help="the device to use")
def pytest_configure(config):
pytest.devices = [config.getoption('--device')]