Test pyramid in an Android Agile Project - TDC2013

Post on 14-Jan-2015

815 views 1 download

Tags:

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 of 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

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

Shared  codebases  

15+  

Devs,  QAs  and  Ops    

40+  

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

   

Unit Test

•  Verify small pieces individually

•  Run fast

•  Run a lot of times during development

•  Feedback instantly

Feedback  

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

   

Android TDD

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

Android SDK classes are not trivial

eyes  on  docs  

huge  API  

test object

result()

assert(expected, obj.result())

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

the object u’re looking at

dependencies

getData()

saveSomething()

getData()

saveSomething()

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

verify(mock).saveSomething()

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

mock  stub  double  

Unit  Tests  with  

Dependency    injec:on  

Roboguice  

Robolectric  

jUnit  

DI  

Mocks  

Android  Shadows  

@Test  

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  

Cucumber

Honeydew

wraps UIAutomator

step definitions in Ruby

+ =]

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

Cucumber  feature  file  

Honeydew  steps  

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

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

Unit  tests  results  history  

UI  test  results  history  (1)  

UI  test  results  history  (2)  

Flaky      

Slow  

Costy  

Feedback    

the  build  keeper  

some  UI  tests    

Where  are  you?  

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

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

external  services  

backend  

libs  

API  contracts  validaJon  

PACTO  

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

Annnnd..  the  manual  tests?  [   ]  

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

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

Feedback  

Thank you! ;)

PORTELA @rafaelportela rportela@thoughtworks.com GHISI @thiagoghisi tghisi@thoughtworks.com

Questions? Feedback?

A beer?