test pyramid in an android agile project - tdc2013

40
Test Pyramid in an Android Agile Project How to balance your android test suite to have a good feedback, from units to end-to-end tests. PORTELA GHISI

Upload: thiago-ghisi

Post on 14-Jan-2015

811 views

Category:

Technology


1 download

DESCRIPTION

Slides created originally by @rafaelportela to Ágiles 2013 Perú and adapted to our presentation at TDC (The Developer's Conference) 2013 Porto Alegre. How to balance your android test suite to have a good feedback, from units to end-to-end tests.

TRANSCRIPT

Page 1: Test pyramid in an Android Agile Project - TDC2013

Test Pyramid in an

Android Agile Project

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

PORTELA GHISI

Page 2: Test pyramid in an Android Agile Project - TDC2013

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

Page 3: Test pyramid in an Android Agile Project - TDC2013

Shared  codebases  

15+  

Page 4: Test pyramid in an Android Agile Project - TDC2013

Devs,  QAs  and  Ops    

40+  

Page 5: Test pyramid in an Android Agile Project - TDC2013

h6p://mar:nfowler.com/bliki/TestPyramid.html  

Page 6: Test pyramid in an Android Agile Project - TDC2013

   

Unit Test

•  Verify small pieces individually

•  Run fast

•  Run a lot of times during development

•  Feedback instantly

Page 7: Test pyramid in an Android Agile Project - TDC2013

Feedback  

Page 8: Test pyramid in an Android Agile Project - TDC2013

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

Page 9: Test pyramid in an Android Agile Project - TDC2013

   

Android TDD

java.lang.Run:meExcep:on:  Stub!  

Android SDK classes are not trivial

eyes  on  docs  

huge  API  

Page 10: Test pyramid in an Android Agile Project - TDC2013

test object

result()

assert(expected, obj.result())

Humm,        I’ve  seen  that..    The  ‘2  +  2  =  4’                            example!    

Page 11: Test pyramid in an Android Agile Project - TDC2013

the object u’re looking at

dependencies

Page 12: Test pyramid in an Android Agile Project - TDC2013

getData()

saveSomething()

Page 13: Test pyramid in an Android Agile Project - TDC2013

getData()

saveSomething()

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

verify(mock).saveSomething()

Page 14: Test pyramid in an Android Agile Project - TDC2013

h6p://mar:nfowler.com/ar:cles/mocksArentStubs.html  

mock  stub  double  

Page 15: Test pyramid in an Android Agile Project - TDC2013

Unit  Tests  with  

Dependency    injec:on  

Roboguice  

Robolectric  

jUnit  

DI  

Mocks  

Android  Shadows  

@Test  

Page 16: Test pyramid in an Android Agile Project - TDC2013

Func:onal  Test  

•  UI testing [with full stack]

•  Tests user flow

•  BDD, ATDD

•  Feedback after a coffee

business  likes  that  ;)    

sounds  perfect  

*not  a  strict  defini:on  

Page 17: Test pyramid in an Android Agile Project - TDC2013

Cucumber

Honeydew

wraps UIAutomator

step definitions in Ruby

+ =]

github.com/amplify-­‐educa:on/honeydew  

Page 18: Test pyramid in an Android Agile Project - TDC2013

Cucumber  feature  file  

Page 19: Test pyramid in an Android Agile Project - TDC2013

Honeydew  steps  

Page 20: Test pyramid in an Android Agile Project - TDC2013

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

Page 21: Test pyramid in an Android Agile Project - TDC2013

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

Page 22: Test pyramid in an Android Agile Project - TDC2013

Unit  tests  results  history  

Page 23: Test pyramid in an Android Agile Project - TDC2013

UI  test  results  history  (1)  

Page 24: Test pyramid in an Android Agile Project - TDC2013

UI  test  results  history  (2)  

Page 25: Test pyramid in an Android Agile Project - TDC2013

Flaky      

Slow  

Costy  

Page 26: Test pyramid in an Android Agile Project - TDC2013

Feedback    

Page 27: Test pyramid in an Android Agile Project - TDC2013

the  build  keeper  

Page 28: Test pyramid in an Android Agile Project - TDC2013
Page 29: Test pyramid in an Android Agile Project - TDC2013

some  UI  tests    

Page 30: Test pyramid in an Android Agile Project - TDC2013

Where  are  you?  

h6p://www.mountaingoatsoXware.com/blog/the-­‐forgo6en-­‐layer-­‐of-­‐the-­‐test-­‐automa:on-­‐pyramid  

Page 31: Test pyramid in an Android Agile Project - TDC2013

h6p://fabiopereira.me/blog/2012/03/18/introducing-­‐depth-­‐of-­‐test-­‐dot/  

Page 32: Test pyramid in an Android Agile Project - TDC2013

external  services  

backend  

libs  

Page 33: Test pyramid in an Android Agile Project - TDC2013

API  contracts  validaJon  

PACTO  

h6ps://github.com/thoughtworks/pacto  h6ps://speakerdeck.com/marcosccm/evoluindo-­‐ecossistemas-­‐com-­‐consumer-­‐driven-­‐contracts  

Page 34: Test pyramid in an Android Agile Project - TDC2013

Annnnd..  the  manual  tests?  [   ]  

Page 35: Test pyramid in an Android Agile Project - TDC2013
Page 36: Test pyramid in an Android Agile Project - TDC2013

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

Page 37: Test pyramid in an Android Agile Project - TDC2013

http://lisacrispin.com/2011/11/08/using-the-agile-testing-quadrants/

Page 38: Test pyramid in an Android Agile Project - TDC2013
Page 39: Test pyramid in an Android Agile Project - TDC2013

Feedback  

Page 40: Test pyramid in an Android Agile Project - TDC2013

Thank you! ;)

PORTELA @rafaelportela [email protected] GHISI @thiagoghisi [email protected]

Questions? Feedback?

A beer?