03.21.18 crossing the streams - stpcon...3/23/2019 1 crossing the streams multi –platform...

23
3/23/2019 1 Crossing The Streams Multi – Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy Magenic Technologies 4 years Automation Lead Mobile Enthusiast Mobile Hardware Repair Mobile Developer Mobile Automation Chronic Early Adopter Notorious Edge Case 1 2

Upload: others

Post on 03-Aug-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

1

Crossing The Streams

Multi – Platform Framework Design

Jason Edstrom

03.21.18

2

About This Guy

• Magenic Technologies

• 4 years

• Automation Lead

• Mobile Enthusiast

• Mobile Hardware Repair

• Mobile Developer

• Mobile Automation

• Chronic Early Adopter

• Notorious Edge Case

1

2

Page 2: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

2

3

Mobile Application Types» Native

› iOS− Objective C− Swift

› Android− Kotlin− Java

» Translated› React Native, Xamarin, Flutter

» Hybrid› Some or All HTML in an app package› PhoneGap, Cordova, Ionic

» Web

4

Criteria» Shared/Single Test Class

» Cross Platform

» Application Divergence

» Performance

» Shared Code

3

4

Page 3: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

3

5

Stretch Goals» Readability

› Diagramming

› Test

› Page Object

» Design Consistency Enforcement

» Use Object Oriented Principles

» Traceability

› All errors are happening in the class context that is relevant

» Not just Application divergence, but device type divergence

6

Design Scenarios» Split Framework

» Conditional Page Models

» Page Factory

» Abstract Parent

5

6

Page 4: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

4

Split Framework“You stay on your side of the room and I’ll stay on my side”

8

Split Framework - Single Test Case

Android Test Class iOS Test Class

7

8

Page 5: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

5

9

Split Framework – Cross Platform

Test Runner Test Class

10

Split Framework – Application Divergence

9

10

Page 6: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

6

11

Split Framework - Performance

ClickElement()FindElement() elementClick()

12

Split Framework – Shared Code

11

12

Page 7: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

7

13

» Out of the Box Platform Specific Tests

» Abstraction is not required for UX divergence

» Enforced Single Responsibility on Test and Page Object level

Split Framework - Benefits

14

» Test Coverage Desync

» Reporting the test results becomes a separate test point

› Test Point – attributes of test

− Platform

− Version

− App Version

» Code Sharing is painful

› High Number of static methods

› Duplicated code everywhere

Split Framework - Consequences

13

14

Page 8: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

8

15

Split Framework ChecklistSingle Test Class - No

Cross Platform - Meh

App Divergence - Yes

Performance - Yes

Shared Code - No

Conditional Page Model“10 gallons of stuff in a 5 gallon bucket”

15

16

Page 9: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

9

17

Conditional Page Model - Single Test Case

Android Test Class

iOS Test Class

18

Conditional Page Model - Cross Platform

17

18

Page 10: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

10

19

Conditional Page Model - Application Divergence

20

Conditional Page Model - Performance

ClickElement()FindElement()

element

Click()

19

20

Page 11: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

11

21

Conditional Page Model - Shared Code

22

» Test reporting becomes a run configuration detail

» Page Object Models have more shared code

» Page Object Models can primarily use the parent driver

» Test Coverage stays consistent across platforms

Conditional Page Model - Benefits

21

22

Page 12: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

12

23

Conditional Page Model - Consequences

» Extra work needed for Platform Specific tests

» Page Object Models stop respecting Single Responsibility

› Platform Specific drivers

› Platform Specific methods

› Platform Specific selectors

» Conditional statement at every instance of UX Divergence

› Which has the high probability of being every selector

24

Conditional Page Model» Single Test Class - Yes

» Cross Platform - Yes

» App Divergence - Meh

» Performance - Yes

» Shared Code - Meh

23

24

Page 13: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

13

Page Factory“Buying a Papa Johns store when all you want is a slice of pizza”

26

Page Factory - Single Test Case

Android Test Class

iOS Test Class

25

26

Page 14: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

14

27

Page Factory - Cross Platform

28

Page Factory – Application Divergence

27

28

Page 15: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

15

29

Element 4Element 3Element 2Element 1Click()FindElement()

Page Factory - Performance

ClickElement()FindElement()FindElement()FindElement()

Selector 1

Selector 2

Selector 3

Selector 4

PageFactory.initElements()

30

Page Factory – Performance - Local

Appium Server

Web Driver Agent

Framework

29

30

Page 16: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

16

31

Page Factory – Performance - Cloud

Appium Server

Web Driver Agent

FrameworkSelenium Grid Server

32

Page Factory – Shared Code

31

32

Page 17: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

17

33

» Test reporting stays a run configuration detail

» Page Object Models continue to have more shared code

» Page Object Models rely on web elements more than the driver

› Elements start being agnostic

» Test Coverage stays consistent across platforms

Page Factory - Benefits

34

Page Factory - Consequences

» Extra work needed for Platform Specific tests

» Conditional statement at every instance of UX Divergence

› But mostly in functional workflow

» Dynamic UI Changes will cause high maintenance or inflated execution time

› Stale Elements

› Thread Sleeps

» Execution time becomes bloated because of how Page Factory operates

» Page Factory uses complex method calls to provide elements

» Device divergence becomes difficult.

33

34

Page 18: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

18

35

Page Factory» Single Test Class - Yes

» Cross Platform - Yes

» App Divergence – Meh

» Performance - No

» Shared Code – Meh

Abstract Parent“Pay no attention to the man behind the curtain”

35

36

Page 19: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

19

37

Abstract Parent - Single Test Case

Android Test Class

iOS Test Class

38

Abstract Parent - Cross Platform

A

37

38

Page 20: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

20

39

Abstract Parent - Application Divergence

A

40

Abstract Parent - Performance

A

39

40

Page 21: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

21

41

Abstract Parent - Shared Code

A

A

42

» Test reporting stays a run configuration detail

» Page Object Model flow becomes an app blueprint

› Parent abstract class holds shared code

› Platform specific code remains in the child classes

» Test Coverage stays consistent across platforms

» Single Responsibility is respected

» Abstraction allows for App and Device divergence

› Readability is improved by taking some tricks from BDD tools

» Maintenance is reduced because errors will lead you to whether issue is platform specific or common workflow

» Abstract methods help enforce consistency

Abstract Parent- Benefits

41

42

Page 22: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

22

43

Abstract Parent- Consequences

» Extra work needed for Platform Specific tests

» Larger framework asset count because of using at least 3 page models per view

» Depending on language used, sharing code in the parent can create a small anti-pattern.

› Specifically, scripting vs compiled languages

44

Abstract Parent» Single Test Class - Yes

» Cross Platform - Yes

» App Divergence - Yes

» Performance - Yes

» Shared Code - Yes

43

44

Page 23: 03.21.18 Crossing The Streams - STPCon...3/23/2019 1 Crossing The Streams Multi –Platform Framework Design Jason Edstrom 03.21.18 2 About This Guy •Magenic Technologies •4 years

3/23/2019

23

45

Q & A Time!

877.277.1044 / magenic.com // 46

THANK YOU

45

46