You are on page 1of 12

Correct Question Option 1 Option 2

Answer
Which of the following is the correct syntax for invoking a
A Watir::Browser.new :firefox Watir::Browser.Launch :firefox
firefox browser?

B What are the library files in Ruby/Cucumber called? JAR Utils

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


feature file?

Which of the following is the correct syntax for objDriver.driver.manage.timeouts.impli objDriver.driver.manage.timeo


A implementing a implicit wait of 5 seconds? cit_wait=5 uts.implicit_wait=5000

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

C Which of the following gem is required for accessing an XL extlib


Excel file?

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

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

What are the 2 files required to execute a Cucumber test


A 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

What are before, after, beforeStep and afterStep in


B support Hooks
Cucumber?

Which of the following is the correct syntax for command cucumber


A line execution of a feature file named 'MyScript' assuming cucumber features/MyScript.feature
feature/MyScript.feature
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 named 'MyScript' which has cucumber features --tags @smoke cucumber features/tags
A
a tag named '@smoke' assuming we are at the project @smoke
folder in Command Prompt?

cucumber
Which of the following is the correct syntax for reports cucumber features\Opencart.feature --
D generation via command prompt? format html --out TestReport.html features/Opencart.feature --
format html TestReport.html

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

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


What is the syntax of executing all the feature files in a
A cucumber features cucumber features/all
project 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

D What is the default feature for parameterizing your Excel CSV


scenario in Ruby?

"--------------" is the method available in Ruby Cucumber to


B Instrumentation Interpolation
use the value of a variable inside a string?

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

C How do we identify a link in Ruby Cucmber? driver.link(:href="") driver.weblink(:href="")

A How do we identify a Textbox in Ruby Cucmber? driver.text_field(:name=>"") driver.text(:name=>"")

A Which of the following is the correct syntax for invoking a Selenium::WebDriver.for :firefox Selenium::WebDriver.Open :fir
browser using Selenium WebDriver? efox

Which of the following is the correct syntax for declaring an objDriver.driver.manage.timeouts.impli objDriver.driver.manage.timeo
C
implicit timeout using Selenium WebDriver? cit_wait=5 uts.implicit.wait=5

B How do we identify a WebElement(Button) in Ruby driver.webbutton(:name=>"") driver.button(:name=>"")


Cucumber?
driver.radio_button(:value=>""
C How do we identify a RadioButton in Ruby Cucmber? driver.radio(:name=>"")
)

A How do we identify a ComboBox in Ruby Cucmber? driver.select_list(:name=>"") driver.select(:name=>"")

D How do we maximize a browser window in Ruby $objBrowser.manage.max $objBrowser.manage.maximiz


Cucumber? e
Which file cannot be used to import data into Ruby
B Excel JS file
Cucumber?
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 reverse


B Ruby Cucumber? equal

A The command used for enering data in a text field in Ruby .set .type
Cucumber?
Which command is used to check for the presence of an
C object in 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 Write the parameter in single quotes Write the parameter in double
Ruby Cucumber? quotes
Which one of the following is used to select a checkbox in
C Ruby Cucumber? .set .select

D How do we give multiple properties for an Object in Ruby :name=>"";:class="" :name=>""+:class=>""


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

B Cucumber is used for "------------" Testing? System & Unit Testing System & Integration Testing
A regular expression is a
A What is a Regular expression? A regular expression is a pattern pattern describing numbers
describing a certain amount of text
only.

Which of these we do NOT need to run a Cucumber Web


D 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?

What is missing in the following code of Ruby Cucumber:


Feature: Visit XYZ page in abc.com
C Given: I am on abc.com Parameters Step_definition
When: I click on XYZ page
Then: I should see ABC page

B Command used to execute a Cucumber profile? cucumber features -profile cucumber features -p
<profile_name> <profile_name>

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


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

A Which of these is not an Environment variable present in RUBYLIBRARY RUBYOPT


Ruby Cucumber?

D What is the use of the "super" keyword in Ruby Rails? To call the superclass implementation To call the superclass of the
of the default method default method

What will be the outcome of the following code:


while i<7 do
B Prints the value of "i" 7 times Error for "i" not initialized
puts(i)
end

What is missing in the following code of Ruby Cucumber:


A :name=> :link=>
$driver.text_field("email").set "email"

