Cucumber Testing and Framework
What is Cucumber Testing?
Cucumber Testing or Cucumber framework or Selenium with cucumber and java is powerful combination with respect to Web Application automation testing. Cucumber tool is easy to learn and implement as well.Cucumber is written in a language known as 'Gherkin'.As it is easy to implement and language usage which is near to common English language. Now lets start with the tutorials what is cucumber testing and followed by cucumber test example.Cucumber feature file
Feature file is a text file that is created in project structure which will have extension as '.feature'. This is the file where we are suppose to write cucumber steps that we are following for a scenario and each step will be link to a action that has to be performed in step definition package. Feature file starts with Feature: name of the scenario with regression or sprint test case what is being done for eg. Testing new web application or module followed by testing - regression or sanity. Scenario can be written with Given, When, Then , And.Cucumber BDD test example :
Below is the cucumber testing tutorial where we are writing a feature file with all the tags required and then will try to execute and get the output. Here each step will execute a method which it is linked in step definition file.
Feature: What are we testing
Scenario: Scenario or test scenario (Login to web applicaiton)
Given URL is opened
When user enter valid credentials
Then user must be successfully logged in
Here if we read the scenario, it is pretty much clear that what this script will going to execute.Now there will be no programming language constrain and is easy to understand for bussiness as well.
Now, we have step defination package, which will consist of class that will get executed once a step is performed. Like if we have Given Url is opened then we have a specific method say openURL() which will get triggered once under execution. Similarly if we have a step enter credentials then that step will be linked to a method say enterCredentials(). Like this we create a link between the steps and relevant method that needs to be executed.
Other thing that we have is runner class which is used for execution of scenarios present in feature file. This is done with the help of tag that we provide in runner class that start the relevant scenario with the tags. Now if we want to execute the above example so we need to first add tag in the runner class lets say tag is {"sanity"} and same has to be added to each scenario that we need to execute.
@sanity
Scenario: What is the scenario
Given Url is opened
When user enter valid credentials
Then user must be successfully logged in
The best way to practice Selenium is to work on some real world project. Find some popular websites (Google / Yahoo / Amazon), identify functionally critical areas and create automated tests for them. Selenium (With Java, C# and Cucumber) training, open source performance testing and automation testing tools in India. With our team of Subject Matter Experts & trainers we provide required support during and post training and deliver 100% quality training
ReplyDeleteGyansetu Instructors have very good experience and training skills. Training was awesome.In Gurgaon and Delhi region, the Gyansetu tops in terms of quality training delivery in Gurgaon. call us 9999201478.