I
1
EFFICIENT
MOBILE
AUTOMATION
UKRAINE QA #7
UkrainQA #7
Got an interesting expertise in testing of complex web
and mobile applications, REST services.
---
Hands-on experience with performance testing, creating
CI/CD pipelines, Docker, creating mobile farms, etc.
Senior Test Automation Engineer @ Cogniance
2
VITALII
TATARYNOV
Agenda
Part 1: Acquaintance
Introduction to mobile testing, overview of tools and approaches
Part 2: KISS your code
How to write simple and good tests
Part 3: Infrastructure
Introduction to mobile testing, overview of tools
Part 4: Cooperation with your team
Introduction to mobile testing, overview of tools
3
UkrainQA #7
I
4
MOBILE
PHONES ARE
PART OF OUR
LIFE
And application that written for smartphones are critical
important to be stable and work well
UkrainQA #7
Except of comprehensive automation planning
process, maintenance of your test-cases, manual
testing with all possible design technics, there are
three parts of go
Write
good
code
Collaborate
with your
team
Make a robust
scalable
infrastructure
5
THREE PARTS
OF SUCCESSFUL
AUTOMATION
KISS your code
6
UkrainQA #7
Code is compiled,
tested and works
as expected
Code is
commented and
documented
Code is readable
understandable,
for other team
members
Code is scalable,
reusable
7
WHAT IS
GOOD AUTOTEST?
KEEP IT SIMPLE
8
and stupid
UkrainQA #7
It’s not silver bullet, but could help in
particular situations
Don’t reinvent the wheel.
Reuse already written code if it is from
reliable sources
Patterns External Libraries New language features
9
HOW TO DO IT?
Don’t forget to learn new
UkrainQA #7 10
PATTERNS:
BUILDER
Could be used for building complex object in
an efficient and convenient way
UkrainQA #7 11
PATTERNS:
VALUE
OBJECT
It’s easier to operate with complex objects
instead of simple ones
UkrainQA #7 12
PATTERNS:
CHAINING
Sequential methods calling could be readable
for some cases, and it simulates user steps
UkrainQA #7 13
PATTERNS:
DATA
PROVIDER
Thanks to data provider, the Data Driven
approach could be used for tests
UkrainQA #7 14
PATTERNS:
OBJECT
POOL
Borrow unique objects without explicit
initializing
UkrainQA #7 15
PATTERNS:
STRATEGY
Implement different strategies for some
action to boost your tests
UkrainQA #7 16
PATTERNS:
STRATEGY
Implement different strategies for some
action to boost your tests
UkrainQA #7 17
EXTERNAL
LIBRARIES
A library is a collection of class definitions and its implementations.
The main benefits of creating library is simply code reuse.
UkrainQA #7 18
My personal choice
AssertJ
Fluent assertions for java
Selenide
Allows you to simplify your tests
Allure
An open-source framework designed to create test execution reports that are clear to everyone in the team
Slf4j
Simple Logging Facade for Java
REST-Assured
REST Assured is a Java library that provides a domain-specific language (DSL) for writing powerful, maintainable tests for RESTful APIs
LOMBOK, OKHTTP/RETFROFIT, GSON, APACHE COMMONS POOL, GOOGLE AUTOVALUE, ETC.
There are a lot of other cool libraries...
UkrainQA #7 19
LIBRARIES:
AssertJ
Flexible approach for assertions
UkrainQA #7 20
LIBRARIES:
Selenide
Selenide is not only for web tests
UkrainQA #7 21
LIBRARIES:
Selenide
It’s also applicable for mobile testing
UkrainQA #7 22
LIBRARIES:
Allure
Just really nice reports :)
UkrainQA #7 23
LIBRARIES:
Allure
Just really nice reports :)
UkrainQA #7 24
LIBRARIES:
Allure
Just really nice reports :)
A FEW MORE
THINGS
25
UkrainQA #7
I
26
DON’T
FORGET
ABOUT
LOGGING
UkrainQA #7 27
TIPS:
LOGGING
Logging helps you to figure out what is going
on in your tests
UkrainQA #7 28
NEW LANGUAGE
FEATURES
Stay tuned with new java features
UkrainQA #7 29
JAVA 11:
Local
Variable Type
Inference
Java 10 has introduced a new language
keyword var which optionally replaces the
type information when declaring local
variables (local means variable declarations
inside method bodies)
UkrainQA #7 30
JAVA 11:
HTTP Client
Java 9 introduced a new incubating HttpClient
API for dealing with HTTP requests. As of Java
11 this API is now final and available in the
standard libraries package java.net.
UkrainQA #7 31
JAVA 11:
Collections
Collections such as List, Set and Map have
been extended with new methods.
UkrainQA #7 32
JAVA 11:
New features
in streams
The methods dropWhile and takeWhile both
accept a predicate to determine which
elements to abandon from the stream
UkrainQA #7 33
JAVA 11:
New features
in Strings
One of the most basic classes String gets a
few helper methods for trimming or checking
whitespace and for streaming the lines of a
string
INFRASTRUCTURE
34
UkrainQA #7
To keep a finger on the pulse of our quality:
● We’ve got the testing results after each build
● We’ve got the results of regression testing
every night
● Data generation is automated as well
35
OUR PIPELINE
OVERVIEW 1. New app
build 2. Unit testing
3. Integration
testing
4. UI tests
smoke
after each build
5. Regression
every night
6. Report
by Allure
UkrainQA #7 36
APPIUM
vs
Espresso &
XCUITest
What’s to choose?
UkrainQA #7
Repository
We use Bitbucket as a
main repository
Unit &
Integration
Espresso and JUnit, classic
:)
UI tests
Appium + TestNG +
STF + Allure
37
OUR TOOLS
CI
We use Jenkins as our
Continuous integration
tool with multi branch
approach
UkrainQA #7 38
INFRA:
Jenkins
Blue Ocean
One of the most basic classes String gets a
few helper methods for trimming or checking
whitespace and for streaming the lines of a
string
UkrainQA #7 39
INFRA:
A branch for
an each issue
you work on
Then do all the implementation and testing
work on that branch. When that's complete,
submit a pull request, merge up, and release
whenever you're ready.
A BIT OF PRACTICE...
40
UkrainQA #7 41
INSTALL JENKINS
1. Go to https://jenkins.io/download/ and download
latest version
2. Install it
3. Proceed with wizard to finish the installation
process
4. Choose default plugins
5. Set credentials
6. Install BlueOcean plugin
UkrainQA #7
This is a sample text.
Insert your desired text here.
Lorem Ipsum
42
Creating
Blue Ocean Pipeline Jenkins
installed
01 Free configuration job for your unit tests
Create step for unit tests of
your mobile application
02Free configuration job for your unit tests
Create step for integration tests
for the mobile application
Your Company Name
03 It could be smoke tests package
Create UI tests step/job
04Connect your Git repository by creating
Merge it using BlueOcean plugin
05 It could be done by BlueOcean plugin in
Jenkins
Add Jenkinsfile to your main
branch
06Applicable for Android devices only
Install OpenSTF to control
devices
43
Your Company Name
Profit
07 To get nice reports
Add Allure
08This is a sample text.
Insert your desired text here.
Set scanning interval for your
multibranch job
44
UkrainQA #7 45
HOW TO INSTALL
OPEN STF
Requirements:
Node.js >= 6.9 (latest stable version I found node@8)
ADB properly set up ($ANDROID_HOME is set for your system)
RethinkDB >= 2.2
GraphicsMagick (for resizing screenshots)
ZeroMQ libraries installed
Protocol Buffers libraries installed
yasm installed (for compiling embedded libjpeg-turbo)
pkg-config so that Node.js can find the libraries
Note that you need these dependencies even if you've installed STF
directly from NPM, because they can't be included in the package.
On Mac OS, you can use homebrew to install most of the
dependencies:
brew install rethinkdb graphicsmagick zeromq protobuf yasm
pkg-config
As mentioned earlier, you must have all of the requirements installed
first. Then you can simply install via NPM:
npm install -g stf
UkrainQA #7 46
HOW TO RUN
OPENSTF
Launch database:
rethinkdb --http-port=8081
Launch stf:
stf local
WHAT ABOUT DOCKER?
47
UkrainQA #7 48
INSTALL JENKINS
Install docker, and then run command:
docker run 
--rm 
-u root 
-p 8080:8080 
-v jenkins-data:/var/jenkins_home 
-v /var/run/docker.sock:/var/run/docker.sock 
-v "$HOME":/home 
jenkinsci/blueocean
After that, proceed with wizard to complete installation
process
UkrainQA #7 49
HOW TO INSTALL
OPEN STF
clone https://github.com/nikosch86/stf-poc
Then change public ip in .env file
And run command:
docker-compose up -d —build
COMMUNICATION WITH
OUR TEAM
50
UkrainQA #7 51
PLAN YOUR
AUTOMATION COVERAGE
SPRINT 1
SPRINT 2
2%
4%
SPRINT 3
SPRINT 4
SPRINT 5
SPRINT 6
SPRINT 7
8%
18%
13%
25%
38%
Work closely with your team to plan an automation
coverage, to involve team into automation process
and you’ll get good results
UkrainQA #7
I
52
BRING THE
VALUE
And your team will be open for any help you need
Q&A
53

