Why So Negative?

Have you ever wondered why the world is such a bad place where nothing good ever seems to happen? All the news in the media seems to be bad. The world seems to be heading down the drain with people…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Selenium Automation Framework

Selenium Framework is a code structure that helps to make code maintenance easy. Without frameworks, we will place the “code” as well as “data” in the same place which is neither re-usable nor readable. Using Frameworks, produce beneficial outcomes like increased code re-usage, higher portability, reduced script maintenance cost, higher code readability, etc.

There are mainly three types of frameworks created by Selenium WebDriver to automate manual test cases:

In the data-driven framework, all of our test data is generated from some external files like Excel, CSV, XML or some database table.

To read or write an Excel, Apache provides a very famous library POI. This library is capable enough to read and write both XLS and XLSX file format of Excel.

We need a way to open the Excel sheet and read data from it within our Selenium test script. For this purpose, use the Apache POI library, which allows you to read, create and edit Microsoft Office-documents using Java. The classes and methods we are going to use to read data from Excel sheet are located in the org.apache.poi.hssf.usermodel package.

3) Place a Excel file in the above created package location and save it asTestData.xlsx. Fill the data in the excel like below image:

4) Add two constant variables (testData package path & Excel file name) in theConstant class.

5) Create a ‘New Class‘ file, by right click on the ‘utility‘ Package and select New> Class and name it as ‘ExcelUtils. First we will write basic read/write methods.

8) Once it finished open the Excel file and check for the result.

In the keyword-driven test framework, all the operations and instructions are Keyword Driven Framework is a type of Functional Automation Testing Framework which is also known as Table-Driven testing or Action Word based testing. The basic working of the Keyword Driven Framework is to divide the Test Case into four different parts. First is called as Test Step, second is Object of Test Step, third is Action on Test Object and fourth is Data for Test Object.

The above categorization can be done and maintained with the help of Excel spreadsheet:

Test Step: It is a very small description of the Test Step or the description of the Action going to perform on Test Object.
Test Object: It is the name of the Web Page object/element, like Username & Password.
Action: It is the name of the action, which is going to perform on any Object such as click, open browser, input etc.
Test Data: Data can be any value which is needed by the Object to perform any action, like Username value for Username field.

Hybrid Test framework is a concept where we are using the advantage of both Keyword and Data-driven framework.

Here for keywords, we will use Excel files to maintain test cases, and for test data, we can use data, provider of TestNG framework.

Here in our hybrid framework, we don’t need to change anything in Keyword driven framework, here we just need to replace ExecuteTest.java file with HybridExecuteTest.java file.

This HybridExecuteTest file has all the code for keyword driven with data provider concept.

The complete pictorial representation of hybrid framework will look like

So, We can create three types of test framework using Selenium WebDriver.These are Data Driven, Keyword Driven, and Hybrid test framework.We can achieve Data-driven framework using TestNG’s data provider.In Keyword driven framework, keywords are written in some external files like excel file and java code will call this file and execute test cases.The hybrid framework is a mix of keyword driven and data driven framework.

Add a comment

Related posts:

Menjelajah ke Siantar dan Danau Toba

Sebagai tanda keseriusan saya kepada Grace maka bulan November lalu saya berangkat ke rumah orang tua Grace dalam rangka memperkenalkan diri. Pergi ke pulau Sumatera Utara bukanlah pengalaman pertama…

Latest Advancements In Power Electronics.

Power electronics is a multidisciplinary technology that includes power semiconductor devices, converter circuits, electrical machines, signal electronics, control theory, microcomputers, VLSI…

Active and Passive Expression

Here we go with another heady topic so buckle your seatbelts, pull up your socks and remember your SAT/GRE words because here’s another theory… a GAME Theo — yeah… I’ll stop that. In deciding what to…