How do you mark a Cucumber Scenario as Pending
Okay figured this one out.
The Scenarios steps are marked as pending if it's not found in any of the steps files.
Scenario: New product form should have some special field
Given joe is logged in as an user
When on the new exercise page
Then the select field should have some special field
It's even nice enough to stub out the pending step.
When /^on the new exercise page$/ do
pending # express the regexp above with the code you wish you had
end
How can I mark a test story as PENDING in JAVA
You can throw the cucumber.api.PendingException
from the matching stepdefinition method. This will show up the scenario as pending. For getting these pending stepdefinition easily use dryRun=true
in the cucumberoptions of the runner.
For the below feature file.
Scenario: Run Pending scenario
Given step one
When step two
Then step three
Scenario: Run Defined scenario
Given step one defined
When step two defined
Then step three defined
Sample stepdefinition
@Given("^step one$")
public void stepOne() {
// Write code here that turns the phrase above into concrete actions
throw new PendingException();
}
The result will show up as below. The 'steps' section will show only the first step as pending and the remaining as skipped. Though the 'scenario' section gives the pending scenario status as a whole.
2 Scenarios (1 pending, 1 passed)
6 Steps (2 skipped, 1 pending, 3 passed)
What does 'ignore reason: pending' in cucumber tests means?
I believe scenarios are marked as pending when Cucumber cannot find the underlying definition for one or more steps. In this case, it probably cannot find the step definition for "Then field with default name is visible" so check if you have implemented this definition.
Determine if a cucumber scenario has pending steps
You can use status method. The default value of status is :skipped
, the failed one is :failed
and the passed step is :passed
. So you can write something like this:
do sth if step.status != :passed
Also, if you use !step.passed?
it does the same thing because it only checks for the :passed
status.
- http://cukes.info/api/cucumber/ruby/yardoc/Cucumber/Ast/Scenario.html#failed%3F-instance_method
On that subject, you can also take a look at this post about demoing your feature specs to your customers: http://multifaceted.io/2013/demo-feature-tests/
Cucumber - How to mark expected fails as known issues?
I would consider throwing a pending exception in the step that causes the known failure. This would allow the step to be executed and not be forgotten.
I would also consider rewriting the failing steps in such a way that when the failure occurs, it is caught and a pending exception is thrown instead of the actual failure. This would mean that when the issue is fixed and the reason for throwing the pending exception is gone, you have a passing suite.
Another thing I would work hard for is not to allow a problem to be old. Problems are like kids, when they grow up the they get harder and harder to fix. Fixing a problem while it is young, perhaps a few minutes, is usually easy. Fixing problems that are months old are harder.
Related Topics
Scaffolding Activerecord: Two Columns of the Same Data Type
Ruby on Rails Multiple Http Request at the Same Time
Does Ruby Have Any Number Formatting Classes
/Config/Initializers/Secret_Token.Rb Not Being Generated. Why Not
How to Upload a Text File and Parse Contents into Database in Ror
What Does the Term "Vendoring" or "To Vendor" Mean for Ruby on Rails
Sharing an Enumerator Across Threads
How to Ensure Ruby Gems Are Installed in Right Place to Be Executed by Bundler
Issue with a Look-Behind Regular Expression (Ruby)
Differencebetween Ruby's 'Open-Uri' and 'Net:Http' Gems
Testing Routes with Subdomain Constraints Using Rspec
Is It Ever Necessary to Use 'Chomp' Before Using 'To_I' or 'To_F'
Ruby on Rails - Doesn't Create Script/Server
How to Create a Rails 4 Concern That Takes an Argument
Determining Which Rubygem You'Re Using
Your Ruby Version Is 2.1.0, But Your Gemfile Specified 2.0.0