banner



automation framework design and development video series

Automation Framework Design and Development

Framework types, models, design, page object model in Java & C#

Sue Wild

What they are and why they're necessary?

An automation framework is a way to organise code so that it's reusable, scalable, easy to maintain and easy to understand. It should be comprehensible and therefore workable for those who haven't written it.

Scalable in this sense means that the framework should be able to work with multiple projects and also with multiple tools. The framework should support the use of multiple tools by allowing the user to switch between them in the config file.

Also the framework needs to be maintainable and house classes with their functionalities (e.g. methods) separately from the test project itself. The Page Object Model discussed below is the best mechanism to do this.

Types of Frameworks

There's 3 main types which are data driven frameworks, keyword driven frameworks and hybrid frameworks

Data Driven Frameworks

Data Driven frameworks are used when the tester needs to input a large amount of data into the tests in order to sufficiently check the application. Data is not hardcoded into the tests but pulled from data sources e.g. xml, excel, sql database table. This data is pulled in so that the test can check that the application UI is being successfully populated during data entry operations.

Keyword Driven Framework

A Keyword Driven framework is where each and every operation (e.g. method) is represented by a keyword e.g. SendEmail(), RegisterUser(), Logout(). It makes the code easy to modify, maintain and reuse. These methods can be used across the framework. Data tends to be hardcoded within the classes.

Hybrid Framework

A Hybrid framework is a combination of a data driven and keyword framework. A Hybrid framework pulls data from external sources and uses keywords to perform operations (e.g. clearly named methods).

Designing an Automation Framework

The video below takes a high level look at how to implement a design.

Designing Automation Framework — Part 4 (Automation Framework Design and Development Video Series)

Models

The two main types of models used to organise frameworks are Behaviour Driven Development and Page Object Model. At the moment I'm going to focus on Page Object Model. I'll take a look at Behaviour Driven Development at a later date.

Page Object Model

This is an extremely quick overview of the Page Object Model pattern. I go into further details in the post Page Object Model using Selenium so it would be worth taking a look.

Basically we know that each webpage UI consists of different objects (e.g. elements) that we want to interact with. When using the POM model Objects are located with their identification property, i.e. the attribute that you use to locate them and assigned to a WebElement. The WebElement is given a name so it can be easily accessed elsewhere in the application.

@FindBy (name ='q')
public WebElement TxtSeach;

or in C#

[FindsBy(How = How.Name, Using = "q")]
public IWebElement TxtSearch;

Page Object Model (in Java)

Again this is just a quick overview but hopefully these images will give you a sense of how it works.

The class below contains routes to our objects and the name assigned to that route. The constructor initialises the objects on the page.

The test then creates an instance of the above class allowing the objects to be accessed.

Page Object Model (in C#)

POM works exactly the same in C#. It just has a slightly different way of declaring the objects in terms of how their located

Below you can see that 'How' is used to state which attribute you're using to locate the element and then the "name" of the attribute is put in the using statement. This is all encased in FindsBy. It's a pretty neat and readable way of doing things. This information is stored in the class.

The class also needs a constructor to initialise these controls, as it does in Java.

Elements/ Objects and the attribute that you're using to locate them, assigned to an IWebElement

The objects above can then be accessed in the test by creating an instance of the class that they're located in i.e. in this case EAPageObject. This instance is then assigned a name which can then access the Objects/ IWebElements. Actions on the IWebElement can then be accessed.

It's a very streamlined way of doing things.

Thanks for reading!

automation framework design and development video series

Source: https://medium.com/@suewild2008/automation-framework-design-and-development-5f08c917a56d

Posted by: wallacesweves.blogspot.com

0 Response to "automation framework design and development video series"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel