SlideShare a Scribd company logo
JAVA TEST AUTOMATION FOR
REST | WEB | MOBILE
E L I A S N O G U E I R A
@ e l i a s n o g u e i r a
E D S O N Y A N A G A
@ y a n a g a
Elias Nogueira
@eliasnogueira
Senior QA Engineer, Agile Coach & Trainer at Sicredi
Postgraduate Professor at Unisinos.br
Active community engagement
- The Developers Conference
- Google Developer Group
- Agile Coach Meetup
Edson Yanaga
@yanaga
Director of Developer Experience, Red Hat
Oracle Java Champion
Loren ipsus
Intermediate validation
between back and front end
Test in REST service
To guarantee stability during
continuous test cycles
Mock in REST service
Functional and Acceptance tests
on Mobile UI
Test in Mobile UI
Functional and Acceptance
tests on Web UI
Test in Web UI
TOOL BOX
The correct toolbox is a key in a automation process
REST API
Our API “documentation” (you may use swagger)
ExampleURLVerbAction
/api/v1/person/api/v1/personGETList persons
/api/v1/person/27/api/v1/person/:idGETGet person by id
/api/v1/person/api/v1/personPOSTCreate a person
/api/v1/person/33/api/v1/person/:idPUTUpdate a person by id
/api/v1/person/52/api/v1/person/:idDELETERemove a person by id
REST SERVICE AUTOMATION
One of the most important layer
Have same importance as UI has
Always assert business transactions
On new services, try do validate manually first
CURL (CLI)
PostMan (Standalone application | Google Chrome extension)
MOCK FOR REST TESTS
The easiest way to create mocks for test
Microframework with Java 8 power
Great choice for micro services
Easy REST implementation to create you own mock with real response
http://sparkjava.com
MOCK FOR REST TESTS
Because you will not test in production (all the time), right?
Mock example with fixed data
Using fixed data is a good solution to test with a
real data (req, res) without code changes
MOCK FOR REST TESTS
Mock example with dynamic data
Create a list of pre-defined data may be a good way to
manage the testing data
Because you will not test in production (all the time), right?
REST
ASSURED
Easy DSL for REST service automation
Uses the give-when-then (BDD) syntax
https://github.com/jayway/rest-assured
WHAT I NEED?
What is needed to create a REST test automation with RestAssured
Import some static classes
Set the base URI, base path and port (if needed)
import static io.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
baseURI = "http://localhost";
basePath = "/api";
port = 4567;
REST TEST AUTOMATION
You need do set the URL, path and port
Before and After (setup | tearDown) for each tests
A good solution to start and stop your API mock
server using Spark
RestAssured has a fluent API to automate REST tests
RestAssured test example
Sending a GET with id 1 (given) and the assert
the response/results (then)
REST TEST AUTOMATION
SELENIUM
WEBDRIVER
Browser automation API for real browsers (including IE)
Can be controller by many programming languages
http://seleniumhq.org
W3C
Simulate an real user on browser
WHAT I NEED?
What you need to create your first web test with Selenium
Web browser and a driver*
A browser to use the inspect tool (native function in various browsers)
[ProTip] Use any software to change internet speed
* you will need a proper driver (executable file) to each browser
INSPECT AN WEB ELEMENT ON A BROWSER
A way to get the find an element for future utilization
Inspect
button
PROCESS TO CREATE WEB TEST SCRIPT
Easy process to create all yours web test scripts
Selenium test
script creation
process
Browser initialization and
navigation control
(back, forward, refresh)
Navigation
A way to find a web element
id, name, cssSelector, xpath
Interrogation
Wait for dynamic elements or
some asynchronous request based
on web elements
Synchronization
A way to interact with the web elements
click, clear, sendKeys, getText
Manipulation
1
2
3
4
WEB TEST AUTOMATION
Selenium has an easy DLS
Selenium Automated test
Complete example with navigation, interrogation, manipulation and synchronization
1
2
3
4
Use Page Objects to create modular test scripts
Apply design patterns in your test codebase
Execute web test in different internet speeds
Use XPATH only when needed
PRO TIPS FOR WEB TEST AUTOMATION
For a more professional test script
PRO-TIPS FOR YOUR WEB TEST SUITE
Is really important divide your tests into onto suites grouped by test levels
HEADLESS TEST ACCEPTANCE TEST FUNCTIONAL TEST
AUTOMATION TEST SUITE
1 2 3 4
GIVE FAST FEEDBACK FOR CONTINUOUS TEST CYCLES
TEST THE SYSTEM IN A USER PERSPECTIVE
TEST WITH A BUSINESS RULES PERSPECTIVE
1
2
3
APPIUM
API for automation on mobile devices
Android and iOS supported
http://appium.io
Execution on emulators, devices our cloud
Test on native or hybrid apps
WHAT I NEED?
Pre-reqs to create an automated test for mobile with Appium
Android SDK
Appium (via Appium.app or Nodejs)
Configure your path with (tools | platform-tools | tools/bin)
SDK Platform + System Image (to the emulator)
Emulator or Real Device
INSPECT COMPONENTS
You can inspect na component using uiautomatorviewer
Inspect
button
Inspected
component
Component
attributes
PROCESS TO CREATE MOBILE TEST SCRIPT
Easy process to create all your mobile test scripts
Appium test
script creation
process
Capabilities like Platform, Version,
Target app and others
DesiredCapabilities
Start the session between Appium
and Device (Appium.app or Nodejs)
Session
Wait for async requests basing on
components wait
Synchronization
The same way we do with Selenium
Find and interact with components
Interrogation and Manipulation
1
2
3
4
MOBILE TEST AUTOMATION
Despite of DesiredCapabilities and Session, is the same Selenium script
Example with a pre-installed app
Complete example targeting an Android platform
PRO TIPS FOR MOBILE TEST AUTOMATION
For a more professional test script
1
2
3
4
Execute tests with fresh and pre installed app
Create a test suite with user focus
Test on other networks(Wi-Fi, 3G…)
Test non-function req.
Thank you!
Code for the all apps (back-end, front-end and tests)
https://github.com/eliasnogueira/test-automation-javaone-2017

