Title: Tutorial on the integration of Selenium with cucumber for experts and fresher’s
1Original Source Tutorial on Selenium, Cucumber
and Gherkin
2What is SELENIUM
In recent times, there are a lot of applications
which are web-based and which run in a browser.
Testing such applications manually take up much
time hence automated testing tools like selenium
is the way to go. Selenium is a free open
source automated testing tool for web
applications across various browsers and
platforms. It is actually similar to HP Quick
Test Pro only that Selenium converges on
automating web-based applications.
3What is
Many times it happens that clients are
non-technical persons and to make them understand
the testing process you need a behavior driven
framework. Cucumber is a behavior driven
framework which can help you to produce the
product as per client needs. It tests the
behavior of the application and writes the tests
in simple English language which is similar to
English and known as Gherkin language.
4Prerequisite for using Cucumber with Selenium
- Selenium jar files
- Selenium-server-standalone
- Can be downloaded at
- http//www.seleniumhq.org/download/
5Continue
- Jar files For Cucumber
- Cucumber-core
- Cucumber-html
- cobertura code coverage
- Cucumber-java
- Cucumber-junit
- Cucumber-jvm-deps
- Cucumber-reporting
- Hemcrest-core
- Gherkin
- Junit
- Can be downloaded at http//mvnrepository.com/sear
ch?qCucumber - On this page, you have to search files download
them individually. Lets go through Some
Screenshot!
6Continue
7Continue
8Continue
9Automation Testing Using Cucumber with Selenium
First of all, create a JAVA project in eclipse by
New -gt Project -gt Other, here you have to select
Maven in other projects
10Continue
Now go to Project gt Select Properties gt Java
Build Path and add all the libraries downloaded
earlier
11Continue
Now create a folder by name "Features" and then
create a new file in it by name MyTest.feature.
You can write Gherkin syntax in it now.
12Continue
Write below lines in MyTest.feature file using
Gherkin syntax.
Feature Reset functionality on login page of
Application Scenario Verification of Reset
button Given Open the Firefox and launch the
application When Enter the Username and
Password Then Reset the credential
13Continue
Now write the selenium testrunner script. Here we
create 'TestRunner' package and then
'Runner.java' class file under it.
- _at_RunWith() is the test runner class to start
executing test - _at_CucmberOptions() is used to set some properties
for cucumber test like feature file, step
definition, etc.
14Continue
Now here we create 'StepDefinition' package and
then 'Steps.java' script file under it.
_at_Given is used to open Firefox and launch the
application _at_When is used to enter the username
and password _at_Then is used to reset the
credential
15Continue
Now execute the script and analyze the output.
16Conclusion
- Cucumber is a recognized BDD tool and it is very
simple to write/read and can be read by clients
either they are a technical and non-technical
person. - Cucumber and Selenium integration can be done
using the following 3 steps - Create a feature file and write tests in Gherkin
language. - Then Create Testrunner file and execute this
script. - Create Step definition, the real selenium script
described under this package. - Original Source
- Tutorial on Selenium, Cucumber and Gherkin
- Selenium with Cucumber (BDD Framework) Tutorial
with Example
17Contact Us
Web
www.nexsoftsys.com
Call
1-646-971-0799
Email
info_at_nexsoftsys.com