问题陈述:我想将一个函数返回的值从测试文件传递给另一个函数
测试abc.py
@pytest.fixture(scope='function')
def hold_value():
def _value(resp):
return resp
return _value
@when(parsers.cfparse('user did something with value "{a}" and "{b}" and “{c}"'))
def func1(hold_value, a, b, c):
response = do_something(a,b,c)
hold_value(response)
@then('user validate if above step is correct')
def func2(hold_value):
call_another_func_and_pass_above_response(hold_value)=> what can I do here to get value from fixture
这是一个测试文件,我尝试在其中创建fixture来保存一个函数返回的值,然后在其他函数中使用它
我不确定,如果这样做是正确的,我希望将值从一个测试步骤传递到另一个测试步骤
谁能指导我达到预期的结果
我能够通过使用上下文作为固定条件来实现解决方案
相关问题 更多 >
编程相关推荐