More Related Content

What's hot (20)

Unit Testing Concepts and Best Practices
Unit Testing Concepts and Best Practices
Derek Smith
 
Types of software testing
Types of software testing
Testbytes
 
Automation Testing with Test Complete
Automation Testing with Test Complete
Vartika Saxena
 
Generalidades y fundamentos sobre calidad y productividad Guia de tema 1
Generalidades y fundamentos sobre calidad y productividad Guia de tema 1
Edgar Ortiz Sánchez
 
2 plan de aseguramiento sqa - informatica
2 plan de aseguramiento sqa - informatica
Diego Coello
 
Test Management in Agile - Agile testing Days 2018
Test Management in Agile - Agile testing Days 2018
Derk-Jan de Grood
 
Metodología RUP
Metodología RUP
Jorge Cortés Alvarez
 
Performance testing with JMeter
Performance testing with JMeter
Mikael Kundert
 
Test automation process
Test automation process
Bharathi Krishnamurthi
 
Difference between functional testing and non functional testing
Difference between functional testing and non functional testing
pooja deshmukh
 
AMEF.ppt
AMEF.ppt
IsisContreras6
 
software testing methodologies
software testing methodologies
Jhonny Jhon
 
Automation testing
Automation testing
Biswajit Pratihari
 
Kaizen blitz
Kaizen blitz
david8ocampo8
 
Infrasistemas
Infrasistemas
Alejandro Sanchez Rodriguez
 
Non functional testing
Non functional testing
Vaibhav Dash
 
Evaluación calidad productos de software
Evaluación calidad productos de software
Jorge Maturana Palma
 
Java Micro Edition "J2ME"
Java Micro Edition "J2ME"
Freddy Hugo Estupiñan Batalla
 
Metricas tecnicas del software
Metricas tecnicas del software
Gabriel Romero Pastrana
 
