design patterns - lfm and pom

14
Design Patterns - POM and LFM Leeds Sharp 27/08/2015 by John Staveley Page Object Model and Logical Functional Model For automated user testing Selenium, WatiN, CodedUI etc Increase maintainability and reduce brittleness of UI tests NB: I assume you've used a UI testing framework (we'll be using Selenium) from www.seleniumhq.org – a firefox addin

Upload: john-staveley

Post on 22-Jan-2018

538 views

Category:

Technology


2 download

TRANSCRIPT

Page 1: Design Patterns - LFM and POM

Design Patterns - POM and LFM

Leeds Sharp 27/08/2015 by John Staveley

Page Object Model and Logical Functional Model For automated user testing Selenium, WatiN, CodedUI etc Increase maintainability and reduce brittleness of UI tests NB: I assume you've used a UI testing framework (we'll be using Selenium) from www.seleniumhq.org – a

firefox addin

Page 2: Design Patterns - LFM and POM

A sample page to test

Page 3: Design Patterns - LFM and POM

Our test: The meaning of life, the universe and everything....

CF: Hitchhikers guide to the galaxy, computer at the end of the universe

Page 4: Design Patterns - LFM and POM

The meaning of life

6x7=42

Page 5: Design Patterns - LFM and POM

Export the test case

Page 6: Design Patterns - LFM and POM

Some maintenance issues

6+1-2=5 66/11=6 6*4=24 56-39=18 Any change to the number 6 breaks all of these tests

Page 7: Design Patterns - LFM and POM

Page Object Model

Create a class to represent the page Abstract away the operation of the web testing framework

Page 8: Design Patterns - LFM and POM

Page Object Model in a test

Page 9: Design Patterns - LFM and POM

Logical Functional Model (LFM)

Sits as a layer above POM Abstracts away further the implementation of interacting with

a page Increases reuse of your test code, particularly repeated

operations Enables less technical users to create tests

Page 10: Design Patterns - LFM and POM

LFM – Basic Example

Page 11: Design Patterns - LFM and POM

LFM – Bad example

Page 12: Design Patterns - LFM and POM

LFM = BDD

Page 13: Design Patterns - LFM and POM
Page 14: Design Patterns - LFM and POM

LFM