我pytest-dependency
用来创建对测试的依赖。我希望从属测试从另一个测试中获取返回值。
例子:
@pytest.mark.dependency()
def test_owner_create_book(app):
response = app.post(...)
return response["data"]["id"]
@pytest.mark.dependency(depends=["test_owner_create_book"])
def test_owner_read_book(app):
# I want to get the id from previous response here
如何从依赖项中获得响应?
正在使用的包:
pytest = "^6.1.1"
pytest-dependency = "^0.5.1"