top of page
hand-businesswoman-touching-hand-artificial-intelligence-meaning-technology-connection-go-

Selenium Framework


Introduction

As we all know, the framework is a platform for developing software applications. The Selenium Framework is a code structure that makes code maintenance easy and efficient. Without frameworks, users may place the “code” and “data” at the same location which is neither reusable nor readable. Frameworks produce beneficial outcomes:


1. Increased code reusability

2. Higher portability

3. Reduced cost of script maintenance.

4. Easy to debug.

5. It could run the tests directly on the target browser, drive the interactions on the required web page and rerun them without any manual input.


Understanding Selenium Framework

The biggest sweet spot that Selenium has is that it is open, which means that it is completely free to download and use. It provides an API called as WebDriver. It enables testers to craft their tests in many programming languages such as Java, Python, and C#. Though this framework is primarily used to test web browsers, it can be used to automate mobile devices like Android and iOS. The Selenium WebDriver supports major browsers which include, Chrome, Mozilla, and Internet Explorer.


Why do we need the Selenium Framework?

Selenium Framework’s code structure helps in making code maintenance very easy. The positive outcome of using a framework is high portability. Reduce script maintenance cost, increase in code re-usage, and higher code readability.

Reduced tests’ time execution and human resources required.

Complete control over the tests’ results.

Altering the test’s pre-parameters along with the data that was given, along with again testing it with other sets of data in a dynamic fashion.

Types of Frameworks in Selenium

Selenium frameworks based on the functional approach are classified into three main types:

· Data-driven framework

· Keyword-driven framework

· Hybrid framework

Let’s understand each framework then we can decide which is a suitable framework for our project.


Data Driven Framework

This framework is one of the most popular and demanding in the field of testing today. If you intend to perform manual testing and try maintaining all the records all by yourself, it will not be just frustrating but will also create a lot of confusion. That’s where a data-driven framework comes in, it allows users to save all the data in a single place (preferably MS Excel). This will not only save time but will also allow running those test cases using different sets of data, some positive factors of data-driven framework:

· Just because all the tests are being maintained separately so it becomes much easier to modify test scripts as and when required.

  • A tester will eventually save more time because it allows for performing tests on a large scale.

  • From a coding point of view, it’s not that required in this, you can easily apply a single test for all the data sets available in the table without needing to modify each code.

2. Keyword Driven Framework


Keyword Driven Testing is a scripting technique that uses data files to contain the keywords related to the application being tested. These keywords describe the set of actions that are required to perform a specific step. Keyword Driven Framework is a functional automation testing framework that divides test cases into four different parts which are test cases, objects, and data for test. All the operations and instructions to be performed are written in some external file like an Excel sheet.


Example of keywords

Keywords

Description

Login

Login to the application

Emails

Send Email

logouts

Log out from the application

Notifications

Find unread notifications


In order to create a Keyword driven framework, we need the following things

1. Excel Sheet– Identify the keywords and store them in an Excel sheet

2. Function Library– The function library consists of the function for the business flows ( login button for any website). So when the test is executed, it will read the keyword from the Excel sheet and call the functions accordingly

3. Data Sheets– Datasheets are used to store the test data that will be used in the application

4. Object Repository– based on your keyword-driven framework you can use an object repository

5. Test Scripts– Based on the design of your framework, you can have test scripts for each manual Test Case or a single driver script

So, we can say that why we need Keyword Driven Testing because, In Software Engineering, Keyword Driven Testing is done due to the following reason

  • Common components handled by the standard library

  • Using this approach tests can be written in a more abstract manner

  • A high degree of reusability

  • The detail of the script is hidden from the users

  • Users don’t have to use the scripting languages

  • The test is concise, maintainable, and flexible

The major activities involved in keyword-driven testing are

  • Step 1. Identifying low-level as well as high-level keywords

  • Step 2. Implementing the keywords as executable

  • Step 3. Creating test cases

  • Step 4. Creating the driver scripts

  • Step 5. Executing the automation test scripts

Advantages of Keyword-Driven Testing

  • It allows functional testers to plan test automation before the application is ready

  • Tests can be developed without programming knowledge

  • It is not dependent on a specific programming language or tools

  • Compatible with any automation tools available in the market

Hybrid Framework

