Cucumber BDD with Selenium WebDriver and Testng Framework

Cucumber BDD with Selenium WebDriver and Testng Framework


Cucumber is a Behavior Driven Development (BDD) testing framework that helps the non technical members of the team can easily understand the scenario’s automating by testers. In Cucumber, the feature files plays very important role that contains plain English text written using gherkin language which is easy to understand. Refer to the Cucumber Basics

Cucumber-BDD using Page Object Model and Testng Framework:

1. Create a Maven Project with name as ‘cucumbermvn’. Refer to the steps->

http://total-qa.com/advanced-selenium/maven/

2. Add the following dependencies and plugins required for Cucumber,Selenium,Testng.
Refer to the dependencies for Cucumber – Java project

https://cucumber.io/docs/reference/jvm#java

3. Create a following Directory Structure for the project as mentioned below:

Cucumber - BDD,StepDefs,Selenium,Testng,Page Object Model,Maven

Cucumber – BDD,StepDefs,Selenium,Testng,Page Object Model,Maven

4. Refer to the Functional Tests OpenMRSTests.java as mentioned below:

5. Refer to the Step Definitions file LoginPage.java as mentioned below:

6. Feature file Login.feature contains the steps to be performed as part of the scenario:

7. Refer to the testng.xml file.

8. Execute the following maven command with Goals as verify to generate the Cucumber Reports.

mvn verify


Cucumber Reports,CucumberTestReport.json

Cucumber Reports,CucumberTestReport.json

Maven Build Profiles Example

      No Comments on Maven Build Profiles Example

Maven Build Profiles Example

Refer to the below Links for Practise
Selenium Wiki
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz

Access the URL to learn Maven Basics: http://total-qa.com/advanced-selenium/maven/
Maven is a Build Automation Tool helps in packaging different build types as Jar,War,EAR.
EAR -> Enterprise Archive
JAR -> JAVA Archive
WAR-> Web Archive
Refer to the link for more details: https://stackoverflow.com/questions/1594667/war-vs-ear-file
Sometimes, its require to run the Selenium WebDriver Automation tests against the Multiple Environments as DEV and QA. Maven has a provision of profiles which helps to run the test with multiple environments.
Configure the pom.xml with different profiles as mentioned below:


Running the Maven Project using Profile Names:
Right-click on the project select Run as->Run Configurations

Maven Run Configuration

Maven Run Configuration

Provide the maven goals and profile Names:

maven goals profile

maven goals profile

Executing the Maven Project with maven goals and profile Names from command line:

  1. Download the Apache Maven Software from the link https://maven.apache.org/download.cgi accordingly as per the Operating System.
  2. Unzip the file and set the Class-path for the Apache Maven.
  3. classpath

    classpath

  4. Run the Maven Project from the command line with goals and profile name

Refer to the below Links for Practise
Selenium Wiki
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz

extent reports in selenium webdriver

      No Comments on extent reports in selenium webdriver

Selenium WebDriver Reporting – Extent Reports

Refer to the below Links for Practise
Selenium Wiki
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz

As we all familiar with different types of reporting Tools like XSLT Reporting,Allure Reporting mentioned below:
XSLT Report: http://total-qa.com/generate-xslt-report-ant-build/
Allure Report: http://total-qa.com/advanced-selenium/allure-reporting/

We will explore a new open source reporting tool Extent Reports in selenium webdriver.
Extent Reports is a logger-style API written for Java and .NET environments which allows creating HTML reports from tests.

    Steps to Configure Extent Reports:

  • Access the link extent reports for maven dependency information
  • Create a maven project add the extent reports dependency.
  • extentReports

    extentReports

  • Create a Sample Program to generate extent reports.
  • Execute the program verify the extent.html file generated in the project.
  • extentreports1

    extentreports1

selenium webdriver headless chrome

      No Comments on selenium webdriver headless chrome

Why Headless Chrome?


