鉴于我找到的信息here,我尝试了以下操作:
@pytest.mark.usefixtures("driver")
class TestSuite(object):
def test1(self):
driver.log("Start the test")
但我有个错误
^{pr2}$所以信息是不正确的,还是我误解了?在
如何在TestSuite
类内的每个测试方法(或任何其他方法)中自动使用fixture?在
更多信息:
通常一个测试需要5个固定装置。但由于我每次考试都会用到一些方法,所以我需要像这样把它们全部通过
def do_something(self, fixture1, fixture2, fixture3, fixture4, fixture5):
...
def test1(self, fixture1, fixture2, fixture3, fixture4, fixture5):
do_something(fixture1, fixture2, fixture3, fixture4, fixture5)
也许不会太糟,但如果我能在每次测试中自动使用夹具,那将有助于。。。
{这意味着你的代码中不会自动调用它们。在
我怀疑有没有一种方法可以在没有明确命名的情况下使用fixture。在
是唯一的办法。在
相关问题 更多 >
编程相关推荐