the test pyramid

65
How to balance your test suite to have a good feedback, from units to end-to-end tests. Thiago Ghisi @thiagoghi si The Test Pyramid

Upload: thiago-ghisi

Post on 06-May-2015

1.543 views

Category:

Technology


5 download

DESCRIPTION

How to balance your automated test suite to have a good feedback, from units to end-to-end tests.

TRANSCRIPT

Page 1: The Test Pyramid

How to balance your test suite to have a good feedback, from units to end-to-end tests.

Thiago Ghisi@thiagoghisi

The Test

Pyramid

Page 2: The Test Pyramid
Page 3: The Test Pyramid
Page 4: The Test Pyramid

2002 2007 2010

Page 5: The Test Pyramid

Tests, seriously? It’s a mobile app...[ ]

Page 6: The Test Pyramid
Page 7: The Test Pyramid

Shared codebases108

Page 8: The Test Pyramid

Devs, QAs and Ops 144

Page 9: The Test Pyramid

Brian Marick@marick

January, 2009

http://www.slideshare.net/jezhumble/creating-maintainable-automated-acceptance-tests

Page 10: The Test Pyramid

Mike Cohn@mikewcohnOctober, 2009

http://www.slideshare.net/jezhumble/creating-maintainable-automated-acceptance-tests

Page 11: The Test Pyramid

http://www.slideshare.net/jezhumble/creating-maintainable-automated-acceptance-tests

Page 12: The Test Pyramid

Jez Humble@jezhumbleAugust, 2010

Page 13: The Test Pyramid
Page 14: The Test Pyramid

Feedback

Page 15: The Test Pyramid

Perfect!!! Let’s follow the test pyramid guidelines…[ ]

Page 16: The Test Pyramid
Page 17: The Test Pyramid
Page 18: The Test Pyramid
Page 19: The Test Pyramid

20% of code coverage. :-(

really hard to isolate the dependencies. :-(

easy. :-)

Page 20: The Test Pyramid

FunctionalTests • UI/End-to-end testing [with full

stack]

• Tests user flow

• BDD, ATDD

• Feedback after a coffee

business likes that ;)

sounds perfect

Page 21: The Test Pyramid

Cucumber feature file

Page 22: The Test Pyramid

Honeydew steps

Page 23: The Test Pyramid

Cucumber

Honeydew

wraps UIAutomator

step definitions in Ruby

+=]

https://github.com/amplify-education/honeydew

Page 24: The Test Pyramid

why cucumber?https://speakerdeck.com/nicholaspufal/why-bdd-is-misunderstood

Page 25: The Test Pyramid

Cool.. write as much user-like tests as you can… PERFECT!![ ]

Page 26: The Test Pyramid

UI test results history (1)

Page 27: The Test Pyramid

UI test results history (2)

Page 28: The Test Pyramid

UI test results history (3)

Page 29: The Test Pyramid

Flaky / Fragile

Slow

Costy

Page 30: The Test Pyramid

Feedback

Page 31: The Test Pyramid

the build monkey

Page 32: The Test Pyramid

http://watirmelon.com/tag/software-testing-pyramid/

Page 33: The Test Pyramid

Few UI tests

Page 34: The Test Pyramid

OK… let’s do it right now…[ ]

Page 35: The Test Pyramid

Unit Test

• Verify small pieces individually

• Run fast

• Stable

• Run a lot of times during development

• Feedback instantly

Page 36: The Test Pyramid

Unit tests results history

Page 37: The Test Pyramid

Feedback

Page 38: The Test Pyramid

Android? It’s Java, let’s TDD.

Page 39: The Test Pyramid

Android TDD

java.lang.RuntimeException: Stub!

Android SDK classes are not trivial

eyes on docs

huge API

Page 40: The Test Pyramid

test object

result()

assert(expected, obj.result())

Humm, I’ve seen that..

The ‘2 + 2 = 4’ example!

Page 41: The Test Pyramid

the object u’re looking at

dependencies

Page 42: The Test Pyramid

getData()

saveSomething()

Page 43: The Test Pyramid

getData()

saveSomething()

when(stub.getData()).thenReturn(data)

verify(mock).saveSomething()

Page 44: The Test Pyramid

http://martinfowler.com/articles/mocksArentStubs.html

mockstubdoublefake

dummy

Page 45: The Test Pyramid

Unit Testswith

Dependency injection

Roboguice

Robolectric

jUnit

DI

Mocks

Android Shadows

@Test

Page 46: The Test Pyramid

Lots of Unit tests

Page 47: The Test Pyramid

Where are you?

http://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid

Page 48: The Test Pyramid

http://fabiopereira.me/blog/2012/03/18/introducing-depth-of-test-dot/

Page 49: The Test Pyramid

external services

backend

libs

Page 50: The Test Pyramid

API contracts validation

PACTO

https://github.com/thoughtworks/pactohttps://speakerdeck.com/marcosccm/evoluindo-ecossistemas-com-consumer-driven-contracts

Page 51: The Test Pyramid

Service/Integration tests instead of end-to-end tests

Page 52: The Test Pyramid

Annnnd.. the manual tests?[ ]

Page 53: The Test Pyramid
Page 54: The Test Pyramid

Session based exploratory/usability

tests

Page 55: The Test Pyramid

http://blog.kalistick.com/Agile/harden-testing-pyramid/

Page 56: The Test Pyramid

http://watirmelon.com/2011/06/10/yet-another-software-testing-pyramid/

Page 57: The Test Pyramid

http://blog.softed.com/2013/08/26/1883/

Page 58: The Test Pyramid

UserJourney

UnitTests of single methods without dependencies

IntegrationTests of multiple integrated method

UI

Test automation

Testing on the level of the users - incl. browser, network, databases, external systems, …

Connection of UI tests to a persona like flow through

the system

$$$slowerfewer

$fastermore

closer to the user

closer to the developer

https://my.thoughtworks.com/docs/DOC-21002

Page 59: The Test Pyramid

http://www.slideshare.net/nashjain/inverting-the-testing-pyramid

Page 60: The Test Pyramid

http://www.slideshare.net/guestc8adce/pivotal-labs-open-view-presentation-quality-assurance-and-developer-testing-presentation

Page 61: The Test Pyramid

http://blog.codeclimate.com/blog/2013/10/09/rails-testing-pyramid/

Page 62: The Test Pyramid

Feedback

Page 63: The Test Pyramid

Feedback

Page 64: The Test Pyramid

http://herdingcats.typepad.com/my_weblog/2011/02/a-radical-book.html

Page 65: The Test Pyramid

Thank you! ;)

THIAGO GHISI@[email protected]

Questions?

Feedback?

A beer?