SlideShare una empresa de Scribd logo
1 de 24
Mobile Apps Unit testing
www.axon.vnfb.com/AxonActiveVietNam
What is Unit testing
● A unit test is a piece of a code that invokes another piece of code.
● Done during the development (coding phase) of an application by the
developers
● Isolate a section of code and verify its correctness
● A unit may be an individual function, procedure, module, or object
www.axon.vnfb.com/AxonActiveVietNam
Why writes test?
● Ability to refactor code with confidence
● Proof that your code actually works
● You get a low-level regression-test suite
● It reduces the cost of bugs
www.axon.vnfb.com/AxonActiveVietNam
Stunt Double
www.axon.vnfb.com/AxonActiveVietNam
Test Double
“Test double is a generic term for any case where you replace a production
object for testing purposes.”
- Martin Fowler
www.axon.vnfb.com/AxonActiveVietNam
Why using Test double
● Enable testing
● Ease testing
● Improve testing
www.axon.vnfb.com/AxonActiveVietNam
Type of Test Double
● Stubs
● Mocks
● Spy/Spies
● Fake
● Dummy
www.axon.vnfb.com/AxonActiveVietNam
Stubs
● Control indirect inputs to system under test
● Provide “canned responses” to the SUT
www.axon.vnfb.com/AxonActiveVietNam
Mock
● Used to verify if the SUT call specific
method of collaborator. (Indirect output)
● Behavior verification
www.axon.vnfb.com/AxonActiveVietNam
Spy
● Like mock, verify interaction
● Keep track of what methods are called, and what
arguments they are called with.
www.axon.vnfb.com/AxonActiveVietNam
Fake
● Replace a “depended-on component” with a
lighter weight implementation
● Can be used for input or output
www.axon.vnfb.com/AxonActiveVietNam
Dummy
● Never used
● Satisfy method parameters
● Easy to implement
www.axon.vnfb.com/AxonActiveVietNam
Why MVVM?
● Models hold application data.
● Views display visual elements and
controls on the screen.
● View models transform model
information into values that can be
displayed on a view.
www.axon.vnfb.com/AxonActiveVietNam
Android: JUnit Framework
● Antotation
○ @Test, @Before, @After,
@RunWith, @Rule, etc.
● Assertion
○ assertEquals(expected,
actual)
○ assertTrue(condition)
○ assertNotNull(object)
○ ...
www.axon.vnfb.com/AxonActiveVietNam
Android: Mockito, Mockk
● verify
● mockk
● spyk
www.axon.vnfb.com/AxonActiveVietNam
iOS Unit test
● Unit tests have their own
target in Xcode and are
written using the XCTest
framework
www.axon.vnfb.com/AxonActiveVietNam
iOS Unit test
● Setup and Teardown
● Test Assertion
○ Boolean Assertions
○ Nil and Non-nil Assertions
○ Equality and Inequality Assertions
○ Comparable Value Assertions
○ NSException Assertions
○ Failing Unconditionally
www.axon.vnfb.com/AxonActiveVietNam
iOS Unit test
www.axon.vnfb.com/AxonActiveVietNam
iOS Unit test
Quick & Nimble
iOS Unit test
www.axon.vnfb.com/AxonActiveVietNam
Code practice
iOS: https://gitlab.com/ducnguyenht/axon-sb-ios-ut/
Android: https://gitlab.com/ducnguyenht/axon-sb-android-ut/
www.axon.vnfb.com/AxonActiveVietNam
Q&A
www.axon.vnfb.com/AxonActiveVietNam
Thank you!
www.axon.vnfb.com/AxonActiveVietNam

Más contenido relacionado

La actualidad más candente

Why we used Feature Branching
Why we used Feature BranchingWhy we used Feature Branching
Why we used Feature Branching
Alan Parkinson
 
Feature Toggles
Feature TogglesFeature Toggles
Feature Toggles
Devi Sridharan
 
Unit testing Ch. 13 of Programming Ruby
Unit testing Ch. 13 of Programming RubyUnit testing Ch. 13 of Programming Ruby
Unit testing Ch. 13 of Programming Ruby
lvrubygroup
 
