Вы находитесь на странице: 1из 42

Creating an Automated

Testing Framework with


Selenium and Page Object
Raluca Duduman
RomSoft

22th of October 2016

Who this Presentation is For


QAs
Know the basics of an automation tool
Selenium WebDriver
Already worked with Selenium in C#

Where to Start From


John Sonmez
https://www.pluralsight.com/courses/selenium
John Sonmez
https://www.pluralsight.com/courses/automated-t
esting-framework-selenium

What this Presentation


Covers
Testing types and why using BAT
testing
Selenium architecture and basic info
about WebDriver
Page object architecture
A framework example
Demo

Types of Automation Testing

Unit Testing

Integration
Testing

Blackbox
Automated
Testing

Unit Testing

Unit testing tests the smallest unit of code in isolatio

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 use

Why should we use BAT?

Regression

It worked yesterday!

Requirements Traceability

The test explains what you agreed to: As an


user, I want

Combinatorial Testing

How many tests it would

High Level Testing

Testing like the real user

Brief History of Selenium

Selenium WebDriver

Find Elements
Firebug
Firepath
WebDriver Locator

IWebElement

Automation Framework

Separate Automation
Framework

Page Object Model

Page Object Model

Page Pattern
Use pages to model the
functionality of the
application

Tests

Which is Easier?

When running Tests

consider how to run them and get output

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

A Framework Example Setup Selenium


http://ralucasuditu-softwaretesting.blogspo
t.ro/2015/01/selenium-webdriver-in-visual-s
tudio.html
http://ralucasuditu-softwaretesting.blogspo
t.ro/search/label/selenium

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 NuGet WebDriver and
WebDriver.Support packages

A Framework Example Pages

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 - Controls
Mouse events functions (click, double-click, rightclick, 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 Driver Extension
Explicit wait for elements

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 OpenQA.Selenium

A Framework Example Tests


app.config

A Framework Example Tests


Start
Setup, Teardown
TestCaseDescription

A Framework Example Tests


Derive from Start class in order to use
setup and teardown
Call your functions from Flow classes
No reference to OpenQA.Selenium, no
WebDriver, WebDriverSupport package

A Framework Example Tests


- Example

Raluca Duduman
RomSoft

22th of October 2016

Codecamp

Feedback

https://goo.gl/5E2Mk5
Room 10