Efficient mobile automation

  • 1.
  • 2.
    UkrainQA #7 Got aninteresting expertise in testing of complex web and mobile applications, REST services. --- Hands-on experience with performance testing, creating CI/CD pipelines, Docker, creating mobile farms, etc. Senior Test Automation Engineer @ Cogniance 2 VITALII TATARYNOV
  • 3.
    Agenda Part 1: Acquaintance Introductionto mobile testing, overview of tools and approaches Part 2: KISS your code How to write simple and good tests Part 3: Infrastructure Introduction to mobile testing, overview of tools Part 4: Cooperation with your team Introduction to mobile testing, overview of tools 3
  • 4.
    UkrainQA #7 I 4 MOBILE PHONES ARE PARTOF OUR LIFE And application that written for smartphones are critical important to be stable and work well
  • 5.
    UkrainQA #7 Except ofcomprehensive automation planning process, maintenance of your test-cases, manual testing with all possible design technics, there are three parts of go Write good code Collaborate with your team Make a robust scalable infrastructure 5 THREE PARTS OF SUCCESSFUL AUTOMATION
  • 6.
  • 7.
    UkrainQA #7 Code iscompiled, tested and works as expected Code is commented and documented Code is readable understandable, for other team members Code is scalable, reusable 7 WHAT IS GOOD AUTOTEST?
  • 8.
  • 9.
    UkrainQA #7 It’s notsilver bullet, but could help in particular situations Don’t reinvent the wheel. Reuse already written code if it is from reliable sources Patterns External Libraries New language features 9 HOW TO DO IT? Don’t forget to learn new
  • 10.
    UkrainQA #7 10 PATTERNS: BUILDER Couldbe used for building complex object in an efficient and convenient way
  • 11.
    UkrainQA #7 11 PATTERNS: VALUE OBJECT It’seasier to operate with complex objects instead of simple ones
  • 12.
    UkrainQA #7 12 PATTERNS: CHAINING Sequentialmethods calling could be readable for some cases, and it simulates user steps
  • 13.
    UkrainQA #7 13 PATTERNS: DATA PROVIDER Thanksto data provider, the Data Driven approach could be used for tests
  • 14.
    UkrainQA #7 14 PATTERNS: OBJECT POOL Borrowunique objects without explicit initializing
  • 15.
    UkrainQA #7 15 PATTERNS: STRATEGY Implementdifferent strategies for some action to boost your tests
  • 16.
    UkrainQA #7 16 PATTERNS: STRATEGY Implementdifferent strategies for some action to boost your tests
  • 17.
    UkrainQA #7 17 EXTERNAL LIBRARIES Alibrary is a collection of class definitions and its implementations. The main benefits of creating library is simply code reuse.
  • 18.
    UkrainQA #7 18 Mypersonal choice AssertJ Fluent assertions for java Selenide Allows you to simplify your tests Allure An open-source framework designed to create test execution reports that are clear to everyone in the team Slf4j Simple Logging Facade for Java REST-Assured REST Assured is a Java library that provides a domain-specific language (DSL) for writing powerful, maintainable tests for RESTful APIs LOMBOK, OKHTTP/RETFROFIT, GSON, APACHE COMMONS POOL, GOOGLE AUTOVALUE, ETC. There are a lot of other cool libraries...
  • 19.
  • 20.
  • 21.
    UkrainQA #7 21 LIBRARIES: Selenide It’salso applicable for mobile testing
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
    UkrainQA #7 27 TIPS: LOGGING Logginghelps you to figure out what is going on in your tests
  • 28.
    UkrainQA #7 28 NEWLANGUAGE FEATURES Stay tuned with new java features
  • 29.
    UkrainQA #7 29 JAVA11: Local Variable Type Inference Java 10 has introduced a new language keyword var which optionally replaces the type information when declaring local variables (local means variable declarations inside method bodies)
  • 30.
    UkrainQA #7 30 JAVA11: HTTP Client Java 9 introduced a new incubating HttpClient API for dealing with HTTP requests. As of Java 11 this API is now final and available in the standard libraries package java.net.
  • 31.
    UkrainQA #7 31 JAVA11: Collections Collections such as List, Set and Map have been extended with new methods.
  • 32.
    UkrainQA #7 32 JAVA11: New features in streams The methods dropWhile and takeWhile both accept a predicate to determine which elements to abandon from the stream
  • 33.
    UkrainQA #7 33 JAVA11: New features in Strings One of the most basic classes String gets a few helper methods for trimming or checking whitespace and for streaming the lines of a string
  • 34.
  • 35.
    UkrainQA #7 To keepa finger on the pulse of our quality: ● We’ve got the testing results after each build ● We’ve got the results of regression testing every night ● Data generation is automated as well 35 OUR PIPELINE OVERVIEW 1. New app build 2. Unit testing 3. Integration testing 4. UI tests smoke after each build 5. Regression every night 6. Report by Allure
  • 36.
    UkrainQA #7 36 APPIUM vs Espresso& XCUITest What’s to choose?
  • 37.
    UkrainQA #7 Repository We useBitbucket as a main repository Unit & Integration Espresso and JUnit, classic :) UI tests Appium + TestNG + STF + Allure 37 OUR TOOLS CI We use Jenkins as our Continuous integration tool with multi branch approach
  • 38.
    UkrainQA #7 38 INFRA: Jenkins BlueOcean One of the most basic classes String gets a few helper methods for trimming or checking whitespace and for streaming the lines of a string
  • 39.
    UkrainQA #7 39 INFRA: Abranch for an each issue you work on Then do all the implementation and testing work on that branch. When that's complete, submit a pull request, merge up, and release whenever you're ready.
  • 40.
    A BIT OFPRACTICE... 40
  • 41.
    UkrainQA #7 41 INSTALLJENKINS 1. Go to https://jenkins.io/download/ and download latest version 2. Install it 3. Proceed with wizard to finish the installation process 4. Choose default plugins 5. Set credentials 6. Install BlueOcean plugin
  • 42.
    UkrainQA #7 This isa sample text. Insert your desired text here. Lorem Ipsum 42 Creating Blue Ocean Pipeline Jenkins installed 01 Free configuration job for your unit tests Create step for unit tests of your mobile application 02Free configuration job for your unit tests Create step for integration tests for the mobile application
  • 43.
    Your Company Name 03It could be smoke tests package Create UI tests step/job 04Connect your Git repository by creating Merge it using BlueOcean plugin 05 It could be done by BlueOcean plugin in Jenkins Add Jenkinsfile to your main branch 06Applicable for Android devices only Install OpenSTF to control devices 43
  • 44.
    Your Company Name Profit 07To get nice reports Add Allure 08This is a sample text. Insert your desired text here. Set scanning interval for your multibranch job 44
  • 45.
    UkrainQA #7 45 HOWTO INSTALL OPEN STF Requirements: Node.js >= 6.9 (latest stable version I found node@8) ADB properly set up ($ANDROID_HOME is set for your system) RethinkDB >= 2.2 GraphicsMagick (for resizing screenshots) ZeroMQ libraries installed Protocol Buffers libraries installed yasm installed (for compiling embedded libjpeg-turbo) pkg-config so that Node.js can find the libraries Note that you need these dependencies even if you've installed STF directly from NPM, because they can't be included in the package. On Mac OS, you can use homebrew to install most of the dependencies: brew install rethinkdb graphicsmagick zeromq protobuf yasm pkg-config As mentioned earlier, you must have all of the requirements installed first. Then you can simply install via NPM: npm install -g stf
  • 46.
    UkrainQA #7 46 HOWTO RUN OPENSTF Launch database: rethinkdb --http-port=8081 Launch stf: stf local
  • 47.
  • 48.
    UkrainQA #7 48 INSTALLJENKINS Install docker, and then run command: docker run --rm -u root -p 8080:8080 -v jenkins-data:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock -v "$HOME":/home jenkinsci/blueocean After that, proceed with wizard to complete installation process
  • 49.
    UkrainQA #7 49 HOWTO INSTALL OPEN STF clone https://github.com/nikosch86/stf-poc Then change public ip in .env file And run command: docker-compose up -d —build
  • 50.
  • 51.
    UkrainQA #7 51 PLANYOUR AUTOMATION COVERAGE SPRINT 1 SPRINT 2 2% 4% SPRINT 3 SPRINT 4 SPRINT 5 SPRINT 6 SPRINT 7 8% 18% 13% 25% 38% Work closely with your team to plan an automation coverage, to involve team into automation process and you’ll get good results
  • 52.
    UkrainQA #7 I 52 BRING THE VALUE Andyour team will be open for any help you need
  • 53.