我需要编写一个带有多个过程的测试来检查多个用例(步骤)。 每一步都可能是一个子步骤。 每个步骤/子步骤都在检查其他内容,例如:
Procedure 1 :
Step 1 : Verify something
Step 2 : Compare ....
Sub-step 2.1 : Compare ...
Sub-step 2.2 : Compare ...
Step 3 : Configure ....
每个步骤或子步骤都可能失败/通过,测试将正常继续。你知道吗
Step 1 : Verify something - PASS
Step 2 : Compare .... - FAIL
Sub-step 2.1 : Compare ... - PASS
Sub-step 2.2 : Compare ... - FAIL
Step 3 : Configure .... - PASS
我还需要在交互式HTML结果文件的结果(我用诱惑) 一步一步地给出每一步的结果和信息。你知道吗
我尝试使用Pytest和Allure(对于交互式HTML结果报告文件),但是为了表示失败,我需要使用Assert,Assert exception会立即导致测试失败。你知道吗
除了Allure之外,还有没有其他框架可以帮助我在更高的层次上创建HTML报告文件,并用Assert以外的其他方式表示失败? 有没有什么办法不使用Assert就用Allure来表示失败?你知道吗
def test_procedure_1(self):
with allure.step("1. Configure "):
Assert 0
with allure.step("2. prints"):
Assert 1
with allure.step("3. attached"):
Assert 0
with allure.step("4. compare"):
Assert 1
其他示例:
def test_procedure_2(self):
with self.subTest("step 1:"):
Assert 0
with self.subTest("step 1.1:"):
Assert 1
with self.subTest("step 1.1.1:"):
Assert 1
with self.subTest("step 1.1.1.1:"):
Assert 0
with self.subTest("step 2:"):
Assert 1
目前没有回答
相关问题 更多 >
编程相关推荐