JUnit and Hybrid (Keyword+Data Driven) Framework – Part 1

Overview:

In this tutorial, we will learn how to build Hybrid (Keyword+Data Driven) Framework and we will publish this tutorial in multiple parts. Initially, we will build up the core of Hybrid Framework. The core of Hybrid framework will look like. We will build up the core and integrate with webdriver and selenium RC. The features of the core will remain same for both webdriver and selenium RC.

For detailed tutorial series check here:

 

Hybrid (Keyword+Data Driven) Framework

 

Steps involved to implement Core Hybrid Framework

In Data-driven framework we actually keep data in excel files and in a hybrid framework we have keywords as well as data in the excel files.

Rules for making XLS files in Hybrid framework

1) The primary file is Suite.xlsx

This file contains information about Test Suites.

2) Name of Suites.xlsx file should be same as the name of suite ID in Suite.xlsx.

3) Runmode for:

  • Suite
  • Testcase
  • Data Set in Test Case

4) TCID in Test Cases sheet==TCID in Test Steps sheet

 

Step1: Create Eclipse project

 

Core Hybrid Project

 

Step2: Make package- com.selenium.test

Right Click on src->select Package

 

Core Hybrid Test Package

 

Step3: Make DriverScript.java, Keywords.java, Constants.java files in package

Step4: Make the package – com.selenium.xls

 

Core Hybrid xls Package

 

Step5: Decide your keywords, make test cases/suite in xls and copy xls files in com.selenium.xls package

Step6: Include selenium, POI, Logging jars in a project.

Step7: Make package- com.selenium.xls.read

 

Core Hybrid xls Read Package

 

Step8: Put Xls_Reader.java in com.selenium.xls.read package

Step9: Make package- com.selenium.config

 

Core Hybrid Config Package

 

Step10: Make config.properties and OR.properties in com.selenium.config package

config.properties

 

Core Hybrid config.properties

 

OR.properties

 

Core Hybrid OR.properties

 

Step11: Make package- com.selenium.logs

 

Core Hybrid Log Package

 

Step12: Implement logging under src folder

#Application Logs


#Application Logs

log4j.logger.devpinoyLogger=DEBUG, dest1

log4j.appender.dest1=org.apache.log4j.RollingFileAppender

log4j.appender.dest1.maxFileSize=5000KB

log4j.appender.dest1.maxBackupIndex=3

log4j.appender.dest1.layout=org.apache.log4j.PatternLayout

log4j.appender.dest1.layout.ConversionPattern=%d{dd/MM/yyyy HH:mm:ss} %c %m%n

log4j.appender.dest1.File=E:\\Tools\\Selenium\\ workspace\\Core_Hybrid_WebDriver\\src\\com\\selenium\\logs\\Application.log

#do not append the old file. Create a new log file everytime

log4j.appender.dest1.Append=false

 

Conclusion:

In the first part of this tutorial series, we learned about implementing core part of Hybrid (Keyword+Data Driven) Framework. In next part, we will learn about initializing config.properties, OR.properties, implement application-specific keywords, generic keywords, application constants etc.

Next tutorial: JUnit and Hybrid (Keyword+Data Driven) Framework – Part 2
 


⇓ Subscribe Us ⇓


If you are not a regular reader of this website then highly recommends you Sign up for our free email newsletter!! Sign up just providing your email address below:

Enter your email address:

Check email in your inbox for confirmation to get latest updates Software Testing for free.

Happy Testing!!!

Leave a Comment

Share This Post