Introduction to performance testing
Introduction to performance testing
Tharinda Liyanage
 
Unit Testing Concepts and Best Practices
Unit Testing Concepts and Best Practices
Derek Smith
 
Types of software testing
Types of software testing
Testbytes
 
Automation Testing with Test Complete
Automation Testing with Test Complete
Vartika Saxena
 
Generalidades y fundamentos sobre calidad y productividad Guia de tema 1
Generalidades y fundamentos sobre calidad y productividad Guia de tema 1
Edgar Ortiz Sánchez
 
2 plan de aseguramiento sqa - informatica
2 plan de aseguramiento sqa - informatica
Diego Coello
 
Test Management in Agile - Agile testing Days 2018
Test Management in Agile - Agile testing Days 2018
Derk-Jan de Grood
 
Performance testing with JMeter
Performance testing with JMeter
Mikael Kundert
 
Difference between functional testing and non functional testing
Difference between functional testing and non functional testing
pooja deshmukh
 
software testing methodologies
software testing methodologies
Jhonny Jhon
 
Non functional testing
Non functional testing
Vaibhav Dash
 
Evaluación calidad productos de software
Evaluación calidad productos de software
Jorge Maturana Palma
 
Introduction to performance testing
Introduction to performance testing
Tharinda Liyanage
 

Similar to Java Test Automation for REST, Web and Mobile (20)

AUTOMATION TESTING tools extensive application
AUTOMATION TESTING tools extensive application
ssuser94400e
 
Comprehensive Guide to UI & API Test Automation.pptx
Comprehensive Guide to UI & API Test Automation.pptx
mahmoudkhalilunoinco
 
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
Srijan Technologies
 
Real Testing Scenario Strategy Practical TestOps Presentation
Real Testing Scenario Strategy Practical TestOps Presentation
Adam Sandman
 
Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014
Justin Ison
 
Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...
Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...
QASymphony
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
kalichargn70th171
 
The Future of AI-Based Test Automation
The Future of AI-Based Test Automation
Applitools
 
PPT from Geekle QA Global Summit 2025 conference
PPT from Geekle QA Global Summit 2025 conference
SUPARNA KHAMARU
 
Testing NodeJS, REST APIs and MongoDB with UFT
Testing NodeJS, REST APIs and MongoDB with UFT
Ori Bendet
 
A Modern Dive into QA Automation and Beyond
A Modern Dive into QA Automation and Beyond
Pratik Patel
 
Java script unit testing
Java script unit testing
Mats Bryntse
 
Streamline Your Testing: A Guide to Automation Testing Tools
Streamline Your Testing: A Guide to Automation Testing Tools
stevegeorge0503
 
The Present and Future of Mobile Test Automation with Appium
The Present and Future of Mobile Test Automation with Appium
TechWell
 
Cross platform mobile UI automation testing
Cross platform mobile UI automation testing
ayshrimali
 
Automated testing
Automated testing
Aiste Stikliute
 
End to-end testing from rookie to pro
End to-end testing from rookie to pro
Domenico Gemoli
 
Maturity of Mobile Test Automation: Approaches and Future Trends- Impetus Web...
Maturity of Mobile Test Automation: Approaches and Future Trends- Impetus Web...
Impetus Technologies
 
Automating Mobile Web Browsers with Appium.pdf
Automating Mobile Web Browsers with Appium.pdf
flufftailshop
 
Appium.pptx
Appium.pptx
SameerAlam82
 
AUTOMATION TESTING tools extensive application
AUTOMATION TESTING tools extensive application
ssuser94400e
 
Comprehensive Guide to UI & API Test Automation.pptx
Comprehensive Guide to UI & API Test Automation.pptx
mahmoudkhalilunoinco
 
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
[Srijan Wednesday Webinar] Mastering Mobile Test Automation with Appium
Srijan Technologies
 
