journey to 1000 tests a day

61
Journey to 1000 Tests a Day Bruce McLeod Tuesday, 15 November 11

Upload: teknologika

Post on 16-May-2015

1.793 views

Category:

Technology


2 download

DESCRIPTION

Automation has come a long way in the last 15 years. This presentation tells the story of my journey from no automation, to running in excess of 1000 tests a day. It shares my insights, failures, successes and lessons learned, so hopefully you can get there too.

TRANSCRIPT

Page 1: Journey to 1000 tests a day

Journey to 1000 Tests a DayBruce McLeod

Tuesday, 15 November 11

Page 2: Journey to 1000 tests a day

DISCLAIMER

The views and content presented in this presentationare my own and do not represent the views of any of my employers, past or present.

All content is copyright 2011 Bruce McLeod

Creative commons attribution for images is given at the end of this presentation

Tuesday, 15 November 11

Page 3: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 4: Journey to 1000 tests a day

Every journey has a first stepMy introduction to Test Automation

Tuesday, 15 November 11

Page 5: Journey to 1000 tests a day

Record and playback

Tuesday, 15 November 11

Page 6: Journey to 1000 tests a day

Huge gains compared to manual execution

• Win32 desktop application

• 5 different clients (95, 98 Beta, NT4, NT 351 and Citrix)

• 5 days work for 3 people could be done in 4 hours

• 97% efficiency improvement

Tuesday, 15 November 11

Page 7: Journey to 1000 tests a day

But there were problems

• Tests were not maintainable

• Spent days in maintenance and development

• They were brittle and fragile

• And when I left for my next job ...

Tuesday, 15 November 11

Page 8: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 9: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 10: Journey to 1000 tests a day

KindergartenThe early manual coding years

Tuesday, 15 November 11

Page 11: Journey to 1000 tests a day

Manual coding beginsTuesday, 15 November 11

Page 12: Journey to 1000 tests a day

A 2001 test automation recipe

Ingredients1 eager client 1 test application14 test automators

Tuesday, 15 November 11

Page 13: Journey to 1000 tests a day

A 2001 test automation recipe

MethodStep 1 : Write an automation “framework”Step 2 : Create a gui mapStep 3 : Write a testStep 4 : Repeat step 4 another 200 times

Tuesday, 15 November 11

Page 14: Journey to 1000 tests a day

Lessons learnt

• A Successful project• 200 tests automated in 6 months

• Team was a real dev. team with all the same issues• Versioning• Merging and branching• Coding standards• Individual differences in style and design

Tuesday, 15 November 11

Page 15: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 16: Journey to 1000 tests a day

ChildhoodThe innocent years of keyword testing

Tuesday, 15 November 11

Page 17: Journey to 1000 tests a day

What if we remove the need to code?

Tuesday, 15 November 11

Page 18: Journey to 1000 tests a day

Spreadsheets !!!Tuesday, 15 November 11

Page 19: Journey to 1000 tests a day

Keyword driven testing

Object Action DataTextfield (domain) Enter text <domain>

Textfield (username) Enter text <username>

Textfield (password) Enter text <password>Button (login) Click One left click

lObject - Action - data syntax

lAutomation libraries with excel front end

Tuesday, 15 November 11

Page 20: Journey to 1000 tests a day

Keyword driven testing• Advantages• Reduction in coding effort• “Anyone” can write tests!!

• Challenges• “Anyone” can write tests!!• Each implementation is custom• Maintenance effort moves from code into ...

Tuesday, 15 November 11

Page 21: Journey to 1000 tests a day

… Lots of Spreadsheets !!!Tuesday, 15 November 11

Page 22: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 23: Journey to 1000 tests a day

AdolescenceEmbracing open source

Tuesday, 15 November 11

Page 24: Journey to 1000 tests a day

Manual coding returnsTuesday, 15 November 11

Page 25: Journey to 1000 tests a day

Until …

Tuesday, 15 November 11

Page 26: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 27: Journey to 1000 tests a day

Unexpected benefits

