SlideShare a Scribd company logo
Continous UI testing
by
with Espresso and Jenkins
Sylwester Madej
Founder & Head Developer
@smdremedy
#droidconZG
sylwester.madej@byoutline.com
byoutline.com
2
This is a story of
my team's journey
...jurney to CI/CD
We are a small team
...jurney to CI/CD
We are a small team
- we are looking for things to be cost effective
- not a perfect solution, but a decent one
What we have gained
- better, more agile work flow
- no more Commit and run situations
- way to check UI on many configurations
- less regression bugs
- higher code quality
We started with tests
- JVM tests (finally works in AS)
- Robolectric
- Instrumentation
We wanted more from VCS
- Use DVCS
- Gitflow = git++
- Branch per feature, tag per release
Static code analysis
- FindBugs
- PMD
- Checkstyle
- SonarCube
Continous Integration checklist
- gitflow ✔
- unit tests ✔
- code coverage ✔
- static analysis ✔
- build with one command ✔
We needed our CI server
- Jenkins
- Travis
- Circle CI
- TeamCity
- Bamboo...
Why Jenkins?
- free of change, but not of hustle
- great community
- can be hosted on any device
- hundreds of plugins
Where to host it?
- CloudBees.com
- VPS: s3, digital ocean
- bare metal
Perfect local Jenkins machine
- good price/performance (i5, ssd, ram)
- energy effective
- quiet
- small
Candidates:
- Intel NUC (7W idle)
- Mac Mini
CI setup
Ubuntu
- apt-get install
- sdk install (Android Plugin don't install everything)
- kvm
- plugins (Chuck Norris, Lint Publisher, jacoco...)
First easy win
- create new project
- add git with credentials
./gradlew build test jacoco
You get:
- compilation check
- lint check
- unit tests with code coverage
We wanted more
Instrumentation tests
- Robotium
- Appium
- Espresso
- UI Automator
Some Espresso
Great way to test UI, and do integration tests
Api from developers to developers
onView(Matcher)
.perform(ViewActions)
.check(ViewAssertions)
More on Maciej's speach at 12:00:
„Expressive functional testing with Espresso”
How to test API?
Mock/stub API classes
- Dagger FTW
- works great with Retrofit
How to test API?
MockWebServer
- set HTTP mock for one test
- Square Quality™, build upon OkHttp
- mock calls, verify where they called
How to test API?
AndroidStubServer
- HTTP server build in your APK (good for integration testing )
- can be sent to client within app
simple config:
{
"method": "GET",
"path": "/books",
"response file": "books.json"
}
https://github.com/byoutline/AndroidStubServer
Where to run Instrumentation tests?
- androd emulators (x86 if possible)
- genymotion
- real devices
Start simple
- create job with single emu
- use Android Emulator Plugin for configuration
- start instrumentation tests in gradle
./gradlew connectedCheck
Enter the matrix
- create Multi-configuration project
- exclude combinations
Need a Spoon for your Espresso?
- great tool from Square (duh !)
- run instrumentation tests on multiple devices in parallel
- external plugin to run with gradle
https://github.com/stanfy/spoon-gradle-plugin
- connect your devices to CI server with USB hub
- generates nice looking reports
One step further - Continous Delivery
- your code is tested and ready to meet the world
- create new job to deploy to distibution channel
Crashlytics
Google Play Alpha/Beta
- start after succesful build or manualy
When we need more devices
Devices in the cloud
- AppThwack
- TestDroid...
Bonus:
Some free Intel devices
How to make it even better?
Genymotion on server
http://www.slideshare.net/vishyrich/genymotion-with-jenkins
BDD with Calabash
Black box testing
calabash-android gen
write specification with Gherkin DSL
Scenario: As a valid user I can log into my app
When take picture
When I press "Login"
Then I see "Welcome to coolest app ever"
Then take picture
calabash-android run APK
Works great with AndroidStubServer!
Sylwester Madej
Founder & Head Developer
@smdremedy
sylwester.madej@byoutline.com
byoutline.com
3
0

More Related Content

What's hot

Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
KMS Technology
 

What's hot (20)

Selenium
SeleniumSelenium
Selenium
 
Introduction cypress
Introduction cypressIntroduction cypress
Introduction cypress
 
Using Mockito
Using MockitoUsing Mockito
Using Mockito
 
Setting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation FrameworkSetting up Page Object Model in Automation Framework
Setting up Page Object Model in Automation Framework
 
Behavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using CucumberBehavior Driven Development and Automation Testing Using Cucumber
Behavior Driven Development and Automation Testing Using Cucumber
 
Angular 16 – the rise of Signals
Angular 16 – the rise of SignalsAngular 16 – the rise of Signals
Angular 16 – the rise of Signals
 
SwiftUI For Production | try! Swift 2019
SwiftUI For Production | try! Swift 2019SwiftUI For Production | try! Swift 2019
SwiftUI For Production | try! Swift 2019
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
TOTVS - Agile Testing e a Importância de se ter Estratégia de Testes
TOTVS - Agile Testing e a Importância de se ter Estratégia de TestesTOTVS - Agile Testing e a Importância de se ter Estratégia de Testes
TOTVS - Agile Testing e a Importância de se ter Estratégia de Testes
 
Ui test 자동화하기 - Selenium + Jenkins
Ui test 자동화하기 - Selenium + JenkinsUi test 자동화하기 - Selenium + Jenkins
Ui test 자동화하기 - Selenium + Jenkins
 
Rest Assured
Rest AssuredRest Assured
Rest Assured
 
CSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, LinzCSS Grid Layout for Topconf, Linz
CSS Grid Layout for Topconf, Linz
 
Automated Testing with Agile
Automated Testing with AgileAutomated Testing with Agile
Automated Testing with Agile
 
Making Testing Easy w GitHub Copilot.pdf
Making Testing Easy w GitHub Copilot.pdfMaking Testing Easy w GitHub Copilot.pdf
Making Testing Easy w GitHub Copilot.pdf
 
Browser_Stack_Intro
Browser_Stack_IntroBrowser_Stack_Intro
Browser_Stack_Intro
 
Automation With A Tool Demo
Automation With A Tool DemoAutomation With A Tool Demo
Automation With A Tool Demo
 
Test Automation Interview Questions and Answers | Edureka
Test Automation Interview Questions and Answers | EdurekaTest Automation Interview Questions and Answers | Edureka
Test Automation Interview Questions and Answers | Edureka
 
Introduction to E2E in Cypress
Introduction to E2E in CypressIntroduction to E2E in Cypress
Introduction to E2E in Cypress
 
How we reduced logs costs by moving from Elasticsearch to Grafana Loki
How we reduced logs costs by moving from Elasticsearch to Grafana LokiHow we reduced logs costs by moving from Elasticsearch to Grafana Loki
How we reduced logs costs by moving from Elasticsearch to Grafana Loki
 
Automation testing & Unit testing
Automation testing & Unit testingAutomation testing & Unit testing
Automation testing & Unit testing
 

Viewers also liked

Viewers also liked (20)

Genymotion with Jenkins
Genymotion with JenkinsGenymotion with Jenkins
Genymotion with Jenkins
 
Testing android apps with espresso
Testing android apps with espressoTesting android apps with espresso
Testing android apps with espresso
 
No more waiting for API - Android Stub Server
No more waiting for API - Android Stub ServerNo more waiting for API - Android Stub Server
No more waiting for API - Android Stub Server
 
Automated android testing using jenkins ci
Automated android testing using jenkins ciAutomated android testing using jenkins ci
Automated android testing using jenkins ci
 
Ui testing with espresso
Ui testing with espressoUi testing with espresso
Ui testing with espresso
 
Espresso testing
Espresso testingEspresso testing
Espresso testing
 
自動テストとJenkinsの活用 公開版
自動テストとJenkinsの活用 公開版自動テストとJenkinsの活用 公開版
自動テストとJenkinsの活用 公開版
 
Android Espresso
Android EspressoAndroid Espresso
Android Espresso
 
Automated UI Testing Frameworks
Automated UI Testing FrameworksAutomated UI Testing Frameworks
Automated UI Testing Frameworks
 
Gr8conf - Griffon Update
Gr8conf - Griffon UpdateGr8conf - Griffon Update
Gr8conf - Griffon Update
 
Jenkins & Selenium
Jenkins & SeleniumJenkins & Selenium
Jenkins & Selenium
 
Build Automation in Android
Build Automation in AndroidBuild Automation in Android
Build Automation in Android
 
20141120 ぬるぬる動くandroid tips
20141120 ぬるぬる動くandroid tips20141120 ぬるぬる動くandroid tips
20141120 ぬるぬる動くandroid tips
 
Unity Cloud Buildの使い方
Unity Cloud Buildの使い方Unity Cloud Buildの使い方
Unity Cloud Buildの使い方
 
Metrics to guide: agile fluency, continuous delivery and product teams
Metrics to guide: agile fluency, continuous delivery and product teamsMetrics to guide: agile fluency, continuous delivery and product teams
Metrics to guide: agile fluency, continuous delivery and product teams
 
Automated Testing and Continuous Integration for Mobile Apps: Jenkins & Cloud...
Automated Testing and Continuous Integration for Mobile Apps: Jenkins & Cloud...Automated Testing and Continuous Integration for Mobile Apps: Jenkins & Cloud...
Automated Testing and Continuous Integration for Mobile Apps: Jenkins & Cloud...
 
超便利! Unity Cloud Build の使い方
超便利! Unity Cloud Build の使い方超便利! Unity Cloud Build の使い方
超便利! Unity Cloud Build の使い方
 
Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous Deployment
 
Packaging Your Story: Social Media for B2Bs
Packaging Your Story: Social Media for B2BsPackaging Your Story: Social Media for B2Bs
Packaging Your Story: Social Media for B2Bs
 
RightScale Webinar: Continuous Integration and Delivery in the Cloud - How Ri...
RightScale Webinar: Continuous Integration and Delivery in the Cloud - How Ri...RightScale Webinar: Continuous Integration and Delivery in the Cloud - How Ri...
RightScale Webinar: Continuous Integration and Delivery in the Cloud - How Ri...
 

Similar to Continous UI testing with Espresso and Jenkins

Similar to Continous UI testing with Espresso and Jenkins (20)

Serverless in production (O'Reilly Software Architecture)
Serverless in production (O'Reilly Software Architecture)Serverless in production (O'Reilly Software Architecture)
Serverless in production (O'Reilly Software Architecture)
 
Serverless in production, an experience report
Serverless in production, an experience reportServerless in production, an experience report
Serverless in production, an experience report
 
Serverless in production, an experience report (linuxing in london)
Serverless in production, an experience report (linuxing in london)Serverless in production, an experience report (linuxing in london)
Serverless in production, an experience report (linuxing in london)
 
Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)Serverless in production, an experience report (FullStack 2018)
Serverless in production, an experience report (FullStack 2018)
 
Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...
Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...
Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...
 
Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)Serverless in production, an experience report (JeffConf)
Serverless in production, an experience report (JeffConf)
 
Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)Serverless in Production, an experience report (AWS UG South Wales)
Serverless in Production, an experience report (AWS UG South Wales)
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
 
Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)Serverless in production, an experience report (Going Serverless)
Serverless in production, an experience report (Going Serverless)
 
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 -  Fullstack end-to-end Test Automation with node.jsForwardJS 2017 -  Fullstack end-to-end Test Automation with node.js
ForwardJS 2017 - Fullstack end-to-end Test Automation with node.js
 
