Smoke Tests - convio/watirmark GitHub Wiki
Setting up a project for smoke tests
Watirmark has a built-in way to handle running tests against a given tag in RSpec or Cucumber. In order to use this you need to include some code in your rakefile to define what a smoke test is and then instrument your tests accordingly.
Defining a rakefile task for smoke tests takes in three parameters. A tag name, a file pattern and a tag name to search for in the test scripts (which defaults to :smoke). These are passed into SmokeTest::cucumber_task or SmokeTest::rspec_task as follows:
Smoke Tests in Cucumber
require 'watirmark/rake/smoketest'
SmokeTest::cucumber_task(:smoke, "features/**/*.feature")
'rake smoke' would then run any Cucumber tests tagged with @smoke.
Feature: Some Feature
@smoke
Scenario: Some Scenario
Given Some condition
When I do something
Then I expect a result
Smoke Tests in RSpec
require 'watirmark/rake/smoketest'
SmokeTest::rspec_task(:smoke, "spec/**/*_spec.rb")
'rake smoke' would then run any RSpec tests tagged with :smoke=>true.
describe "Some Test Scenario" do
specify "Some Test Case", :smoke=>true do
# assert something
end
end
Rakefile
The SmokeTest::cucumber_task and SmokeTest::rspec_task methods accept up to three arguments.
SmokeTest::cucumber_task(task_name, file_pattern, test_case_target=:smoke)
task_name
This defines the task called from rake. You can also create dependent tasks passing it in as a hash, eg: ''' {:smoke=>:setup} '''
file_pattern
This is a glob so it can be a single file or a file pattern (see http://www.ruby-doc.org/core-1.9.3/Dir.html#method-c-glob)
test_case_target
This is the name of the target to look for and run in your test cases