J meter understanding
J meter understandingJ meter understanding
J meter understanding
Rajesh S
 

La actualidad más candente (20)

Illia Seleznov - Integration tests for Spring Boot application
Illia Seleznov - Integration tests for Spring Boot applicationIllia Seleznov - Integration tests for Spring Boot application
Illia Seleznov - Integration tests for Spring Boot application
 
Angular Testing
Angular TestingAngular Testing
Angular Testing
 
Manual qa versus automation qa
Manual qa versus automation qaManual qa versus automation qa
Manual qa versus automation qa
 
Why we used Feature Branching
Why we used Feature BranchingWhy we used Feature Branching
Why we used Feature Branching
 
RFT Tutorial 4 How Do We Record A Script Using Rational Functional Tester - RFT
RFT Tutorial 4 How Do We Record A Script Using Rational Functional Tester - RFTRFT Tutorial 4 How Do We Record A Script Using Rational Functional Tester - RFT
RFT Tutorial 4 How Do We Record A Script Using Rational Functional Tester - RFT
 
Feature Toggles
Feature TogglesFeature Toggles
Feature Toggles
 
RFT Tutorial - 9 How To Create A Properties Verification Point In Rft For Tes...
RFT Tutorial - 9 How To Create A Properties Verification Point In Rft For Tes...RFT Tutorial - 9 How To Create A Properties Verification Point In Rft For Tes...
RFT Tutorial - 9 How To Create A Properties Verification Point In Rft For Tes...
 
Continuous performance: Load testing for developers with gatling @ JavaOne 2016
Continuous performance: Load testing for developers with gatling @ JavaOne 2016Continuous performance: Load testing for developers with gatling @ JavaOne 2016
Continuous performance: Load testing for developers with gatling @ JavaOne 2016
 
Continuous performance: Load testing for developers with gatling
Continuous performance: Load testing for developers with gatlingContinuous performance: Load testing for developers with gatling
Continuous performance: Load testing for developers with gatling
 
DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 Fall 2014DIG1108C Lesson 7 Fall 2014
DIG1108C Lesson 7 Fall 2014
 
Automation using ibm rft
Automation using ibm rftAutomation using ibm rft
Automation using ibm rft
 
Unit testing Ch. 13 of Programming Ruby
Unit testing Ch. 13 of Programming RubyUnit testing Ch. 13 of Programming Ruby
Unit testing Ch. 13 of Programming Ruby
 
Dhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro PresentationDhanasekaran 2008-2009 Quick Test Pro Presentation
Dhanasekaran 2008-2009 Quick Test Pro Presentation
 
First QTP Tutorial
First QTP TutorialFirst QTP Tutorial
First QTP Tutorial
 
Cqrs
CqrsCqrs
Cqrs
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
Workshop: Unit Testing in Python
Workshop: Unit Testing in PythonWorkshop: Unit Testing in Python
Workshop: Unit Testing in Python
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
 
J meter understanding
J meter understandingJ meter understanding
J meter understanding
 
What is munit and how to create your first unit test
What is munit and how to create your first unit testWhat is munit and how to create your first unit test
What is munit and how to create your first unit test
 

Similar a [Scrum Breakfast DN] Is it possible to make 100% Unit Test coverage for your mobile apps? – June 2020

Gabriel carabat a healthy approach for test automation
Gabriel carabat   a healthy approach for test automationGabriel carabat   a healthy approach for test automation
Gabriel carabat a healthy approach for test automation
Romania Testing
 
Automation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterAutomation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional Tester
VijayChowthri Nagaprakasham
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
mehramit
 

Similar a [Scrum Breakfast DN] Is it possible to make 100% Unit Test coverage for your mobile apps? – June 2020 (20)

Gabriel carabat a healthy approach for test automation
Gabriel carabat   a healthy approach for test automationGabriel carabat   a healthy approach for test automation
Gabriel carabat a healthy approach for test automation
 
Automation for developers
Automation for developersAutomation for developers
Automation for developers
 
Frontend training
Frontend trainingFrontend training
Frontend training
 