High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014High productivity web development workflow - JavaScript Meetup Saigon 2014
High productivity web development workflow - JavaScript Meetup Saigon 2014
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
 
The future of paas is serverless
The future of paas is serverlessThe future of paas is serverless
The future of paas is serverless
 
Node.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.jsNode.js Development Workflow Automation with Grunt.js
Node.js Development Workflow Automation with Grunt.js
 
AWS Lambda from the trenches (Serverless London)
AWS Lambda from the trenches (Serverless London)AWS Lambda from the trenches (Serverless London)
AWS Lambda from the trenches (Serverless London)
 
Test Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as CodeTest Kitchen and Infrastructure as Code
Test Kitchen and Infrastructure as Code
 
Uber Mobility Meetup: Mobile Testing
Uber Mobility Meetup:  Mobile TestingUber Mobility Meetup:  Mobile Testing
Uber Mobility Meetup: Mobile Testing
 
Статический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDLСтатический анализ кода в контексте SSDL
Статический анализ кода в контексте SSDL
 
NodeSummit - MEAN Stack
NodeSummit - MEAN StackNodeSummit - MEAN Stack
NodeSummit - MEAN Stack
 
Continuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applicationsContinuous Integration/ Continuous Delivery of web applications
Continuous Integration/ Continuous Delivery of web applications
 

