0% found this document useful (0 votes)
86 views

Ans Question Option 1 Option 2

Cucumber is a tool used for Behavior Driven Development (BDD) that allows software teams to write test cases in a language that is understandable by both technical and non-technical people like business analysts and customers. It uses feature files written in plain language to describe scenarios and step definitions written in code to implement those scenarios. The cucumber execution starts from the step definitions, which are linked to the scenarios in the feature files.

Uploaded by

Anjali Rana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views

Ans Question Option 1 Option 2

Cucumber is a tool used for Behavior Driven Development (BDD) that allows software teams to write test cases in a language that is understandable by both technical and non-technical people like business analysts and customers. It uses feature files written in plain language to describe scenarios and step definitions written in code to implement those scenarios. The cucumber execution starts from the step definitions, which are linked to the scenarios in the feature files.

Uploaded by

Anjali Rana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Ans Question Option 1 Option 2

A Which of the following is the correct syntax for invoking a firefox Watir::Browser.new :firefox Watir::Browser.Launch :firefox
browser?
B What are the library files in Ruby/Cucumber called? JAR Utils

D What is the language used for expressing scenario in feature file? Java VB

C Which keyword is used to call a library file in your script? import include

Which of the following gem is required for accessing an Excel


C file? XL extlib

B Which of the following gem is required for accessing an CSV file? signet csv

D Which of the following is not a keyword in Cucumber? Given Then

A What are the 2 files required to execute a Cucumber test features,step_definiton features,support
scenario?

C Which symbol is used to separate columns in Scenario Outline? / \

D Which symbol is used as preffix to declare a variable as public? @ !

D Which of the following is NOT a webDriver in Cucumber? Watir Selenium

A What is the shortut key to open setting in RubyMine IDE? Ctrl+Alt+S Ctrl+Shift+S

B What are before, after, beforeStep and afterStep in Cucumber? support Hooks

Cucumber tags are used to sort the Cucumber tags are used to give
D Why we use the tags for scenarios in Cucumber ?
scenarios a scenario a layout

C What preffix is used for adding a tag to a scenario? $ &

A What is the syntax of executing all the feature files in a project cucumber features cucumber features/all
from command line?
C Where does the Cucumber execution starts from? step_definition hooks

It is used to load the required libraries It is used to load the scenarios


A What is env.rb used for?
for cucumber scenario execution for execution

C "____" is the file extension for a ruby file cucumber? .feature .ruby

D BDD stands for? Behave Driven Design Behave Driven Development

D Which of the following is not a Agile methodology? Sprint Scrum

B Which testing model is best suited for the BDD framework? Waterfall Agile

What is the default feature for parameterizing your scenario in


D Excel CSV
Ruby?
"--------------" is the method available in Ruby Cucumber to use
B Instrumentation Interpolation
the value of a variable inside a string?

D This command is used to check the Ruby version installed. ruby -vi ruby -c

B Which file cannot be used to import data into Ruby Cucumber? Excel JS file

B How do we define functions in Ruby Cucumber? _def  <function_name> def  <function_name>

C How do we comment a block of code in Ruby Cucumber? Shift+Ctrl+/ Shift+//

Which one of the following is not a valid String command in Ruby


B Cucumber? reverse equal

The command used for enering data in a text field in Ruby


A .set .type
Cucumber?
Which command is used to check for the presence of an object in
C Ruby Cucumber? .exist .ispresent

C How do we "Rename" a file in Ruby Cucumber? Rename F2 key


D Shortcut for Running a Scenario in Ruby Cucumber? Shift+F5 Shift+F8
A Shortcut for Debugging a Scenario in Ruby Cucumber? Shift+F9 Shift+F11

B How can we a parameterize any input in the feature file in Ruby Write the parameter in single quotes Write the parameter in double
Cucumber? quotes
Which one of the following is used to select a checkbox in Ruby
C .set .select
Cucumber?

C Which of the following is not part of a "feature" file in Ruby Feature Scenario
Cucumber?

B Cucumber is used for "------------" Testing? System & Unit Testing System & Integration Testing

A regular expression is a pattern A regular expression is a


A What is a Regular expression? pattern describing numbers
describing a certain amount of text only.

D Which of these we do NOT need to run a Cucumber Web Test? Gems Ruby