A headless browser is a great tool for automated testing and server environments where you don’t need a visible UI shell. This can be achieved by using Selenium Java Class org.openqa.selenium.chrome.ChromeOptions.

Refer to the Google Chrome Capabilities Link

Pre-requisites:

Exception 1: unknown error: Chrome failed to start: was killed
Resolution:

Remove the following options from the code while running in windows.
options.addArguments(“–print-to-pdf”);
options.addArguments(“–screenshot”);

Exception 2: “unknown error: call function result missing ‘value'”
Resolution:
Download the latest version of chromedriver.exe solves this Issue.
Link for downloading the latest version: https://chromedriver.storage.googleapis.com/index.html?path=2.36/

Refer to the below Links for Practise

Selenium Wiki
Selenium Quiz
Selenium Advanced Quiz
Java Quiz
Java OOPS Quiz
Selenium WebDriver Tester Resume

Agile tools for Software teams – Jira,Rally,Zephyr

Agile tools for Software teams – Jira,Rally,Zephyr

Refer to the below Links for Practise
Selenium Wiki
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz

Why Agile Methodology different from Other Methodologies??
Agile projects build software incrementally using short iterations of 1-4 weeks, to keep development aligned with changing business needs as compare to traditional Software Development Life Cycle mentioned below:

Agile tools for Software teams - Jira

I1,I2,I3 are iterations mentioned below. This Iteration based “approach called as scrum. An Iteration also called as Sprint. The duration of the Iteration is 2-weeks.

Agile tools for Software teams - Jira

Different Roles in Agile Methodology:

    Scrum Master:

  • Facilitate Team Meetings and decision-making sessions.
  • Remove blocks and work with Organization to track progress.

Product Owner:

  • Defines the requirements.
  • Determine the release date.
  • Define the acceptance criteria.
  • Accept the Stories and the team definition of done.

What is a User Story?
A user story is a requirement that defines what functionality a user needs.

What is a task?
A task is how the functionality is implemented. Stories are implemented by tasks.
Agile tools for Software teams - Jira

Agile FAQ’s
What is the right team size?

  1. The team size is between five to nine people.
  2. For 5 developers one tester is dedicated
  3. for 9 developers two testers are dedicated.

They are lot of project management tools like Rally, Jira and Zephyr . For understanding the concepts in a better way we follow the steps on Jira Software.

Introduction:
Jira Software is an agile project management tool that supports any agile methodology . From agile boards to reports, you can plan, track, and manage all your agile software development projects from a single tool. Pick a framework to see how Jira Software can help your team release higher quality software, faster.

  1. Try the downloading the Jira Software using the link -> https://www.atlassian.com/software/jira/try
  2. Agile tools for Software teams - Jira

  3. Provide any suitable name for the site to access it further. Click on Start now.
  4. Agile tools for Software teams - Jira

  5. Verify the email address and assess the Site Link received in your email.
  6. Create a Project name as ‘total-qa’.
  7. Create a sprint as ‘Sprint 1’.
  8. Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

  9. Select an Issue Type as ‘Story’ and select the sprint created ‘Sprint1’
  10. Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

  11. For a story create a subtask.
  12. Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

  13. Access Dashboard click on Project and start the Sprint.
  14. Agile tools for Software teams - Jira

  15. Provide the duration as 2 Weeks.
  16. Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

    Agile tools for Software teams - Jira

  17. Track the progress of the Sprint by selecting the Predefined charts.

Agile tools for Software teams - Jira

Generate XSLT Report+ Ant build.xml+TestNG Fatal Error! Could not find function: if Issue +No suites, classes, methods or jar file was specified.

We usually depend on Testng for generating the default reports. Apart from that we use XSLT reports as well to generate PIE Charts based on Failed,Passed,Skipped Testcases.
During this process we face lot of issues. Few of the most commonly observed issues are as follows:

[xslt] Unknown file:23:146: Fatal Error! Could not find function: if
[xslt] : Fatal Error! Fatal error during transformation Cause: Fatal error during transformation


