如何使用 RSpec 忽略或跳过测试方法? [英] How to ignore or skip a test method using RSpec?

查看:22
本文介绍了如何使用 RSpec 忽略或跳过测试方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请指导如何使用 RSpec 禁用以下测试方法之一.我正在使用 Selenuim WebDriver + RSpec 组合来运行测试.

please guide how to disable one of the below test methods using RSpec. I am using Selenuim WebDriver + RSpec combinations to run tests.

require 'rspec'
require 'selenium-webdriver'

describe 'Automation System' do

  before(:each) do    
    ###
  end

  after(:each) do
    @driver.quit
  end

  it 'Test01' do
      #positive test case
  end

  it 'Test02' do
      #negative test case
  end    
end

推荐答案

您可以使用 pending() 或将 it 更改为 xit 或将 assert 包装在挂起块中以进行等待实现:

You can use pending() or change it to xit or wrap assert in pending block for wait implementation:

describe 'Automation System' do

  # some code here

  it 'Test01' do
     pending("is implemented but waiting")
  end

  it 'Test02' do
     # or without message
     pending
  end

  pending do
    "string".reverse.should == "gnirts"
  end

  xit 'Test03' do
     true.should be(true)
  end    
end

这篇关于如何使用 RSpec 忽略或跳过测试方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