我想编写一个类似gherkin的测试,使用pytest-bdd为某些特性创建一组通用的测试数据。我不能使用给定的添加多个行,因为“已经使用了给定的步骤”。怎么做才是对的?
我试过这个:
Background:
Given a user with Clerk privileges
And a household entry for "Alice" with SubmissionDate "Nov 26, 2019 3:59:50 pm"
And a household entry for "Bill" with SubmissionDate "Nov 27, 2019 3:59:50 pm"这在消息中失败:
E pytest_bdd.exceptions.GivenAlreadyUsed:
Fixture "add_household" that implements this
"a household entry for "Bill" with SubmissionDate "Nov 27, 2019 3:59:50 pm""
given step has been already used.发布于 2020-06-17 11:26:38
嗨,您在conftest.py文件中的步骤定义是什么?
Background:Title
Given something
And something else
And something more在conftest.py中,应该是
@given("something")
def something():
# your code for something
pass
@given("something else")
def something():
# your code for something
pass
@given("something more")
def something():
# your code for something
passhttps://stackoverflow.com/questions/59078497
复制相似问题