In order to resolve this we have to follow the below steps. At every step we will check and see whether issues are resolved or not.
Step 1 :
Make sure the build.xml file contains ‘SaxonLiaison’ processor added.
Example:

Re-run the build.xml and verify the issue is resolved. If still the issue is not resolved try performing Step2.
Step 2 :
Make sure the following jars added to the lib folder and Project build path as well.
saxon-8.7.jar -> Link to download the saxon jar-> Click here
SaxonLiaison.jar ->Link to download the SaxonLiaison jar-> Click here
guice-3.0.jar->Link to download guice-3.0.jar-> Click here
Re-run the build.xml and verify the issue is resolved. If the issue is not resolved goto Step3.
Step 3:
Refer to the build.xml mentioned below .Try to do necessary changes.
Re-run the build.xml and verify the issue is resolved.

Step 4:
Re-verify the testng-results.xsl available in the project directory by downloading from the link Click here .Try to do necessary changes.
Re-run the build.xml and verify all the issues are resolved.
If even after the issues are not resolved, please refer to the directory structure mentioned in the below screenshot.
Resolving “No suites, classes, methods or jar file was specified” in Ant TestNG
Make sure the testng.xml is available in the src folder as mentioned in the image below. Refer to the point1.
XSLT+ANT+TESTNG

Selenium WebDriver Tester Resume

      No Comments on Selenium WebDriver Tester Resume

Selenium WebDriver Tester Resume

Resume Highlights:
Having 7+ years of experience in Manual and Automation Testing.
Experience in Selenium WebDriver using Core Java.
Experience in designing the Java Frameworks like TestNG.
Experience in designing the automation frameworks like Data-driven and Modular
Driven
using Page Object Model.
Hands-on-Experience in performing cross browser testing using TestNG and Grid.
Good Knowledge in HTML and XML.
Experience in Test Planning and Designing Test cases.
Experience in Build Automation Tools like Maven and Continuous Integration Tools like Jenkins.
Experience in Storing the Code in Github.
Skill Set
Automation Tools: Selenium Grid,Selenium Webdriver
Performance Tools: JMETER
Rest Services: Rest Assured API,PostMan
Databases: MySQL
Defect Tracking Tools: Bugzilla,Jira
Programming Languages: Core Java
Scripting Language: Java Script,Shell
CI tools: Jenkins
Source Code Repository Tools: Github
Reporting Tools: Allure
Project 1#
Name:
Client Name:
Description:
Tools Used:
Responsibilities:
Performed regression and sanity testing for the project.
Raised the bugs in Bugzilla/Jira.
Provide the logs and screenshots while raising the bugs which gives
more information to developer to fix the defect on-time.
Design the Framework using …
Automate the test cases using Selenium WebDriver with Java Framework TestNG.
Report the Allure results to the stake holders.
Invovled in the module of the project.
Worked effeciently to make sure the project is released on time with high quality.
Project 2#
Name:
Client Name:
Description:
Tools Used:
Project 3#
Name:
Client Name:
Description:
Tools Used:
Project 4#
Name:
Client Name:
Description:
Tools Used:
Refer to the below Links for Practise
Selenium Wiki
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz

Firefox Plugins

      No Comments on Firefox Plugins

Mozilla Firefox Plugins Firebug Firepath Selenium WebDriver

Installation of Firebug

Firebug is a Firefox add-on that we will use to inspect the HTML elements of the web application under test. It will provide us the name of the element that our Selenese command would act upon.

Pre-requisite:

  1. Install 54.0/55.0 version of Firefox from this url https://ftp.mozilla.org/pub/firefox/releases/.
    Verify the version of Firefox. The firefox version should be 54.0/55.0. Latest Version of Firefox doesnt work for Firepath and Firebug.
  2. Checking the version of Firefox.

Installation of Firebug Plug-in

Step 1

Use Firefox to navigate to Firebug’s download page https://addons.mozilla.org/en-US/firefox/addon/firebug/ . Click the “Add to Firefox” button.