Test Automation: How to Succeed When Moving Beyond Manual Testing
Test Automation: How to Succeed When Moving Beyond Manual TestingTest Automation: How to Succeed When Moving Beyond Manual Testing
Test Automation: How to Succeed When Moving Beyond Manual Testing
 
Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"Никита Галкин "Testing in Frontend World"
Никита Галкин "Testing in Frontend World"
 
Testing Angular
Testing AngularTesting Angular
Testing Angular
 
Testing in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita GalkinTesting in FrontEnd World by Nikita Galkin
Testing in FrontEnd World by Nikita Galkin
 
Quality for developers
Quality for developersQuality for developers
Quality for developers
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
Integrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala ProjectIntegrating Selenium testing infrastructure into Scala Project
Integrating Selenium testing infrastructure into Scala Project
 
Protractor End To End Testing For AngularJS
Protractor End To End Testing For AngularJSProtractor End To End Testing For AngularJS
Protractor End To End Testing For AngularJS
 
How to push a react js application in production and sleep better
How to push a react js application in production and sleep betterHow to push a react js application in production and sleep better
How to push a react js application in production and sleep better
 
Dive into Angular, part 5: Experience
Dive into Angular, part 5: ExperienceDive into Angular, part 5: Experience
Dive into Angular, part 5: Experience
 
How do you implement Continuous Delivery? Part 4: Automated Testing
How do you implement Continuous Delivery? Part 4: Automated TestingHow do you implement Continuous Delivery? Part 4: Automated Testing
How do you implement Continuous Delivery? Part 4: Automated Testing
 
Unit Testing in JavaScript with MVC and QUnit
Unit Testing in JavaScript with MVC and QUnitUnit Testing in JavaScript with MVC and QUnit
Unit Testing in JavaScript with MVC and QUnit
 
AngularJs Crash Course
AngularJs Crash CourseAngularJs Crash Course
AngularJs Crash Course
 
Automation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional TesterAutomation testing IBM RFT - Rational Functional Tester
Automation testing IBM RFT - Rational Functional Tester
 
Automation testing
Automation testingAutomation testing
Automation testing
 
Qtp Training
Qtp TrainingQtp Training
Qtp Training
 
Unit Testing in Angular
Unit Testing in AngularUnit Testing in Angular
Unit Testing in Angular
 

Más de Scrum Breakfast Vietnam

Más de Scrum Breakfast Vietnam (20)

Zero to hero in agile automation testing
Zero to hero in agile automation testingZero to hero in agile automation testing
Zero to hero in agile automation testing
 
Retrospective Toolbox - HCMC Scrum Breakfast - 30/11/2019
Retrospective Toolbox - HCMC Scrum Breakfast - 30/11/2019Retrospective Toolbox - HCMC Scrum Breakfast - 30/11/2019
Retrospective Toolbox - HCMC Scrum Breakfast - 30/11/2019
 
UI/UX Design in Agile process
UI/UX Design in Agile process  UI/UX Design in Agile process
UI/UX Design in Agile process
 
Team building in the Infinite game - HCMC Scrum Breakfast - 28/09/2019
Team building in the Infinite game - HCMC Scrum Breakfast - 28/09/2019Team building in the Infinite game - HCMC Scrum Breakfast - 28/09/2019
Team building in the Infinite game - HCMC Scrum Breakfast - 28/09/2019
 
Design Thinking in Solving Problem - HCMC Scrum Breakfast - July 27, 2019
Design Thinking in Solving Problem - HCMC Scrum Breakfast - July 27, 2019Design Thinking in Solving Problem - HCMC Scrum Breakfast - July 27, 2019
Design Thinking in Solving Problem - HCMC Scrum Breakfast - July 27, 2019
 
Make your Scrum team great again - DN Scrum Breakfast - June 21, 2019
Make your Scrum team great again - DN Scrum Breakfast - June 21, 2019Make your Scrum team great again - DN Scrum Breakfast - June 21, 2019
Make your Scrum team great again - DN Scrum Breakfast - June 21, 2019
 