Real Testing Scenario Strategy Practical TestOps Presentation
Real Testing Scenario Strategy Practical TestOps Presentation
Adam Sandman
 
Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014
Justin Ison
 
Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...
Quality Jam 2017: Elise Carmichael and Corey Pyle "Jumpstarting Your Test Aut...
QASymphony
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
kalichargn70th171
 
The Future of AI-Based Test Automation
The Future of AI-Based Test Automation
Applitools
 
PPT from Geekle QA Global Summit 2025 conference
PPT from Geekle QA Global Summit 2025 conference
SUPARNA KHAMARU
 
Testing NodeJS, REST APIs and MongoDB with UFT
Testing NodeJS, REST APIs and MongoDB with UFT
Ori Bendet
 
A Modern Dive into QA Automation and Beyond
A Modern Dive into QA Automation and Beyond
Pratik Patel
 
Java script unit testing
Java script unit testing
Mats Bryntse
 
Streamline Your Testing: A Guide to Automation Testing Tools
Streamline Your Testing: A Guide to Automation Testing Tools
stevegeorge0503
 
The Present and Future of Mobile Test Automation with Appium
The Present and Future of Mobile Test Automation with Appium
TechWell
 
Cross platform mobile UI automation testing
Cross platform mobile UI automation testing
ayshrimali
 
End to-end testing from rookie to pro
End to-end testing from rookie to pro
Domenico Gemoli
 
Maturity of Mobile Test Automation: Approaches and Future Trends- Impetus Web...
Maturity of Mobile Test Automation: Approaches and Future Trends- Impetus Web...
Impetus Technologies
 
Automating Mobile Web Browsers with Appium.pdf
Automating Mobile Web Browsers with Appium.pdf
flufftailshop
 
Ad

More from Elias Nogueira (20)

Criando uma arquitetura para seus testes de API com RestAssured
Criando uma arquitetura para seus testes de API com RestAssured
Elias Nogueira
 
De a máxima cobertura nos seus testes de API
De a máxima cobertura nos seus testes de API
Elias Nogueira
 
Automação e virtualização de serviços
Automação e virtualização de serviços
Elias Nogueira
 
Usando containers com auto-escala de testes
Usando containers com auto-escala de testes
Elias Nogueira
 
Coach por Imersão - Buscando a excelência técnica com o time
Coach por Imersão - Buscando a excelência técnica com o time
Elias Nogueira
 
O Agile Coach pode (e muitas vezes deve) ser técnico
O Agile Coach pode (e muitas vezes deve) ser técnico
Elias Nogueira
 
Create an architecture for web test automation
Create an architecture for web test automation
Elias Nogueira
 
Paralelize seus testes web e mobile para ter feedbacks mais rápidos
Paralelize seus testes web e mobile para ter feedbacks mais rápidos
Elias Nogueira
 
Como 4 Agile Coaches trabalham em uma Transformação Ágil
Como 4 Agile Coaches trabalham em uma Transformação Ágil
Elias Nogueira
 
Papel do QA na Transformação Ágil
Papel do QA na Transformação Ágil
Elias Nogueira
 
BDD não é automação de teste - Scrum Gathering
BDD não é automação de teste - Scrum Gathering
Elias Nogueira
 
Como criar e executar testes paralelos web usando Selenium e containers
Como criar e executar testes paralelos web usando Selenium e containers
Elias Nogueira
 
Improve Yourself -- Learn the Skills, Join the Community - Tests
Improve Yourself -- Learn the Skills, Join the Community - Tests
Elias Nogueira
 
Confie no seu pipeline: Teste automaticamente um aplicativo Java de ponta a p...
Confie no seu pipeline: Teste automaticamente um aplicativo Java de ponta a p...
Elias Nogueira
 
BDD não é Automação de Testes
BDD não é Automação de Testes
Elias Nogueira
 
Criando uma grid para execução de testes paralelo com Appium
Criando uma grid para execução de testes paralelo com Appium
Elias Nogueira
 
Como ter sucesso ministrando uma palestra técnica
Como ter sucesso ministrando uma palestra técnica
Elias Nogueira
 