• We could now use 1st generation developer tools• Visual Studio 2005• Version control• C# and .net instead of VBA

Tuesday, 15 November 11

Page 28: Journey to 1000 tests a day

Unexpected benefits

• Testers were now true peers to developers• Same tools• Same development language• Same recruitment process• Object oriented design

Tuesday, 15 November 11

Page 29: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 30: Journey to 1000 tests a day

A discovery & epiphany!The “braidy tester” blog posts

Tuesday, 15 November 11

Page 31: Journey to 1000 tests a day

The “sparkle” stack• Used to test Microsoft Expression• Key principles• Test cases written in customer view• Verification and data separated from tests• Application internals re-created in test code

Tuesday, 15 November 11

Page 32: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 33: Journey to 1000 tests a day

How can I execute 1000 tests a day ?

Tuesday, 15 November 11

Page 34: Journey to 1000 tests a day

Design goals

• Maintainability• Robustness• Performance• Maintainability• Rapid test development

Tuesday, 15 November 11

Page 35: Journey to 1000 tests a day

Maintainability

Tuesday, 15 November 11

Page 36: Journey to 1000 tests a day

Devs change stuffIt’s their job !

Tuesday, 15 November 11

Page 37: Journey to 1000 tests a day

Each action should occur onceand once only

Tuesday, 15 November 11

Page 38: Journey to 1000 tests a day

Each control should be mapped onceand once only

Tuesday, 15 November 11

Page 39: Journey to 1000 tests a day

Abstract the engineYou shouldn’t know what’s “under the bonnet”

Tuesday, 15 November 11

Page 40: Journey to 1000 tests a day

Robustness

Tuesday, 15 November 11

Page 41: Journey to 1000 tests a day

Tests should fail, not your tools.

Tuesday, 15 November 11

Page 42: Journey to 1000 tests a day

Embrace regex

Tuesday, 15 November 11

Page 43: Journey to 1000 tests a day

Leverage your vendor, and the community

Tuesday, 15 November 11

Page 44: Journey to 1000 tests a day

Performance

Tuesday, 15 November 11

Page 45: Journey to 1000 tests a day

CPU should be your bottleneck

Tuesday, 15 November 11

Page 46: Journey to 1000 tests a day

Never wait !Wait, don’t sleep

Tuesday, 15 November 11

Page 47: Journey to 1000 tests a day

Scale-out

Tuesday, 15 November 11

Page 48: Journey to 1000 tests a day

Rapid test development

Tuesday, 15 November 11

Page 49: Journey to 1000 tests a day

K.I.S.S

Tuesday, 15 November 11

Page 50: Journey to 1000 tests a day

Cheat !• Leverage an IDE

•Refactoring• Use code generation•Write less code• Use design patterns

Tuesday, 15 November 11

Page 51: Journey to 1000 tests a day

What about the future?

Tuesday, 15 November 11

Page 52: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 53: Journey to 1000 tests a day

Open source frameworks will consolidateDriven by adoption of webdriver

Tuesday, 15 November 11

Page 54: Journey to 1000 tests a day

More focus on mobile automationiOS, Android, Windows Phone

Tuesday, 15 November 11

Page 55: Journey to 1000 tests a day

Behaviour driven developmentWill become mainstream

Tuesday, 15 November 11

Page 56: Journey to 1000 tests a day

Given I am a logged in userWhen I have a valid credit cardAnd I have 1 click purchasing enabledThen I should see the message “your purchase was successful”And I should be re-directed to the home page.

Tuesday, 15 November 11

Page 57: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 58: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 59: Journey to 1000 tests a day

Automation is development.Hire, plan, develop and execute with that in mind.

Tuesday, 15 November 11

Page 60: Journey to 1000 tests a day

Tuesday, 15 November 11

Page 61: Journey to 1000 tests a day

Image attribution• Creative commons attribution credit is required for the

following users on flickr• seattlemunicipalarchives• mathias-erhart• jaffathecake• 28096801• loty• brilliantmichael

Tuesday, 15 November 11