百度網盤鏈接:https://pan.baidu.com/s/1SvNRazeqHSy7sFHRtJz18w?pwd=0709
提取碼:0709

插件:
@pytest.mark.skip(reason='跳過Test類,會跳過類中所有方法')
@pytest.mark.parametrize('val', [5,4,3,2,1]) #一條用例傳多個引數
def test_collision_detect_001(self, val):
duco_cobot.collision_detect(val)
logger.info("設定碰撞檢測等級: {}".format(val))
@pytest.mark.parametrize('val', [i for i in range(1,9)]) 傳兩個引數@pytest.mark.parametrize('引數名1,引數名2',[(引數1_data[0], 引數2_data[0]),(引數1_data[1], 引數2_data[1])]) 進行引數化
@pytest.mark.repeat(N)重復
test_case
1 import pytest 2 import allure 3 4 @allure.title("IO功能輸出下電、上電未使能") 5 class Test_Linux2671(): 6 7 @allure.description(""" 8 IO功能輸出6配置下電信號; 9 IO功能輸出7配置未使能信號; 10 IO功能輸出8配置空閑狀態; 11 IO功能輸出對應硬體分別配置狀態燈 12 """) 13 def setup_class(self): 14 duco_recv.open() 15 16 def setup(self): 17 self.log_start = duco_recv.get_last_error() 18 19 @allure.step("機器人重啟") 20 def test_linux2671_001(self): 21 modbus_read(func_io_out_poweroff[1], 1, "功能輸出6-下電") 22 modbus_read(func_io_out_disable[1], 0, "功能輸出7-未使能") 23 modbus_read(func_io_out_idle[1], 0, "功能輸出8-空閑狀態") 24 25 def teardown_class(self): 26 duco_recv.close() 27 28 if __name__ == '__main__': 29 pytest.main(["-vs"])
pytest.ini
1 [pytest] 2 addopts = --alluredir ./tmp --clean-alluredir 3 testpaths=testcases/ 4 python_files=test_*.py 5 python_classes=Test* 6 python_functions=test_* 7 timeout=300
run_all.py
1 if __name__ == '__main__': 2 pytest.main(["testcases"]) 3 os.system("allure generate ./tmp -o ./reports --clean")
report

人類的生命,并不能以時間長短來衡量,心中充滿愛時,剎那即永恒,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/501246.html
標籤:其他
