Are you a candidate looking to sharpen your skills? Try our practice tests or view sample interview questions & Get hired by the best. Click Here×

Cucumber Testing Online Test

Topics Covered

  • Cucumber - Development
  • Cucumber - Reports
  • Cucumber - Running tests
  • Cucumber - Debugging
  • Cucumber - Command line
  • Advance features of Cucumber

Useful for hiring

  • Test Automation Engineer - Cucumber
  • Software Engineer - Cucumber

Start hiring job-fit candidates using this assessment

GET A DEMO

"We are impressed by the caliber, depth, and breadth of the assessments provided by Interview Mocha. With Interview Mocha's online proctoring & powerful reports, we are able to hire quality candidates overcoming geographical barriers."

Megan Akhras, J'Excelle,Canada,
Co-founder & director
Question

Which of the following code snippet can be used to parse a cucumber file and count the total number of lines contained in a particular scenario?

Answer
    • File.open('your scenario') do |f|
        f.slice_before(/^\s*Scenario:/) do |scenario|
          title = scenario.shift.chomp
          ct = scenario.map(&:strip).reject(&:empty?).count
          puts "#{title} --> has #{ct} lines"
        end
      end

    • File.open('your scenario') do |f|
        f.slice_before(/^\s*Scenario:/) do |scenario|
          title = scenario.shift.chomp
          ct = scenario.map(&:strip).reject(&:empty?).size
          puts "#{title} --> has #{ct} lines"
        end
      end

    • File.open('your scenario') do |f|
        f.slice_before(/^\s*Scenario:/) do |scenario|
          title = scenario.shift.chomp
          ct = scenario.tomap(&:strip).reject(&:empty?).size
          gets "#{title} --> has #{ct} lines"
        end
      end

    • None of the mentioned

Question

Which of the following is the correct ruby regular expression for matching the string of type:
rpm = "abc-def-ghi-1.1.0-10.el6.x86_64"

Answer
    • rpm.match(/^#{rpmname_to_match}-([0-9]+(?:(?:\.|-)(?:[0-9]+))*)(.*).nil?

    • rpm.match(/^#{rpmname_to_match}-([0-9]+(?:(?:\.|-)(?:[a-z]+))*)(.*)\.x86_64$/).nil?

    • rpm.match(/^#{rpmname_to_match}-([a-z]+(?:(?:\.|-)(?:[0-9]+))*)(.*)\.x86_64$/).nil?

    • rpm.match(/^#{rpmname_to_match}-([0-9]+(?:(?:\.|-)(?:[0-9]+))*)(.*)\.x86_64$/).nil?

Question

You are using cucumber+webrat+selenium to verify your application. It contains a javascript alert, and you wish to test whether the alert has particular string or not. Which of the following is the correct way to do this?

Answer
    • webrat.is_alert_present.should be_true
      webrat.get_alert.should eql("File Deleted")

    • cucumber.is_alert_present.should be_true
      cucumber.get_alert.should eql("File Deleted")

    • selenium.is_alert_present.should be_true
      selenium.get_alert.should eql("File Deleted")

    • None of the mentioned

Good News! You can customize this test as per your requirement

  • Choose and add questions from Interview Mocha question libraries

  • Add your own set of questions

  • Customize test settings like duration, number of questions, passing score, web proctoring and much more

  • Mail us at support@interviewmocha.com to create a custom test

Looking for a tailor-made test, to suit your assessment needs?

Get in touch

Global companies using Mocha assessments

  • altran
  • credit suisse
  • sephora
  • nielsen
  • capgemini
  • akamai

How Mocha assessments are brewed

Speed up your IT recruitment with Interview Mocha

  • 500+ IT skill tests
  • 20+ coding languages
  • 50+ domain knowledge tests
  • 100+ digital 2.0 skill tests
  • Customer focus aptitude tests
  • Enterprise ready features & more...
GET A DEMO

Why hiring managers and recruiters across the globe love Interview Mocha

Take your first step to hire job fit candidates

GET A DEMO