Step 2
Wait for Firefox to complete downloading this add-on. On the dialog box that comes after, click “Install Now.”

Step 3
Wait for installation to complete. A notification will pop-up saying, “Firebug has been installed successfully.” You can immediately close this pop-up.

Note: In case you do not see above pop-up , no worries! This pop-up appears for a few seconds and disappears.

You do not need to restart Firefox after installing Firebug.

Step 4

Launch Firebug by doing either of these two methods:

  • Press F12
  • Click on the Firebug button on the upper right corner of the Firefox window.

Step 5

Firebug should launch at the bottom of Firefox as shown below

Mozilla Firefox Plugins Firebug Firepath Selenium WebDriver

 

Installation of FirePath Plug-in

Step 1

Use Firefox to navigate to Firepath’s download page https://addons.mozilla.org/en-us/firefox/addon/firepath/

Click the “Add to Firefox” button.

Mozilla Firefox Plugins Firebug Firepath Selenium WebDriver

Step 2

Wait for Firefox to complete downloading this add-on. On the dialog box that comes after, click “Install Now.”

Mozilla Firefox Plugins Firebug Firepath Selenium WebDriver

Step 3

Wait for installation to complete. A notification will pop-up saying, “FirePath will be installed after you restart Firefox”. Click on Restart Now button.

Mozilla Firefox Plugins Firebug Firepath Selenium WebDriver

Step 4

Launch Firebug by doing either of these two methods:

  • Press F12
  • Click on the Firebug button on the upper right corner of the Firefox window.

Step 5

Firebug should launch at the bottom of Firefox as shown below. Click on FirePath tab to verify the installation successful.

Mozilla Firefox Plugins Firebug Firepath Selenium WebDriver

Real Time Scenarios-Selenium WebDriver

      1 Comment on Real Time Scenarios-Selenium WebDriver

1. How to apply break from an nested for loop in java?
Lets try this on a Real Time Website -> https://demo.openmrs.org/openmrs/login.htm

  • Access the url and enter Admin/Admin123 as credentials
  • Select the ‘Inpatient Ward’.
  • click on Login.
  • Navigate to Appointment Scheduling->Manage Service Types.
  • Write Selenium WebDriver Script to verify the Service Type ‘Urology’ available in the html table.


HomePage

Selenium WebDriver Logic Implemented Using Nested for loop and break Statement

Output

=====================================================================================
2. How to Delete a Service Type from the List?
Lets try this on a Real Time Website -> https://demo.openmrs.org/openmrs/login.htm

  • Access the url and enter Admin/Admin123 as credentials
  • Select the ‘Inpatient Ward’.
  • click on Login.
  • Navigate to Appointment Scheduling->Manage Service Types.
  • Click on Delete icon to perform deletion of Service Type.
  • Finding an xpath for Yes button results in multiple matching nodes.
  • Even though we applying indexing to identify the ‘Yes’ Button its not working.


Delete Service Type
Selenium WebDriver Logic Implemented Using isEnabled and is Displayed

Output

Java Online OOPS Quiz-Test your knowledge

      No Comments on Java Online OOPS Quiz-Test your knowledge

Reference URL’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics

1. final classes cannot be extended.

 
 

2. final variables are constants.

 
 

3. An Object behavior is exposed through fields.

 
 

4. A collection of methods with no implementation is an__?

 
 
 
 

5. How to fetch the current time in Milliseconds?

 
 
 
 

6. Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as ___?

 
 
 
 

7. What is the default value of boolean?

 
 

8. An Object state is stored in methods.

 
 

9. final methods cannot be overriden.

 
 

10. Can we override static methods in JAVA?

 
 

11. Can we Create Abstract Class with out any abstract methods?

 
 

12. The Common behavior of SuperClass is inherited to SubClass using the keyword__??

 
 
 
 

13. What is the superclass for all the Exceptions and Errors in Java?

 
 
 
 

14. Real Objects contain State and Behavior.

 
 

15. The term API stands for __?