以下功能:
def test_1():
assert str(squishtest.object.properties(squishtest.waitForObject(":my_button"))["text"]) == "Another button"
给出:
AssertionError:
>> assert str(<module 'squish' from '.../squishtest.so'>.object.properties(<module 'squish' from '.../squishtest.so'>.waitForObject(":my_button"))["text"]) == "Another button"
这没有给我关于按钮实际包含什么文本的信息。
但是,这效果更好:
def test_2():
s = str(squishtest.object.properties(squishtest.waitForObject(":my_button"))["text"])
assert s == "Another button"
因为它给出了:
AssertionError:
'My button' = str(<module 'squish' from '.../squishtest.so'>.object.properties(<module 'squish' from '.../squishtest.so'>.waitForObject(":startVentButton_Button"))["text"])
>> assert 'My button' == "Another button"
这里有什么问题?有没有比我在第二个例子中选择的更好的解决方案?
我正在运行带有 -d 标志的鼻子测试。