More from Sylwester Madej

More from Sylwester Madej (6)

Implementacja Material Design na Android Lollipop i starszych - MTC 2015
Implementacja Material Design na Android Lollipop i starszych - MTC 2015Implementacja Material Design na Android Lollipop i starszych - MTC 2015
Implementacja Material Design na Android Lollipop i starszych - MTC 2015
 
Mirror - Android UI on steroids: Droidcon Cracow 2014
Mirror - Android UI on steroids: Droidcon Cracow 2014Mirror - Android UI on steroids: Droidcon Cracow 2014
Mirror - Android UI on steroids: Droidcon Cracow 2014
 
Mirror - Android UI development on steroids
Mirror - Android UI development on steroidsMirror - Android UI development on steroids
Mirror - Android UI development on steroids
 
Android libs by Square - make your development a bit easier
Android libs by Square - make your development a bit easierAndroid libs by Square - make your development a bit easier
Android libs by Square - make your development a bit easier
 
Practical Android Course Part III - REST API with AQuery, Preferences, Androi...
Practical Android Course Part III - REST API with AQuery, Preferences, Androi...Practical Android Course Part III - REST API with AQuery, Preferences, Androi...
Practical Android Course Part III - REST API with AQuery, Preferences, Androi...
 
Practical Android Course Part I - Introduction, Activities (KNI)
Practical Android Course Part I - Introduction, Activities (KNI) Practical Android Course Part I - Introduction, Activities (KNI)
Practical Android Course Part I - Introduction, Activities (KNI)
 