Quais são os steps de que deve conter na sua pipeline?
Quais são os steps de que deve conter na sua pipeline?
Elias Nogueira
 
Tem que testar mesmo?
Tem que testar mesmo?
Elias Nogueira
 
Testes em todos os niveis de planejamento
Testes em todos os niveis de planejamento
Elias Nogueira
 
Criando uma arquitetura para seus testes de API com RestAssured
Criando uma arquitetura para seus testes de API com RestAssured
Elias Nogueira
 
De a máxima cobertura nos seus testes de API
De a máxima cobertura nos seus testes de API
Elias Nogueira
 
Automação e virtualização de serviços
Automação e virtualização de serviços
Elias Nogueira
 
Usando containers com auto-escala de testes
Usando containers com auto-escala de testes
Elias Nogueira
 
Coach por Imersão - Buscando a excelência técnica com o time
Coach por Imersão - Buscando a excelência técnica com o time
Elias Nogueira
 
O Agile Coach pode (e muitas vezes deve) ser técnico
O Agile Coach pode (e muitas vezes deve) ser técnico
Elias Nogueira
 
Create an architecture for web test automation
Create an architecture for web test automation
Elias Nogueira
 
Paralelize seus testes web e mobile para ter feedbacks mais rápidos
Paralelize seus testes web e mobile para ter feedbacks mais rápidos
Elias Nogueira
 
Como 4 Agile Coaches trabalham em uma Transformação Ágil
Como 4 Agile Coaches trabalham em uma Transformação Ágil
Elias Nogueira
 
Papel do QA na Transformação Ágil
Papel do QA na Transformação Ágil
Elias Nogueira
 
BDD não é automação de teste - Scrum Gathering
BDD não é automação de teste - Scrum Gathering
Elias Nogueira
 
Como criar e executar testes paralelos web usando Selenium e containers
Como criar e executar testes paralelos web usando Selenium e containers
Elias Nogueira
 
Improve Yourself -- Learn the Skills, Join the Community - Tests
Improve Yourself -- Learn the Skills, Join the Community - Tests
Elias Nogueira
 
Confie no seu pipeline: Teste automaticamente um aplicativo Java de ponta a p...
Confie no seu pipeline: Teste automaticamente um aplicativo Java de ponta a p...
Elias Nogueira
 
BDD não é Automação de Testes
BDD não é Automação de Testes
Elias Nogueira
 
Criando uma grid para execução de testes paralelo com Appium
Criando uma grid para execução de testes paralelo com Appium
Elias Nogueira
 
Como ter sucesso ministrando uma palestra técnica
Como ter sucesso ministrando uma palestra técnica
Elias Nogueira
 
Quais são os steps de que deve conter na sua pipeline?
Quais são os steps de que deve conter na sua pipeline?
Elias Nogueira
 
Testes em todos os niveis de planejamento
Testes em todos os niveis de planejamento
Elias Nogueira
 
Ad

Recently uploaded (20)

Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Agile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
BradBedford3
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Safe Software
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!
PhilMeredith3
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...
Rishab Acharya
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Best Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small Businesses
TheTelephony
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
14 Years of Developing nCine - An Open Source 2D Game Framework
14 Years of Developing nCine - An Open Source 2D Game Framework
Angelo Theodorou
 
Automating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
How AI Can Improve Media Quality Testing Across Platforms (1).pptx
How AI Can Improve Media Quality Testing Across Platforms (1).pptx
kalichargn70th171
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
Marketo & Dynamics can be Most Excellent to Each Other – The Sequel
BradBedford3
 
Agile Software Engineering Methodologies
Agile Software Engineering Methodologies
Gaurav Sharma
 
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
Maintaining + Optimizing Database Health: Vendors, Orchestrations, Enrichment...
BradBedford3
 
Plooma is a writing platform to plan, write, and shape books your way
Plooma is a writing platform to plan, write, and shape books your way
Plooma
 
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Scaling FME Flow on Demand with Kubernetes: A Case Study At Cadac Group SaaS ...
Safe Software
 
