Tuesday, February 28, 2017

First Test Case in Selenium with Cucumber

Let us now implementing a simple cucumber test. We will validate "Gmail invalid login" scenario to understand the test case implementation. I would recommend you to go through my previous post What are Features and Step Definitions in Cucumber? and understand Features file and Step Definitions. Let us go step by step...
  • Create a project and adding Jars. Please go through my previous post Downloading Cucumber JVM and Selenium Jars to understand.
  • Create Features folder and features file.
  • Add a Feature and sample Scenario.
  • Create a Test Runner.
  • Create Step Definitions package and define steps.
  • Run the Test Runner as Junit test.
Step 1: Create a Project New Project select Java Project and click Next. Give the project name as “seleniumCucumberProject” (you can give any name).

Monday, February 27, 2017

What are Features and Step Definitions in Cucumber?

Features: File with “.feature” extension are called features file. A Feature file will contain one feature with one or more Scenarios. A line started with Keyword “Feature” in Feature file is the test feature that cucumber going to execute.  Each Scenario in Feature contains number of steps written using Gherkin language.

Step Definitions: Each step in a Scenario is mapped to Step definition. When Cucumber executes a Step Scenario it looks for a matching Step Definition to execute. Each step definition is a piece of code defined to do certain task in the scenario. Step definitions are attached to steps with a reference pattern, which is used for connecting steps in a scenario and step definitions.

Sunday, February 26, 2017

How to Encrypt password for Selenium WebDriver?

To secure our passwords we can use Base64 encoding scheme in Selenium WebDriver. We will import this Bas64 class in our script to get the encoded password.

Wednesday, February 22, 2017

Download Cucumber JVM and Selenium Jars for Eclipse

To write/run Cucumber Scenarios with Java in Eclipse the below Jar files are required. Please follow the steps and all download the all listed jar files.
·         junit
·         gherkin
·         cucumber-core
·         cucumber-java
·         cucumber-junit
·         cucumber-jvm-deps
·         cucumber-reporting
·         mockito-all
·         cobertura

Step 1: Search all the above terms in the Maven Central Repository one by one and download latest Jar file. Click Here! for Maven repository.

Tuesday, February 21, 2017

Installing Cucumber Eclipse Plugin

Why Cucumber Eclipse Plugin needed? This plugin highlights the Syntax’s or Keywords; basically it distinguishes syntax keywords from other sentences. That is fine if we do not install it but the entire scripts appears as plain text as in a notepad. So it is recommended to install Cucumber Eclipse Plugin.
Installation Steps:
Step 1: launch Eclipse IDE and Go to “Install New Software…” option.
Step 2: In the new dialog window click on “Add” button.

Monday, February 20, 2017

What is the advantage of Cucumber in Selenium Automation?

Or else we can ask our-self what makes us to bring Cucumber to Selenium Automation?             

In this agile world, the Stake Holders or Business Analysts or Product Owners decides behavior of the system first and writes System Requirements or System Scenarios in customer’s point of view. These requirements are reviewed and singed off to the developers for development. This is called Behavior Driven Development (BDD) approach.

            Now the above system requirements are converted to Use Cases, using BDD approach this Use Cases are converted into testing/developing entities directly using a simple English sentences(Gherkin), instead of splitting further into small functionalities. And this tests are easily understandable to the Clients or Business Analysts or persons with no or minimal technical knowledge. Whereas the tests developed using tools Selenium or UFT are pure technical and one has to be technically good to understand the tests, even that consumes some time and efforts. 

So if we can use BDD approach in out test automation that will increase the code readability. By seeing the tests we can tell what that test is testing. And Cucumber is one of the BDD tool that supports automation using Java and Ruby. Selenium Automation with Cucumber is becoming good choice in the automation industry. 

I tried bringing nearest answer to our question. Please comment your queries and suggestions on this topic. Thanks for reading!!

#seleniumbabu #HappyLearning

Introduction to Cucumber

  • Cucumber is an open source software tool used to test the other software. It is a Behavior Driven Development tool. 
  • The tests will be written in simple English language. Persons with no technical knowledge can understand the tests written just by reading high level. 
  • Writing the tests is easy and simple.
  • Though Cucumber is written in Ruby, supports other languages like Java, Scala, Groovy and etc. Cucumber supports web environment only.
  • Cucumber plugins works faster compared to UFT and Selenium. These features of Cucumber attracting the Clients and Automation Industry.


Saturday, February 18, 2017

Common Issues in Selenium Automation with IE Browser

The common issues that could be faced while automating IE Browser using Selenium are discussed below. One should ensure these settings set before the start of the automation.

1. Protected Mode Settings: Protected Mode must be set to the same value (enabled or disabled) for all zones under security tab in Internet Options. Find the screen shot attached.

Exception we would see in console when the settings are not properly: 
org.openqa.selenium.WebDriverException: Unexpected error launching Internet
Explorer. Protected Mode must be set to the same value (enabled or disabled) for all
zones.



Friday, February 17, 2017

launching Firefox with Gecko Driver using Selenium 3

Selenium 2 was supporting Firefox driver launch by default, no need of using external drivers. Now Selenium 3 is released with some improvements and changes.One of the enhancement or change is the support to Firefox browser is made external like Chrome and IE Browsers. We need to use Gecko Driver to launch Firefox using Selenium 3. See the below step by step procedure in launching the Firefox browser using Gecko Driver. Assuming Selenium 3 setup already done.

Step 1: Download Gecko Driver:

            Download the latest version of geckodriver.exe , unzip the downloaded file and keep it some location on your machine. To download the Gecko Driver Click Here!!

Step 2: Set the System Property in the Script.


      
         


   
       

Java Program 6: How to reverse a String in Java?

In this post we will discuss different methods to reverse a String in java programming. Method 1: Step 1: Read the input string using ...