Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
为什么会通过以下步骤:
page.has_css?("doesnt exist")
当这正确失败时:
page.should have_css("doesnt exist")
如果我运行:
puts page.has_css?("doesnt exist")
它打印“假”,但该步骤仍然通过。
知道为什么吗?
你可能应该有:
assert page.has_css?("doesnt exist")
如果您在测试中写“2 == 3”,它将评估为假,但测试方法不一定会失败。你需要一个断言。我认为“应该”风格的语法也在幕后做某种断言。