Features/ support file contains Features/ support file contains


A What does a features/support file contain? supporting ruby code supporting cucumber code

How is the data seperated in a Scenario Outline in Ruby


C Quotes("") Semi-colon(;)
Cucumber?

D What is cucumber.yml file in Ruby cucumber? It is used to write step definitions It is used to write features

Ruby on Rails is an open source web


C What is Ruby on Rails? application framework for the Ruby on Rails is a Gem file in
Ruby
Cucumber programming language

Which of these is not an Environment variable present in Ruby


A Cucumber? RUBYLIBRARY RUBYOPT

To call the superclass implementation To call the superclass of the


D What is the use of the "super" keyword in Ruby Rails?
of the default method default method

A Command used for installing a Gem file gem install gemfile gem install gems

What is missing in the following line of code used to invoke the


B Excel Application in Ruby Cucumber? CSV WIN32OLE
objExcel=???.new("Excel.Application")

C "???" executes after the each step execution Before After


A "???" execute before the feature file execution Before After

"???" loads and processes the Ruby code from a separate file,
B including whatever classes, modules, methods, and constants env.rb Require()
are in that file into the current scope

"-----" exercise the concept – “ You write test cases and then
D develop the product that suits them" BDD Gherkin

"-----" criteria for the feature can be defined as when The Product
C Owner, a Programmer and a Tester collaborate on system BDD TDD
behaviour.

D "-----" is a story testing approach.The functionalities written by Agile TDD


the Business Analyst's triggers the testing process

A "----" is an incremental and iterative software development model Agile Waterfall

"----" is a framework for writing and executing high level


C Capybara Calabash
descriptions of your software’s functionality.
D Which one of the following is not a specification file? spec rspec

C What is the tag used for writing a scenario for Selenium in Ruby @Test @Scenario
Cucumber?
Which of the following is the Object locator used for finding
B find_by_element find_element
objects through Selenium in Ruby Cucumber?

D Which prefix is used to use/call the steps from a pre-defined + &


scenario in Ruby Cucumber?
Option 3 Option 4
Watir:Browser.new :firefox Watir::Browser.Open :firefox

Gems Lib

.NET Gherkin Language

require call

Win32OLE yaml

uuidtools redcard

When Also

support,step_definitions feature,step_definition

| _

& $

Poltergeist Phantom

Ctrl+S Alt+S

Tags Drivers

Cucumber tags are used to filter the


Cucumber tags are used to name
scenarios and execute the scenarios
the scenrios
based on tags.

@ %

cucumber/ run features cucumber/ run all

support WebDriver

It is used to run multiple features


It is used to create a log file
together

.rb .exe

Behaviour Driven Design Behaviour Driven Development

Product Backlog BDD

Iterative V model

Text file Scenario Outline

Concatenation L value

ruby -version ruby -v

CSV file Property file

sub <function name> define <function name>

CTRL+/ ALT+/

starts_with size

.edit .set_field

.exist? .ispresent?

Refactor---->Rename Refactor--->Edit
F5 Shift+F10
Shift+F10 F9
Write the parameter after the + Write the parameter as it is.
symbol

.click .check

Step_definition Scenario Outline

Unit & Integration Testing System,Unit &Integration Testing

A regular expression is an encoding A regular expression is a pattern used for


used for describing a text variable names.

Watir Hooks

Features/ support file contains the Features/ support file contains the
scenario. scenario outline.

Pipe(||) And(&&)

It is used to write driver settings It is used to create a profile

Ruby on Rails is an open source Ruby on Rails is an automation


web application framework for the framework designed for Open source
Ruby programming language tools.

RUBYPATH RUBYLIB_PREFIX

To call the superclass of the current To call the superclass implementation of


method the current method

install gems gems install gemfile

WATIR Excel

AfterStep BeforeStep
AfterStep BeforeStep

Require_Method() Watir

Ruby Cucumber TDD

Acceptance Regression

Gherkin BDD

Iterative BDD

Cucumber Keyword Driven

mspec nspec

@selenium @selenium-cucumber

find xpath

* %
AnsQuestion

Which of the following is the correct syntax for implementing a implicit wait of 5
A
seconds?

Which of the following is the correct syntax for command line execution of a feature
A
file named 'MyScript' assuming we are at the project folder in Command Prompt?

Which of the following is the correct syntax for command line execution of a feature file
A named 'MyScript' which has a tag named '@smoke' assuming we are at the project
folder in Command Prompt?

D Which of the following is the correct syntax for reports generation via command
prompt?

C How do we identify a link in Ruby Cucmber?

A How do we identify a Textbox in Ruby Cucmber?

Which of the following is the correct syntax for invoking a browser using Selenium
A
WebDriver?

C Which of the following is the correct syntax for declaring an implicit timeout using
Selenium WebDriver?

B How do we identify a WebElement(Button) in Ruby Cucumber?

C How do we identify a RadioButton in Ruby Cucmber?


A How do we identify a ComboBox in Ruby Cucmber?

D How do we maximize a browser window in Ruby Cucumber?

D How do we give multiple properties for an Object in Ruby Cucumber?


C What is missing in the following code of Ruby Cucumber:

B Command used to execute a Cucumber profile?

What will be the outcome of the following code:


while i<7 do
B
puts(i)
end
What is missing in the following code of Ruby Cucumber:
A
$driver.text_field("email").set "email"

D How can we open a Web URL in Ruby Cucumber?


B How do we do a Dry-run in Ruby Cucumber?
C How do we open a Text file in Ruby Cucumber?
What is missing in the following code for reading from a text file:
$objFile.each do
B ???
puts line
end

A Which of these commands is used to run a particular scenario from a feature file?

What is missing in the following command used to generate report using Ruby
Cucumber?
B

cucumber features/Opencart.feature ??? html –out report.html


C Syntax for writing XPATH in Ruby Cucumber is?

D Which one of the followin is the correct way of reading data from a CSV file?

A How do we open an Excel sheet through Ruby Cucumber?

D Which one of the following options is the correct form of writing a feature file?

C Which one of the following is correct?

What is the output of the following code:


END {puts "In End"}
C
BEGIN {puts "In Begin"}
puts "middle"
What is the output of the following code:
age=3
x="double quoted {age}"
B
y='single quoted {age}'
puts x
puts y
What is the output of the following code:
C message="Ruby Programming"
puts message[0,message.length-4]
What is the output of the following code:
.3 times do
A
puts "hello"
end
What is the output of the following code:

B
empdata={"Emp ID"=>"010","Name"=>"Kumar"}
puts empdata["Name"]
What is the output of the following code:
10.downto(7) do
puts "Hello"
A end

Any one will come from below

What is the output of the following code:


while i<10
D
puts "Hello"
end
What is the output of the following code:
i=0
C while i<10
puts "Hello"
end
What is the output of the following code:
i=0
D while i==10
puts "Hello"
end
What is the output of the following code:
i=0
C while i=10
puts "Hello"
end
What is the output of the following code:
i=0
D while i=10
puts "Hello {i}"
end
What is the output of the following code:
i=10
D while i==10
puts "Hello {i}"
end
Option 1 Option 2

objDriver.driver.manage.timeouts.implicit_wait objDriver.driver.manage.timeouts.implicit_wait
=5 =5000

cucumber features/MyScript.feature cucumber feature/MyScript.feature

cucumber features --tags @smoke cucumber features/tags @smoke

cucumber features\Opencart.feature --format cucumber features/Opencart.feature --format


html --out TestReport.html html TestReport.html

driver.link(:href="") driver.weblink(:href="")

driver.text_field(:name=>"") driver.text(:name=>"")

Selenium::WebDriver.for :firefox Selenium::WebDriver.Open :firefox

objDriver.driver.manage.timeouts.implicit_wait objDriver.driver.manage.timeouts.implicit.wait=
=5 5

driver.webbutton(:name=>"") driver.button(:name=>"")

driver.radio(:name=>"") driver.radio_button(:value=>"")
driver.select_list(:name=>"") driver.select(:name=>"")

$objBrowser.manage.max $objBrowser.manage.maximize

:name=>"";:class="" :name=>""+:class=>""
Parameters Step_definition

cucumber features -profile <profile_name> cucumber features -p <profile_name>

Prints the value of "i" 7 times Error for "i" not initialized

:name=> :link=>