Working as a remote team - HCM Scrum Breakfast - May 25, 2019
Working as a remote team - HCM Scrum Breakfast - May 25, 2019Working as a remote team - HCM Scrum Breakfast - May 25, 2019
Working as a remote team - HCM Scrum Breakfast - May 25, 2019
 
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
 
Benefits of BPMN in Software Development - DN Scrum Breakfast - September 29,...
Benefits of BPMN in Software Development - DN Scrum Breakfast - September 29,...Benefits of BPMN in Software Development - DN Scrum Breakfast - September 29,...
Benefits of BPMN in Software Development - DN Scrum Breakfast - September 29,...
 
CSS Flexbox and Grid: The future of website layouts - DN Scrum Breakfast - Au...
CSS Flexbox and Grid: The future of website layouts - DN Scrum Breakfast - Au...CSS Flexbox and Grid: The future of website layouts - DN Scrum Breakfast - Au...
CSS Flexbox and Grid: The future of website layouts - DN Scrum Breakfast - Au...
 
Automation Testing in Agile - HCM Scrum Breakfast - July 2018
Automation Testing in Agile - HCM Scrum Breakfast - July 2018Automation Testing in Agile - HCM Scrum Breakfast - July 2018
Automation Testing in Agile - HCM Scrum Breakfast - July 2018
 
[DN Scrum Breakfast] API Automation Testing Using Retrofit & Cucumber
[DN Scrum Breakfast] API Automation Testing Using Retrofit & Cucumber[DN Scrum Breakfast] API Automation Testing Using Retrofit & Cucumber
[DN Scrum Breakfast] API Automation Testing Using Retrofit & Cucumber
 
[HCM Scrum Breakfast - April 2018] Teamwork: The Leader Job (Pt.1)
[HCM Scrum Breakfast - April 2018] Teamwork: The Leader Job (Pt.1)[HCM Scrum Breakfast - April 2018] Teamwork: The Leader Job (Pt.1)
[HCM Scrum Breakfast - April 2018] Teamwork: The Leader Job (Pt.1)
 
[DN Scrum Breakfast] Effective Cloud Computing
[DN Scrum Breakfast] Effective Cloud Computing[DN Scrum Breakfast] Effective Cloud Computing
[DN Scrum Breakfast] Effective Cloud Computing
 
[HCM Scrum Breakfast - January 2018] ElasticSearch In Action
[HCM Scrum Breakfast - January 2018] ElasticSearch In Action[HCM Scrum Breakfast - January 2018] ElasticSearch In Action
[HCM Scrum Breakfast - January 2018] ElasticSearch In Action
 
[DN Scrum Breakfast] Automation E2E Testing with Chimp Framework and WebdriverIO
[DN Scrum Breakfast] Automation E2E Testing with Chimp Framework and WebdriverIO[DN Scrum Breakfast] Automation E2E Testing with Chimp Framework and WebdriverIO
[DN Scrum Breakfast] Automation E2E Testing with Chimp Framework and WebdriverIO
 
[DN Scrum Breakfast] Scrum Master, do we really need one_by Nam Dang_Mar2016
[DN Scrum Breakfast] Scrum Master, do we really need one_by Nam Dang_Mar2016[DN Scrum Breakfast] Scrum Master, do we really need one_by Nam Dang_Mar2016
[DN Scrum Breakfast] Scrum Master, do we really need one_by Nam Dang_Mar2016
 
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
[DN Scrum Breakfast] Protractor: E2E Testing for AngularJS (by Thuy Nguyen)
 
[Da Nang Scrum Breakfast] Angular Tour
[Da Nang Scrum Breakfast] Angular Tour[Da Nang Scrum Breakfast] Angular Tour
[Da Nang Scrum Breakfast] Angular Tour
 
[HCM Scrum Breakfast - June 2017] Distributed Team
[HCM Scrum Breakfast - June 2017] Distributed Team[HCM Scrum Breakfast - June 2017] Distributed Team
[HCM Scrum Breakfast - June 2017] Distributed Team
 

Último

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Último (20)

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

[Scrum Breakfast DN] Is it possible to make 100% Unit Test coverage for your mobile apps? – June 2020