$driver.link("http://
D How can we open a Web URL in Ruby Cucumber? $driver.open("http:// 10.207.182.108:81/
10.207.182.108:81/opencart/")
opencart/").click

B How do we do a Dry-run in Ruby Cucumber? Cucumber features –dryrun Cucumber features –dry-run

C How do we open a Text file in Ruby Cucumber? $objFile=File.Open("Path") $objFile=OpenFile("Path",'r')

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

What is missing in the following code for reading from a


text file:
$objFile.each do
B ??? |variable| |line|
puts line
end

Which of these commands is used to run a particular


A scenario from a feature file? cucumber features/test.feature:21 cucumber features
What is missing in the following command used to generate
report using Ruby Cucumber?
B -- --format
cucumber features/Opencart.feature ??? html –out
report.html

C Syntax for writing XPATH in Ruby Cucumber is? :xpath XPATH

foreach("path") do CSV.for("path") do
Which one of the followin is the correct way of reading data |row| |row|
D
from a CSV file? puts row puts row
end end

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


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

A How do we open an Excel sheet through Ruby Cucumber? objSheet=objExcel.workbooks.open("Pa objSheet=objExcel.open("Path


th").worksheets("Sheet1") ").worksheets("Sheet1")

Feature: Visit XYZ page in


Feature: Visit XYZ page in abc.com abc.com
Scenario : Visit abc.com
Which one of the following options is the correct form of
D
writing a feature file? 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


C Which one of the following is correct?
I click on login & I click on login
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


B file, including whatever classes, modules, methods, and env.rb Require()
constants are in that file into the current scope

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

"-----" criteria for the feature can be defined as when The


C Product Owner, a Programmer and a Tester collaborate on BDD TDD
system behaviour.

"-----" is a story testing approach.The functionalities written


D by the Business Analyst's triggers the testing process Agile TDD

"----" is an incremental and iterative software development


A Agile Waterfall
model

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


C descriptions of your software’s functionality. Capybara Calabash

D Which one of the following is not a specification file? spec rspec

What is the output of the following code:


In End
C END {puts "In End"} In Begin Error as END is preceding the
BEGIN {puts "In Begin"} middle BEGIN command
puts "middle"

What is the output of the following code:


age=3
x="double quoted {age}" double quoted 3 double quoted {age}
B
y='single quoted {age}' single quoted {age} single quoted {age}
puts x
puts y
What is the output of the following code:
C message="Ruby Programming" Ruby Programming Syntax Error
puts message[0,message.length-4]

What is the output of the following code: hello


.3 times do hello
A puts "hello" hello hello
end hello

C What is the tag used for writing a scenario for Selenium in @Test @Scenario
Ruby 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?

What is the output of the following code:


i=10
D while i==10 Hello 10 (10 times) Hello 0 (9 times)
puts "Hello {i}"
end

What is the output of the following code:

B empdata={"Emp ID"=>"010","Name"=>"Kumar"} 010 Kumar Kumar


puts empdata["Name"]

Hello
What is the output of the following code: Hello Hello
10.downto(7) do Hello Hello
A puts "Hello" Hello Hello
end Hello Hello
Hello
Hello

What is the output of the following code:


while i<10
D puts "Hello" Hello -10 times Hello - 9 times
end

What is the output of the following code:


i=0
while i<10
C puts "Hello" Hello -10 times Hello - 9 times
end

What is the output of the following code:


i=0
D while i==10 Hello -10 times Hello - 9 times
puts "Hello"
end

What is the output of the following code:


i=0
C while i=10 Hello -10 times Hello - 9 times
puts "Hello"
end
What is the output of the following code:
i=0
while i=10
D puts "Hello {i}" Hello 10 (10 times) Hello 0 (9 times)
end
Option 3 Option 4

Watir::Browser.Open :firefo
Watir:Browser.new :firefox
x

Gems Lib

.NET Gherkin Language

objDriver.manage.timeouts.implici objDriver.manage.timeouts.
t_wait=5000 implicit.wait=5

require call

Win32OLE yaml

uuidtools redcard

When Also

support,step_definitions feature,step_definition

| _

& $

Poltergeist Phantom

Ctrl+S Alt+S

Tags Drivers

cucumber feature-- cucumber -- feature--


MyScript.feature MyScript.feature

cucumber features--
cucumber features/@smoke
@smoke

cucumber
cucumber features--
features/Opencart.feature
Opencart.feature --format html --format html --out
TestReport.html
TestReport.html

Cucumber tags are used to


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

@ %

cucumber/ run features cucumber/ run all

support WebDriver

It is used to run multiple features


together It is used to create a log file

.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

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

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

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


refox

objDriver.manage.timeouts.implici objDriver.driver.manage.tim
t_wait=5 eouts.implicit.wait=5000

driver.button(name=>"") driver.webbutton(:name=""
)
driver.radio_button(:name=
driver.radio(:value=>"")
>"")

driver.list(:name=>"") driver.selectlist(:name=>"")

$objBrowser.manage.window.max $objBrowser.driver.manage
imize .window.maximize

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

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

Step_definition Scenario Outline

System,Unit &Integration
Unit & Integration Testing Testing
A regular expression is an A regular expression is a
encoding used for describing a pattern used for variable
text names.

Watir Hooks

Features/ support file contains the Features/ support file


contains the scenario
scenario. outline.

Pipe(||) And(&&)

Scenario TestCase

cucumber features cucumber feature -p


<profile_name> <profile_name>

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 framework
web application framework for the designed for Open source
Ruby programming language
tools.

RUBYPATH RUBYLIB_PREFIX

To call the superclass


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

Error because the value of "i" is


Prints 0
not increased

:value=> :id=>

$driver.goto("http://
$driver.run("http:// 10.207.182.108:81/
10.207.182.108:81/opencart/")
opencart/")

Cucumber features –Dry-


Cucumber features dry-run Run

$objFile=File.Open("Path",'r') $objFile=Open("Path",'r')

install gems gems install gemfile

|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

WATIR Excel

objSheet=objExcel.workbooks("Pa objSheet=objExcel.workboo
th").worksheets("Sheet1") ks.open("Path")

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
AfterStep BeforeStep
AfterStep BeforeStep

Require_Method() Watir

Ruby Cucumber TDD

Acceptance Regression

Gherkin BDD

Iterative BDD

Cucumber Keyword Driven

mspec nspec

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

@selenium @selenium-cucumber

find xpath

* %

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

Kumar 010 Errror

Hello
Error as For/while is not
Hello
implemented
Hello

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


not increased initialized

Error because the value of


Hello - infinite times "i" is not increased

Hello - infinite times No Output

Hello - infinite times No Output


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

You might also like