Creating an Automated Testing Framework with Selenium and

  • Slides: 42
Download presentation
Creating an Automated Testing Framework with Selenium and Page Object Raluca Duduman Rom. Soft

Creating an Automated Testing Framework with Selenium and Page Object Raluca Duduman Rom. Soft 22 th of October 2016

Who this Presentation is For • QAs • Know the basics of an automation

Who this Presentation is For • QAs • Know the basics of an automation tool • Selenium Web. Driver • Already worked with Selenium in C#

Where to Start From • John Sonmez https: //www. pluralsight. com/courses/selenium • John Sonmez

Where to Start From • John Sonmez https: //www. pluralsight. com/courses/selenium • John Sonmez https: //www. pluralsight. com/courses/automated-testingframework-selenium

What this Presentation Covers • Testing types and why using BAT testing • Selenium

What this Presentation Covers • Testing types and why using BAT testing • Selenium architecture and basic info about Web. Driver • Page object architecture • A framework example • Demo

Types of Automation Testing Unit Testing Integration Testing Blackbox Automated Testing

Types of Automation Testing Unit Testing Integration Testing Blackbox Automated Testing

Unit Testing Unit testing tests the smallest unit of code in isolation

Unit Testing Unit testing tests the smallest unit of code in isolation

Integration Testing Integration testing tests units together, but still focuses on the code

Integration Testing Integration testing tests units together, but still focuses on the code

Blackbox Automated Testing (BAT) BATs test the system from the perspective of the user

Blackbox Automated Testing (BAT) BATs test the system from the perspective of the user

Why should we use BAT?

Why should we use BAT?

Regression “It worked yesterday!”

Regression “It worked yesterday!”

Requirements Traceability “The test explains what you agreed to: As an user, I want”

Requirements Traceability “The test explains what you agreed to: As an user, I want”

Combinatorial Testing “How many tests it would take? ”

Combinatorial Testing “How many tests it would take? ”

High Level Testing “Testing like the real user”

High Level Testing “Testing like the real user”

Brief History of Selenium

Brief History of Selenium

Selenium Web. Driver

Selenium Web. Driver

Find Elements • Firebug • Firepath • Web. Driver Locator

Find Elements • Firebug • Firepath • Web. Driver Locator

IWeb. Element

IWeb. Element

Automation Framework

Automation Framework

Separate Automation Framework

Separate Automation Framework

Page Object Model

Page Object Model

Page Object Model

Page Object Model

Page Pattern Use pages to model the functionality of the application

Page Pattern Use pages to model the functionality of the application

Tests

Tests

Which is Easier?

Which is Easier?

When running Tests… … consider how to run them and get output

When running Tests… … consider how to run them and get output

A Framework Example • Have a solution with 2 projects one for Tests and

A Framework Example • Have a solution with 2 projects one for Tests and one for Pages

A Framework Example – Setup Selenium • http: //ralucasuditusoftwaretesting. blogspot. ro/2015/01/seleniumwebdriver-in-visual-studio. html • http:

A Framework Example – Setup Selenium • http: //ralucasuditusoftwaretesting. blogspot. ro/2015/01/seleniumwebdriver-in-visual-studio. html • http: //ralucasuditusoftwaretesting. blogspot. ro/search/label/selenium

A Framework Example - Pages • Have a folder Pages that includes a class

A Framework Example - Pages • Have a folder Pages that includes a class page for every page in your application • Have a Flows folder that includes any flow operation related to your pages • Have an Utils folder where you write classes for your • Driver / Driver Extensions • Controls • Logs, etc. • Add other drivers here (chrome / ie) • In References add with Nu. Get Web. Driver and Web. Driver. Support packages

A Framework Example – Pages

A Framework Example – Pages

A Framework Example – Pages Driver • Browser Initialize (firefox, chrome, ie, etc. )

A Framework Example – Pages Driver • Browser Initialize (firefox, chrome, ie, etc. ) • Browser Close / Instance Close • Navigation • Read from app. config

A Framework Example – Pages Driver

A Framework Example – Pages Driver

A Framework Example – Pages Controls • Mouse events functions (click, double-click, right-click, drag

A Framework Example – Pages Controls • Mouse events functions (click, double-click, right-click, drag and drop, send keys) • Count elements • Get element text • Visibility (enabled, displayed) • Checkboxes • Dropdowns • Switch between alerts, windows, forms • String utils

A Framework Example – Pages Controls

A Framework Example – Pages Controls

A Framework Example – Pages – Driver Extension • Explicit wait for elements

A Framework Example – Pages – Driver Extension • Explicit wait for elements

A Framework Example - Flows • Have a folder Flows that includes a class

A Framework Example - Flows • Have a folder Flows that includes a class with flows in the application • Simple: working with selenium elements (clicks, send keys, etc. ) • Complex: multiple operations • Ideally, there should be no reference to Open. QA. Selenium

A Framework Example – Tests – app. config

A Framework Example – Tests – app. config

A Framework Example – Tests – Start • Setup, Teardown • Test. Case. Description

A Framework Example – Tests – Start • Setup, Teardown • Test. Case. Description

A Framework Example – Tests • Derive from Start class in order to use

A Framework Example – Tests • Derive from Start class in order to use setup and teardown • Call your functions from Flow classes • No reference to Open. QA. Selenium, no Web. Driver, Web. Driver. Support package

A Framework Example – Tests Example

A Framework Example – Tests Example

Raluca Duduman Rom. Soft 22 th of October 2016

Raluca Duduman Rom. Soft 22 th of October 2016

Codecamp Feedback https: //goo. gl/5 E 2 Mk 5 Room 10

Codecamp Feedback https: //goo. gl/5 E 2 Mk 5 Room 10