64
Selenium (You’re doing it wrong) Adam Goucher [email protected] @adamgoucher Thursday, April 7, 2011

You're doing it wrong

Embed Size (px)

DESCRIPTION

Selenium anti-patterns and how to start to address them.

Citation preview

Page 1: You're doing it wrong

Selenium(You’re doing it wrong)

Adam [email protected]

@adamgoucher

Thursday, April 7, 2011

Page 2: You're doing it wrong

General

Thursday, April 7, 2011

Page 3: You're doing it wrong

Thursday, April 7, 2011

Page 4: You're doing it wrong

I call my automation ‘tests’

Thursday, April 7, 2011

Page 5: You're doing it wrong

I call my automation ‘scripts’ or ‘checks’

I call my automation ‘tests’

Thursday, April 7, 2011

Page 6: You're doing it wrong

Thursday, April 7, 2011

Page 7: You're doing it wrong

My goal is to replace humans and push to production faster

Thursday, April 7, 2011

Page 8: You're doing it wrong

My goal is to let humans test higher quality builds with greater efficiency

My goal is to replace humans and push to production faster

Thursday, April 7, 2011

Page 9: You're doing it wrong

Se-IDE

Thursday, April 7, 2011

Page 10: You're doing it wrong

Thursday, April 7, 2011

Page 11: You're doing it wrong

I save my scripts recorded in Se-IDE

Thursday, April 7, 2011

Page 12: You're doing it wrong

I export my scripts recorded in Se-IDE

I save my scripts recorded in Se-IDE

Thursday, April 7, 2011

Page 13: You're doing it wrong

Thursday, April 7, 2011

Page 14: You're doing it wrong

I have locators in my scripts

Thursday, April 7, 2011

Page 15: You're doing it wrong

I have my locators in a user-extension

I have locators in my scripts

Thursday, April 7, 2011

Page 16: You're doing it wrong

Thursday, April 7, 2011

Page 17: You're doing it wrong

I use the default formatter

Thursday, April 7, 2011

Page 18: You're doing it wrong

I use a custom formatter

I use the default formatter

Thursday, April 7, 2011

Page 19: You're doing it wrong

Thursday, April 7, 2011

Page 20: You're doing it wrong

I email updates to formats and extensions

Thursday, April 7, 2011

Page 21: You're doing it wrong

I use a site-specific plugin

I email updates to formats and extensions

Thursday, April 7, 2011

Page 22: You're doing it wrong

Se-RC

Thursday, April 7, 2011

Page 23: You're doing it wrong

Thursday, April 7, 2011

Page 24: You're doing it wrong

My application is written in X so my scripts must be as well

Thursday, April 7, 2011

Page 25: You're doing it wrong

I write scripts the language that makes the most sense

My application is written in X so my scripts must be as well

Thursday, April 7, 2011

Page 26: You're doing it wrong

Thursday, April 7, 2011

Page 27: You're doing it wrong

I inherit from my framework’s TestCase class

Thursday, April 7, 2011

Page 28: You're doing it wrong

I have a custom class that my scripts inherit from (-- it inherits from my

framework’s TestCase class)

I inherit from my framework’s TestCase class

Thursday, April 7, 2011

Page 29: You're doing it wrong

Thursday, April 7, 2011

Page 30: You're doing it wrong

I have locators in my scripts

Thursday, April 7, 2011

Page 31: You're doing it wrong

I have my locators in a shared <thing>

I have locators in my scripts

Thursday, April 7, 2011

Page 32: You're doing it wrong

Thursday, April 7, 2011

Page 33: You're doing it wrong

I use ‘brittle’ locators

Thursday, April 7, 2011

Page 34: You're doing it wrong

I use good structural locators

I use ‘brittle’ locators

Thursday, April 7, 2011

Page 35: You're doing it wrong

Thursday, April 7, 2011

Page 36: You're doing it wrong

I have static data in my scripts

Thursday, April 7, 2011

Page 37: You're doing it wrong

I feed data externally into my scripts

I have static data in my scripts

Thursday, April 7, 2011

Page 38: You're doing it wrong

Thursday, April 7, 2011

Page 39: You're doing it wrong

Describing my scripts I use the word ‘and’

Thursday, April 7, 2011

Page 40: You're doing it wrong

Individual scripts do one thing only

Describing my scripts I use the word ‘and’

Thursday, April 7, 2011

Page 41: You're doing it wrong

Thursday, April 7, 2011

Page 42: You're doing it wrong

I use a ‘procedural’ scripting style

Thursday, April 7, 2011

Page 43: You're doing it wrong

Page Objects FTW!

I use a ‘procedural’ scripting style

Thursday, April 7, 2011

Page 44: You're doing it wrong

Thursday, April 7, 2011

Page 45: You're doing it wrong

I build suites of scripts

Thursday, April 7, 2011

Page 46: You're doing it wrong

I ‘tag’ my scripts and use my framework’s discovery methods

I build suites of scripts

Thursday, April 7, 2011

Page 47: You're doing it wrong

Thursday, April 7, 2011

Page 48: You're doing it wrong

My automation is different than the production code

Thursday, April 7, 2011

Page 49: You're doing it wrong

No. Its not.

My automation is different than the production code

Thursday, April 7, 2011

Page 50: You're doing it wrong

Thursday, April 7, 2011

Page 51: You're doing it wrong

I run my scripts from my local machine

Thursday, April 7, 2011

Page 52: You're doing it wrong

The CI server is my environment of record

I run my scripts from my local machine

Thursday, April 7, 2011

Page 53: You're doing it wrong

Se-Grid

Thursday, April 7, 2011

Page 54: You're doing it wrong

Thursday, April 7, 2011

Page 55: You're doing it wrong

I use Se-Grid for cross browser distribution

Thursday, April 7, 2011

Page 56: You're doing it wrong

I have browser specific jobs in CI

I use Se-Grid for cross browser distribution

Thursday, April 7, 2011

Page 57: You're doing it wrong

Thursday, April 7, 2011

Page 58: You're doing it wrong

I have my own Se-Grid

Thursday, April 7, 2011

Page 59: You're doing it wrong

To the Cloud!

I have my own Se-Grid

Thursday, April 7, 2011

Page 60: You're doing it wrong

And finally...

Thursday, April 7, 2011

Page 61: You're doing it wrong

Thursday, April 7, 2011

Page 62: You're doing it wrong

I will blindly implement what Adam says

Thursday, April 7, 2011

Page 63: You're doing it wrong

I will use my brain and use what works for me and ignore what doesn’t

I will blindly implement what Adam says

Thursday, April 7, 2011

Page 64: You're doing it wrong

Thanks!

Thursday, April 7, 2011