top of page

Selenium C# Tutorial: Introduction to automation framework

Updated: Mar 5

An automation testing framework is used to efficiently organize the code, allowing organizations to achieve more than their automation projects. By using such a framework, organizations can get more value as their code become:


A framework, once written, can be used in multiple projects, not limiting to one single project. By doing so, Eng teams can reduce the effort involved in re-writing the code as it is already available (there is no need to reinvent the wheel..).


Frameworks that are written should be scalable so they can be used from small to large projects involving multiple technologies/platforms.

Maintainable and Understandable

An automation framework should follow the same standards as any other coding project, which means that it must be well documented and track design patterns to be easy to maintain.

Types of frameworks

Different types of frameworks are available out there. The most commonly used automation testing frameworks are”

Data-driven framework

A data-driven framework is most relevant where the testing effort involves multiple and complex numbers of input test data (e.g., customer sign it form, which requires a lot of input data to be supplied by the user with multiple fields and permutations).

In the case of the data-driven framework, the test inputs are usually not implemented in the code itself. Instead, we use an external data source to import and use it in our tests (e.g., SQL, Excel, or XML).

Keyword-driven framework

In keyword-driven frameworks, the application objects and test data are coded within the C# class files (instead of using an external source). In this framework, each and every operation is represented as a keyword (e.g SendNotification(), Login(), etc).

Such a framework has excellent benefits as it is simple to maintain, edit, and add new test cases that will use the same keyword. However, using this framework demands more programming knowledge.

Hybrid framework

The hybrid framework combines the frameworks above as it allows programmers to pull data from external data sources and use keywords to perform operations.

Automation testing models

There are different models available that can be used to design and create a framework. The main models are:

Behavioral Driven Development (BDD)

BDD is based on Test Driven Development (TDD), and it aims to close the gap between engineering and business personals. Besides, it also bridges the gaps between testers and developers.

The main tools available to support BDD are SpecFlow (C#), Cucumber (Rubi), Jbehave (Java), and Freshen (PHP).

Page Object Model

In this model, each element in the UI is written in the code (in our case, it's C#) along with its unique identification property. A Pae Object models the objects within the test code. Using such a model reduces the amount of duplicated code and means that in any case of UI changes, the fix in code will only be applied in one place.

How should you learn selenium?

Like any other new technology, Code language, or anything you want to be good at, the best way is to practice practice and more practice! Learning selenium is a challenging task, but it’s no different from what you want to know.

All you need to do here to succeed is follow my series and practice the examples that I provide in your environment. Although it’s not a guaranty that you become an expert, it’s a great way that may help you become one.

The advantages of selenium

The software industry has some tremendous automated tools that can be used to automate your testing process; selenium is one of the best options available from this list. And why?

  • Selenium is one of the most common tools that organizations use today to automate their tests; learning selenium will open new doors and opportunities.

  • Selenium is a testing suite that answers the organization's testing needs.

  • Selenium is built to be agile enough to develop with almost all major programming languages (Perl, Ruby C# Etc.).

  • There is a vast community that shares knowledge with various Best practices, Articles, and Tutorials.

  • Selenium allows you to save time with your testing executions due to running test cases simultaneously.

  • Because it’s free… remember that you get some great benefits without spending your money.

  • Selenium can automate tests on all major browsers (Chrome, IE, Firefox, etc.).

25 views0 comments