![](https://cdn.wetest.qq.com/wetest-web-qq/img/030b28eb.png)
![](https://cdn.wetest.qq.com/wetest-web-qq/img/030b28eb.png)
执行遵循pytest的用例编写规则即可:
例如:
#content of test_main.py
def test_1(setup_function):
print('pytest Test_1 called.')
pytest允许使用标准的python assert断言用于判断是否执行失败。例如:
def f():
return 3
def test_function():
assert f() == 4 #用例失败
在您的用例集脚本中的根目录打包runTest.sh即可:
平台会自动识别您的用例,并通过环境变量下发给runTest.sh文件,runTest.sh内容:
#!/bin/bash
echo $CASE_NAME
python3 -m pytest --capture=no $CASE_FUNC
如果是python2脚本,则改成
echo $CASE_NAME
python2 -m pytest --capture=no $CASE_FUNC