【发布时间】:2025-12-17 20:20:04
【问题描述】:
我编写功能测试,我需要做一些测试,这些测试取决于之前测试的通过情况。假设我有一个按钮,可以打开一个窗口,其中有一个函数。也就是说,为了检查这个功能,我需要首先检查按钮的正确操作(即打开窗口或没有功能)。因此,我需要这样做,如果单击按钮时测试失败,则测试未运行以检查功能窗口。单独编写测试 - 对我来说不是一种选择。我想看到这样的东西:
describe "some tests" do
open_result = nil
it "should check work button" do
click_to_button()
open_result = window_opened?
open_result.should == true
end
if open_result
describe "Check some functional" do
it "should check first functional"
it "should check second functional"
end
end
end
我知道这种方法不适用于 rspec。这只是对我想看到的内容的简单描述。使用rspec可以实现吗?如果没有,有没有其他方法(宝石等)
【问题讨论】:
-
我认为这可能是题外话,因为有 sqa.stackexchange.com
标签: ruby testing rspec automated-tests