Continous UI testing with Espresso and Jenkins

  • 1. Continous UI testing by with Espresso and Jenkins
  • 2. Sylwester Madej Founder & Head Developer @smdremedy #droidconZG sylwester.madej@byoutline.com byoutline.com 2
  • 3. This is a story of my team's journey
  • 4. ...jurney to CI/CD We are a small team
  • 5. ...jurney to CI/CD We are a small team - we are looking for things to be cost effective - not a perfect solution, but a decent one
  • 6. What we have gained - better, more agile work flow - no more Commit and run situations - way to check UI on many configurations - less regression bugs - higher code quality
  • 7. We started with tests - JVM tests (finally works in AS) - Robolectric - Instrumentation
  • 8. We wanted more from VCS - Use DVCS - Gitflow = git++ - Branch per feature, tag per release
  • 9. Static code analysis - FindBugs - PMD - Checkstyle - SonarCube
  • 10. Continous Integration checklist - gitflow ✔ - unit tests ✔ - code coverage ✔ - static analysis ✔ - build with one command ✔
  • 11. We needed our CI server - Jenkins - Travis - Circle CI - TeamCity - Bamboo...
  • 12. Why Jenkins? - free of change, but not of hustle - great community - can be hosted on any device - hundreds of plugins
  • 13. Where to host it? - CloudBees.com - VPS: s3, digital ocean - bare metal
  • 14. Perfect local Jenkins machine - good price/performance (i5, ssd, ram) - energy effective - quiet - small Candidates: - Intel NUC (7W idle) - Mac Mini
  • 15. CI setup Ubuntu - apt-get install - sdk install (Android Plugin don't install everything) - kvm - plugins (Chuck Norris, Lint Publisher, jacoco...)
  • 16. First easy win - create new project - add git with credentials ./gradlew build test jacoco You get: - compilation check - lint check - unit tests with code coverage
  • 17. We wanted more Instrumentation tests - Robotium - Appium - Espresso - UI Automator
  • 18. Some Espresso Great way to test UI, and do integration tests Api from developers to developers onView(Matcher) .perform(ViewActions) .check(ViewAssertions) More on Maciej's speach at 12:00: „Expressive functional testing with Espresso”
  • 19. How to test API? Mock/stub API classes - Dagger FTW - works great with Retrofit
  • 20. How to test API? MockWebServer - set HTTP mock for one test - Square Quality™, build upon OkHttp - mock calls, verify where they called
  • 21. How to test API? AndroidStubServer - HTTP server build in your APK (good for integration testing ) - can be sent to client within app simple config: { "method": "GET", "path": "/books", "response file": "books.json" } https://github.com/byoutline/AndroidStubServer
  • 22. Where to run Instrumentation tests? - androd emulators (x86 if possible) - genymotion - real devices
  • 23. Start simple - create job with single emu - use Android Emulator Plugin for configuration - start instrumentation tests in gradle ./gradlew connectedCheck
  • 24. Enter the matrix - create Multi-configuration project - exclude combinations
  • 25. Need a Spoon for your Espresso? - great tool from Square (duh !) - run instrumentation tests on multiple devices in parallel - external plugin to run with gradle https://github.com/stanfy/spoon-gradle-plugin - connect your devices to CI server with USB hub - generates nice looking reports
  • 26. One step further - Continous Delivery - your code is tested and ready to meet the world - create new job to deploy to distibution channel Crashlytics Google Play Alpha/Beta - start after succesful build or manualy
  • 27. When we need more devices Devices in the cloud - AppThwack - TestDroid... Bonus: Some free Intel devices
  • 28. How to make it even better? Genymotion on server http://www.slideshare.net/vishyrich/genymotion-with-jenkins
  • 29. BDD with Calabash Black box testing calabash-android gen write specification with Gherkin DSL Scenario: As a valid user I can log into my app When take picture When I press "Login" Then I see "Welcome to coolest app ever" Then take picture calabash-android run APK Works great with AndroidStubServer!
  • 30. Sylwester Madej Founder & Head Developer @smdremedy sylwester.madej@byoutline.com byoutline.com 3 0