$driver.open("http://10.207.182.108:81/openca $driver.link("http://10.207.182.108:81/opencart
rt/") /").click
Cucumber features –dryrun Cucumber features –dry-run
$objFile=File.Open("Path") $objFile=OpenFile("Path",'r')

|variable| |line|

cucumber features/test.feature:21 cucumber features

-- --format

:xpath XPATH
foreach("path") do CSV.for("path") do
|row| |row|
puts row puts row
end end
objSheet=objExcel.workbooks.open("Path").wor objSheet=objExcel.open("Path").worksheets("Sh
ksheets("Sheet1") eet1")
Feature: Visit XYZ page in abc.com Feature: Visit XYZ page in abc.com
Scenario : Visit abc.com
Given: I am on abc.com
When: I click on XYZ page When: I click on XYZ page
Then: I should see ABC page Then: I should see ABC page
Given: I am on abc.com Given: I am on abc.com
I click on login & I click on login
In End
In Begin
Error as END is preceding the BEGIN command
middle

double quoted 3 double quoted {age}


single quoted {age} single quoted {age}

Ruby Programming Syntax Error

hello hello
hello hello
hello
010 Kumar Kumar

Hello Hello
Hello Hello
Hello Hello
Hello Hello
Hello
Hello
Hello

Hello -10 times Hello - 9 times

Hello -10 times Hello - 9 times

Hello -10 times Hello - 9 times

Hello -10 times Hello - 9 times

Hello 10 (10 times) Hello 0 (9 times)

Hello 10 (10 times) Hello 0 (9 times)


Option 3 Option 4

objDriver.manage.timeouts.implicit_wait=5000 objDriver.manage.timeouts.implicit.wait=5

cucumber feature--MyScript.feature cucumber -- feature--MyScript.feature

cucumber features/@smoke cucumber features-- @smoke

cucumber features-- Opencart.feature --format cucumber features/Opencart.feature --format


html TestReport.html html --out TestReport.html

driver.link(:href=>"") driver.link(href=>"")

driver.text(name=>"") driver.text_field(:name="")

Selenium::WebDriver.new :firefox Selenium:WebDriver.new :firefox

objDriver.driver.manage.timeouts.implicit.wait=
objDriver.manage.timeouts.implicit_wait=5
5000

driver.button(name=>"") driver.webbutton(:name="")

driver.radio(:value=>"") driver.radio_button(:name=>"")
driver.list(:name=>"") driver.selectlist(:name=>"")

$objBrowser.manage.window.maximize $objBrowser.driver.manage.window.maximize

:name=>""&:class=>"" :name=>"",:class=>""
Scenario TestCase

cucumber features <profile_name> cucumber feature -p <profile_name>

Error because the value of "i" is not increased Prints 0

:value=> :id=>

$driver.run("http://10.207.182.108:81/opencart $driver.goto("http://10.207.182.108:81/openca
/") rt/")
Cucumber features dry-run Cucumber features –Dry-Run
$objFile=File.Open("Path",'r') $objFile=Open("Path",'r')

|arg| |nextarg|

cucumber features/run features cucumber features/run all

-format --html format

:xpath=> :XPATH
CSV.foreach("path") CSV.foreach("path") do
|row| |row|
puts row puts row
end end
objSheet=objExcel.workbooks("Path").workshee
objSheet=objExcel.workbooks.open("Path")
ts("Sheet1")
Feature: Visit XYZ page in abc.com
Scenario : Visit abc.com Scenario : Visit abc.com
Given: I am on abc.com Given: I am on abc.com
When: I click on XYZ page When: I click on XYZ page
Then: I should see ABC page Then: I should see ABC page
Given: I am on abc.com Given: I am on abc.com
*I click on login --I click on login
In Begin In End
middle middle
In END In Begin

double quoted 3 double quoted


single quoted 3 single quoted

Ruby Program Ruby Programm

Syntax Error as "for/while" is not defined hello


Kumar 010 Errror

Hello
Hello
Hello
Error as For/while is not implemented

Error because the value of "i" is not increased Error because "i" is not initialized

Hello - infinite times Error because the value of "i" is not increased

Hello - infinite times No Output

Hello - infinite times No Output

Hello {0} (infinite times) Hello {i} (infinite times)

Hello {0} (infinite times) Hello {i} (infinite times)

You might also like