Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9302351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T23:14:08+00:00 2026-06-18T23:14:08+00:00

I am getting very random behaviour after running cucumber steps..I need to add a

  • 0

I am getting very random behaviour after running cucumber steps..I need to add a condition such that i will move to next step of cucumber only if previous steps was a success..Moreover can i set a tolerance level in my env.rb so that Out of 50 files,even if 10 files fails,still its a success…
for now im using

After('@javascript, @selenium') do
  page.has_content? ''
end

…to verify between Every scenario…NOT every step.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T23:14:10+00:00Added an answer on June 18, 2026 at 11:14 pm

    The best way to make sure the step has passed is to use rspec matches to either pass or fail your test. If you wanted the feature to fail if the content “foo bar” was not on the page you would do it like this:

    Then /^I should see "([^\"]*)"$/ do |text|
      page.should have_content(text), "Expected to see #{text} on the page"
    end
    

    If you’re setting a tolerance level you can use variables to keep track of the number of successes or failures. Lets say your running a feature that checks for “foo” and you’re checking 50 times. In one of your steps create the variable to track the number of successes and you can use capybara to tell you if the page has what you’re looking for without failing the feature if the page is missing the content:

    Given /^Some step$/ do
      @a = 0
      if page.has_content?("foo") == true
         a += 1
      end
    end
    

    Then in your last scenario, check to see if a is greater than the minimum threshold

    Then /^Last step$/ do
      @a.should be > 40, "Expected at least 40 success but saw #{a} successes instead"
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After doing a project with WPF and getting very much attached to it's excellent
I notice that I am getting very poor performance for either or both inserts
I'm getting some very strange behaviour using the following switch statement: string recognise_mti(int mti_code)
I'm trying to make a struct that generates a random matrix and am getting
I have a CADisplayLink running in line with Chipmunk Physics, and I'm getting very
I haven't been able to find a very good way of getting 10 random
This question comes from the knowledge that when new Random() is called very quickly
I'm getting a very weird exception when trying to deploy my app on JBOSS
I'm getting a very peculiar problem with my asp.net application, it took me an
I am getting a very strange error in my code. This assignment is for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.