Essentials of Resource Planning in a Downturn
Essentials of Resource Planning in a Downturn
OnePlan Solutions
 
Build enterprise-ready applications using skills you already have!
Build enterprise-ready applications using skills you already have!
PhilMeredith3
 
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
 
Online Queue Management System for Public Service Offices [Focused on Municip...
Online Queue Management System for Public Service Offices [Focused on Municip...
Rishab Acharya
 
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Top 11 Fleet Management Software Providers in 2025 (2).pdf
Trackobit
 
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Agentic Techniques in Retrieval-Augmented Generation with Azure AI Search
Maxim Salnikov
 
Bonk coin airdrop_ Everything You Need to Know.pdf
Bonk coin airdrop_ Everything You Need to Know.pdf
Herond Labs
 
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
Neuralink Templateeeeeeeeeeeeeeeeeeeeeeeeee
alexandernoetzold
 
Best Inbound Call Tracking Software for Small Businesses
Best Inbound Call Tracking Software for Small Businesses
TheTelephony
 
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
 
14 Years of Developing nCine - An Open Source 2D Game Framework
14 Years of Developing nCine - An Open Source 2D Game Framework
Angelo Theodorou
 
Automating Map Production With FME and Python
Automating Map Production With FME and Python
Safe Software
 
How AI Can Improve Media Quality Testing Across Platforms (1).pptx
How AI Can Improve Media Quality Testing Across Platforms (1).pptx
kalichargn70th171
 
AI and Deep Learning with NVIDIA Technologies
AI and Deep Learning with NVIDIA Technologies
SandeepKS52
 
Leveraging Foundation Models to Infer Intents
Leveraging Foundation Models to Infer Intents
Keheliya Gallaba
 

Java Test Automation for REST, Web and Mobile

  • 1. JAVA TEST AUTOMATION FOR REST | WEB | MOBILE E L I A S N O G U E I R A @ e l i a s n o g u e i r a E D S O N Y A N A G A @ y a n a g a
  • 2. Elias Nogueira @eliasnogueira Senior QA Engineer, Agile Coach & Trainer at Sicredi Postgraduate Professor at Unisinos.br Active community engagement - The Developers Conference - Google Developer Group - Agile Coach Meetup
  • 3. Edson Yanaga @yanaga Director of Developer Experience, Red Hat Oracle Java Champion Loren ipsus
  • 4. Intermediate validation between back and front end Test in REST service To guarantee stability during continuous test cycles Mock in REST service Functional and Acceptance tests on Mobile UI Test in Mobile UI Functional and Acceptance tests on Web UI Test in Web UI TOOL BOX The correct toolbox is a key in a automation process
  • 5. REST API Our API “documentation” (you may use swagger) ExampleURLVerbAction /api/v1/person/api/v1/personGETList persons /api/v1/person/27/api/v1/person/:idGETGet person by id /api/v1/person/api/v1/personPOSTCreate a person /api/v1/person/33/api/v1/person/:idPUTUpdate a person by id /api/v1/person/52/api/v1/person/:idDELETERemove a person by id
  • 6. REST SERVICE AUTOMATION One of the most important layer Have same importance as UI has Always assert business transactions On new services, try do validate manually first CURL (CLI) PostMan (Standalone application | Google Chrome extension)
  • 7. MOCK FOR REST TESTS The easiest way to create mocks for test Microframework with Java 8 power Great choice for micro services Easy REST implementation to create you own mock with real response http://sparkjava.com
  • 8. MOCK FOR REST TESTS Because you will not test in production (all the time), right? Mock example with fixed data Using fixed data is a good solution to test with a real data (req, res) without code changes
  • 9. MOCK FOR REST TESTS Mock example with dynamic data Create a list of pre-defined data may be a good way to manage the testing data Because you will not test in production (all the time), right?
  • 10. REST ASSURED Easy DSL for REST service automation Uses the give-when-then (BDD) syntax https://github.com/jayway/rest-assured
  • 11. WHAT I NEED? What is needed to create a REST test automation with RestAssured Import some static classes Set the base URI, base path and port (if needed) import static io.restassured.RestAssured.*; import static org.hamcrest.Matchers.*; baseURI = "http://localhost"; basePath = "/api"; port = 4567;
  • 12. REST TEST AUTOMATION You need do set the URL, path and port Before and After (setup | tearDown) for each tests A good solution to start and stop your API mock server using Spark
  • 13. RestAssured has a fluent API to automate REST tests RestAssured test example Sending a GET with id 1 (given) and the assert the response/results (then) REST TEST AUTOMATION
  • 14. SELENIUM WEBDRIVER Browser automation API for real browsers (including IE) Can be controller by many programming languages http://seleniumhq.org W3C Simulate an real user on browser
  • 15. WHAT I NEED? What you need to create your first web test with Selenium Web browser and a driver* A browser to use the inspect tool (native function in various browsers) [ProTip] Use any software to change internet speed * you will need a proper driver (executable file) to each browser
  • 16. INSPECT AN WEB ELEMENT ON A BROWSER A way to get the find an element for future utilization Inspect button
  • 17. PROCESS TO CREATE WEB TEST SCRIPT Easy process to create all yours web test scripts Selenium test script creation process Browser initialization and navigation control (back, forward, refresh) Navigation A way to find a web element id, name, cssSelector, xpath Interrogation Wait for dynamic elements or some asynchronous request based on web elements Synchronization A way to interact with the web elements click, clear, sendKeys, getText Manipulation 1 2 3 4
  • 18. WEB TEST AUTOMATION Selenium has an easy DLS Selenium Automated test Complete example with navigation, interrogation, manipulation and synchronization
  • 19. 1 2 3 4 Use Page Objects to create modular test scripts Apply design patterns in your test codebase Execute web test in different internet speeds Use XPATH only when needed PRO TIPS FOR WEB TEST AUTOMATION For a more professional test script
  • 20. PRO-TIPS FOR YOUR WEB TEST SUITE Is really important divide your tests into onto suites grouped by test levels HEADLESS TEST ACCEPTANCE TEST FUNCTIONAL TEST AUTOMATION TEST SUITE 1 2 3 4 GIVE FAST FEEDBACK FOR CONTINUOUS TEST CYCLES TEST THE SYSTEM IN A USER PERSPECTIVE TEST WITH A BUSINESS RULES PERSPECTIVE 1 2 3
  • 21. APPIUM API for automation on mobile devices Android and iOS supported http://appium.io Execution on emulators, devices our cloud Test on native or hybrid apps
  • 22. WHAT I NEED? Pre-reqs to create an automated test for mobile with Appium Android SDK Appium (via Appium.app or Nodejs) Configure your path with (tools | platform-tools | tools/bin) SDK Platform + System Image (to the emulator) Emulator or Real Device
  • 23. INSPECT COMPONENTS You can inspect na component using uiautomatorviewer Inspect button Inspected component Component attributes
  • 24. PROCESS TO CREATE MOBILE TEST SCRIPT Easy process to create all your mobile test scripts Appium test script creation process Capabilities like Platform, Version, Target app and others DesiredCapabilities Start the session between Appium and Device (Appium.app or Nodejs) Session Wait for async requests basing on components wait Synchronization The same way we do with Selenium Find and interact with components Interrogation and Manipulation 1 2 3 4
  • 25. MOBILE TEST AUTOMATION Despite of DesiredCapabilities and Session, is the same Selenium script Example with a pre-installed app Complete example targeting an Android platform
  • 26. PRO TIPS FOR MOBILE TEST AUTOMATION For a more professional test script 1 2 3 4 Execute tests with fresh and pre installed app Create a test suite with user focus Test on other networks(Wi-Fi, 3G…) Test non-function req.
  • 27. Thank you! Code for the all apps (back-end, front-end and tests) https://github.com/eliasnogueira/test-automation-javaone-2017