Hybrid Driven Framework is a combination of data-driven and keyword-driven frameworks. This framework uses different keywords and data sets, where the inputs and functions list are stored in separate files. Keywords are maintained in a separate Java class file and test data can be maintained either in a properties file or an excel file or can use the data provider of a TestNG framework.

Hybrid Driven framework is mostly used by manual testers who don’t have much knowledge of programming languages. Such people can just have a look at the Keywords, Test data, and Object repository and start creating the test case right away, without having to code anything in the framework.

Let’s check out some additional features of the hybrid test automation framework:

· It allows ease of installation and maintenance.

· In a hybrid test framework, the consistency of test automation is being implemented by defining standards

· Hybrid allows the user in tool independence by implementing your framework as separate software

A hybrid Framework can be created and used to automate any application.

· It will reduce the man-hours spent in scripting the automation code since a framework once created can be used to automate multiple applications.


Components Of Hybrid-Driven Framework

Components of the Hybrid Framework are similar to the components of the Keyword Driven Framework wherein every Test Data, as well as the Keywords, are externalized making the script appear in a more generalized form

· Function Library

· Excel Sheet to store Keywords

· Design Test Case Template

· Object Repository for Elements/Locators

· Test Scripts or Driver Script


Frameworks in Detail

To understand the above, we should first start with the definition of the framework. The framework can be defined as a set of rules or best practices that are followed to achieve desired results.

Below mentioned are the components or tools of the Framework:

· Programming Language: Java + Selenium.

· IDE: Eclipse: It is an integrated development environment (IDE) for Java. This Eclipse IDE is the most popular product of the Eclipse Open Source project.

· Testing Framework: TestNG Inspired by JUnit and NUnit, TestNG is a testing framework. The new extended functionalities of TestNG have made it more powerful and easier compared to other testing frameworks. It also supports reporting, which is a simple HTML reporting plug-in and XLST plug-ins. This serves the purpose of customizing or extending the default TestNG reporting style. Also, it provides the ability to implement ‘reporter’, an interface that can be implemented to generate customized TestNG reports. The ‘generateReport()’ method functions after all the other suites have completed their execution and give the report to the specified output directory.

· Continuous Integration: Jenkins.

File Formats are used in the Framework:

· Properties File: Properties file is used to store and retrieve the UI elements of an application or a website

and data set file paths. It also contains the id of the elements, name, XPath, or the CSS selector.

· Excel Files: These files are used to pass multiple sets of data to the application.

· Xml File: This file is used to execute the test scripts. Xml files execute these scripts based on the package

or classes or Tests mentioned in it.

How to Build a Framework?

It is necessary to go through these points while developing a Selenium Framework:

· Choosing a Programming Language: These languages include Java, C#, Ruby, Python, etc.

In addition, Behaviour-Driven Development (BDD) could be used for executing small or short-term projects.

· Choosing a Unit Test Framework: One must select a unit test framework that would act as the base

like TestNG, which is amongst the renowned unit test framework. It eliminates most of the limitations

of the traditional framework and offers developers the ability to script more flexible and powerful tests.

· Designing the Framework’s Architecture: This includes building the “Selenium Core” component as well

as building the “Selenium Test” component.

· Choosing a Reporting Mechanism: An efficient reporting mechanism can convert the test results into

inputs that are instrumental in producing immediate corrective actions.

· Deciding how to Build, Version Control, and Implement CI/CD: This includes the Build tool and

dependency managers used by the framework. The automation should focus on collaborating and

sharing source code with one another. Implement well-known CI systems like Jenkins, Bamboo, TFS, etc.

· Integrating Framework with the other Tools: Integrate the framework with the help of tools like

nAutoIT, TestRail, Jira, etc.

Conclusion

A framework is basically used to automate the testing work. These tests include testing methods like smoke testing and others. Testing can be done on web-applied applications, mobile applications, and even desktops. It has been clearly established that the Selenium Framework is a kind of code structure that helps in making code maintenance easy. In simpler words, Selenium is a program or coding structured to conduct various testing programs easily and automatically. The greatest advantage of using the selenium frame is its agility in testing.


Hope you got a good idea selenium framework. Thank you for reading.

Happy Testing!!

29 views0 comments

Коментарі

Оцінка: 0 з 5 зірок.
Ще немає оцінок

Додайте оцінку
bottom of page