Pytest allure基礎用法
阿新 • • 發佈:2022-05-13
學習網站:
https://docs.qameta.io/allure/#_pytest
Feature & Story & step &Title的用法:
執行:
pytest test_demo.py --alluredir ./result
//py檔案為執行檔案 result為放報告的地址
allure serve ./result
//處理報告並在網站展示
@allure.feature("搜尋模組") class TestSearch(): @allure.story("搜尋成功") @allure.title("搜尋用例1") def test_case_1(self): with allure.step("開啟主介面"): print("step 1") with allure.step("開啟登入介面"): assert 1==2 print("step 2") with allure.step("輸入資訊"): print("step 3") with allure.step("點選登入"): print("step 4") @allure.story("搜尋成功") @allure.title("搜尋用例2") def test_case_2(self): print("搜尋用例2") @allure.story("搜尋失敗") @allure.title("搜尋用例3") def test_case_3(self): print("搜尋用例3") @allure.feature("登入模組") class TestLogin(): @allure.story("登入成功") @allure.title("登入用例1") def test_case_1(self): print("登入用例1") @allure.story("登入成功") @allure.title("登入用例2") def test_case_2(self): print("登入用例2") @allure.story("登入失敗") @allure.title("登入用例3") def test_case_3(self): print("登入用例3")