SlideShare a Scribd company logo
1 of 40
Download to read offline
©2013 GlobalLogic Inc. CONFIDENTIAL
CONFIDENTIAL©2013 GlobalLogic Inc.
Mobile Dev Guide:
TDD + CI + CD
TDD: Test Driven Development
CI: Continuous Integration
CD: Continuous Delivery
©2013 GlobalLogic Inc. CONFIDENTIAL
What is TDD? Why? How?
What is CI? Why? How?
What is CD? Why? How?
01
02
03
4 CONFIDENTIAL
Test Driven Development: Basics
5 CONFIDENTIAL
6 CONFIDENTIAL
TDD: Basics
− First understand the requirement
− Create test that tests this
requirement
− Run test and expect FAIL
− Provide basic implementation
− Run test and expect PASS
− Improve your implementation
− Run test after improvements to
test changes
7 CONFIDENTIAL
TDD: Example
− Requirement: validate email to match common email mask.
− username: [a-zA-Z0-9-_]+ (e.g. My_user-09)
− company: [a-zA-z0-9]+ (e.g. globallogic911)
− domain: [a-zA-Z]{2,} (e.g. com)
− E-mail structure: [username]@[company].[domain]
− Valid e-mail: test-user@domain.com
− Invalid e-mail: $uper~U$er123@ideal-company.z
8 CONFIDENTIAL
TDD: Example (cont.)
− Simple test:
public void testEmailValidationForValidEmail() {
//GIVEN
String validEmail = "sergiy-nezdoliy@globallogic.com";
//WHEN
bool result = SNUtilities.validateEmail(validEmail);
//THEN
assertTrue("Mail is valid: " + validEmail, result);
}
9 CONFIDENTIAL
TDD: Example (cont.)
− Simple implementation:
public static bool validateEmail(String intpuMail) {
return FALSE;
}
//Leads to test FAIL
//Refactor code to pass test
public static bool validateEmail(String intpuMail) {
boolean isValidEmail = false;
Pattern pattern = Pattern.compile("^[_A-Za-z0-9-]+@[A-Za-z0-9-]+((.[A-Za-z]{2,}){1}$)");
isValidEmail = pattern.matcher(inputMail).matches();
return isValidEmail;
}
//Run test and – voila, PASSED
10 CONFIDENTIAL
TDD: Example (cont.)
− Improve?
− Empty string
− Null value
− Extended mask for regexp (including dot support etc)
− Do not forget to test negative cases 
11 CONFIDENTIAL
TDD: Example (cont.)
− As a result:
//TESTS
public void testValidateNullEmail() {...}
public void testValidateEmptyValue() {...}
public void testValidateInvalidEmail() {...}
public void testValidateValidEmail() {...}
//IMPLEMENTATION
public static boolean validateEmail(String inputMail) {
boolean isValidEmail = false;
if (inputMail != null && inputMail.length() > 0) {
Pattern pattern = Pattern.compile
("^[_A-Za-z0-9-]+(.[_A-Za-z0-9]+)*@[A-Za-z0-9-]+(.[A-Za-z0-9-]+)*((.[A-Za-z]{2,}){1}$)");
isValidEmail = pattern.matcher(inputMail).matches();
}
return isValidEmail;
}
12 CONFIDENTIAL
Test Driven Development &
13 CONFIDENTIAL
TDD: Android
14 CONFIDENTIAL
TDD: Android tools
− Unit tests:
− Junit,
− Instrumentation
− UI tests:
− Instrumentation,
− Robotium, Robolectric,
− monkey, monkeyrunner
− Mocks:
− android-mock:
15 CONFIDENTIAL
TDD: Android – What to test?
− Formatters
− Parsing, serializing, marshaling data from server
− Fields input validation (e.g. e-mail field)
− Any inner calculations
− Entities, models, DAO objects
− Database layer
− UI where possible (functional and integration testing)
− …
16 CONFIDENTIAL
TDD: Android Example
//IMPLEMENTATION
public static boolean validateEmail(String inputMail) {
boolean isValidEmail = false;
if (inputMail != null && inputMail.length() > 0) {
Pattern pattern = Pattern.compile
("^[_A-Za-z0-9-]+(.[_A-Za-z0-9]+)*@[A-Za-z0-9-]+(.[A-Za-z0-9-]+)*((.[A-Za-z]{2,}){1}$)");
isValidEmail = pattern.matcher(inputMail).matches();
}
return isValidEmail;
}
//TESTS
public void testValidateNullEmail() {...}
public void testValidateEmptyValue() {...}
public void testValidateInvalidEmail() {...}
public void testValidateValidEmail() {...}
17 CONFIDENTIAL
Test Driven Development &
18 CONFIDENTIAL
TDD: iOS tools
− Unit tests:
− OCUnit, SenTestingKit (embedded into Xcode),
− GHUnit
− UI tests:
− UI Automation,
− Frank, Appium … (no success  )
− Mock:
− OCMock
19 CONFIDENTIAL
TDD: iOS– What to test? (TODO)
− Core Data layer
− Parsing, serializing, marshaling data from server
− Fields input validation (e.g. e-mail field)
− Any inner calculations
− Entities, models, DAO objects
− UI where possible (functional and integration testing)
− …
20 CONFIDENTIAL
TDD: iOS Example
//IMPLEMENTATION
+ (BOOL) validateEmail:(NSString *)inputEmail{
BOOL isEmailValid = NO;
if (inputEmail) {
NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}";
NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
isEmailValid = [emailTest evaluateWithObject:inputEmail];
}
return isEmailValid;
}
//TESTS
- (void)testValidateEmailWithValidEmail{
//GIVEN
NSString *validEmail = @"test-user01@domain.com";
//WHEN
BOOL result = [DemoUtils validateEmail:validEmail];
//THEN
STAssertTrue(result, @"Valid with email: %@", validEmail);
}
21 CONFIDENTIAL
Continuous Integration: iOS and Android
22 CONFIDENTIAL
Continuous Integration: Why?
− Reduce risks:
− Fixing bugs late costs more
− Lack of project visibility (metrics, changelogs)
− Lack of deployable software
− Reduce repetitive manual processes
− Generate deployable software any time at any place
− Test early and often
− No painful waits for next build
− Visible process of building your project
23 CONFIDENTIAL
Continuous Integration: Schema
Version Control System Build servers
QA, clients, managers
Developers
CI Server
CI Feedback
1. Check In
2. Check Out
3. Indicate
Change
5. Set Status
4. Report
Results
6. Notify
24 CONFIDENTIAL
Continuous Integration:
− Cross-system (Windows, Linux, Mac OS)
− Extensible (plenty of plugins)
− Provides good visibility of builds
− Free
− Chuck Norris supports Jenkins!
25 CONFIDENTIAL
CI: Example of dashboard
26 CONFIDENTIAL
Continuous Integration &
27 CONFIDENTIAL
Continuous Integration: How?
− Xcode command line tools (with some hacks)
− Run tests from command line and fail in case if failed tests
− ocunit2junit + gcovr for code coverage
− keychain issues
− Provisioning profiles import
− Jenkins should run only on Mac
28 CONFIDENTIAL
Continuous Integration: iOS
CI: TDD & Code coverage?
− Using gcovr tool
− Configure project to generate .gcda data (Xcode 4.6.x):
− Add to “Other C flags”: -lgcov, -ftest-coverage, -lprofile_rt
− Set “Generate Test Coverage Files” to YES
− Set “Generate Profiling Code” to YES
− run tests -> ocunit2junit to get tests results
− configure Jenkins job to handle test reports and code coverage
(Cobertura)
29 CONFIDENTIAL
Continuous Integration &
30 CONFIDENTIAL
Continuous Integration: How?
− Using ant
− Using Android build tools
− Using Jenkins plugin for Android
− Using bash
− Analyzing tests results? Hack for tests needed in build.xml
− Take a look at android-lint plugin:
− scans your Android projects and reports on potential bugs, performance, security and
translation issues, plus more
31 CONFIDENTIAL
Continuous Integration: iOS
Continuous Integration: TDD?
− Add separate target to build.xml
− Analyze results
− Fail build in case if tests fail
32 CONFIDENTIAL
Continuous Delivery
33 CONFIDENTIAL
Continuous Delivery: Why?
− Allows to provide new builds to test continuously
− Automation of providing builds to QA and customers
− Painless releases, quick feedbacks
34 CONFIDENTIAL
Continuous Delivery &
35 CONFIDENTIAL
Continuous Delivery: How?
− Installation over the air
− Downloading build as artifact from Jenkins
− Uploading to share (Android only)
− Installation over Wi Fi (iOS – manual)
− Cloud services: AppBlade, Knappsack, HockeyApp … - not Free 
− …
− TestFlightApp – ideal free solution to manage your app
36 CONFIDENTIAL
Continuous Delivery: TestFlight
37 CONFIDENTIAL
TestFlightApp: Why?
− Free
− Supports automatic uploading (can be part of Jenkins job)
− May be not embedded into app at all.
− Email notifications
− Easy to install on any allowed device (which is in Ad Hoc profile)
− Cross platform (iOS, Android)
− Provides additional services (crash reports, checkpoints etc)
− You need to include TestFlight SDK into your project for this
38 CONFIDENTIAL
TestFlightApp: example of upload
curl http://testflightapp.com/api/builds.json 
-F file=@$IPA 
-F api_token=’<YOUR API TOKEN>' 
-F team_token=’<YOUR TEAM TOKEN>' 
-F notes="Uploaded on ${BUILD_ID} (Build#: '${BUILD_NUMBER}') (Build version#: '1.0').nChanges: $git_notes" 
-F notify=True 
-F distribution_lists=”QA"
39 CONFIDENTIAL
Conclusion
CONFIDENTIAL©2013 GlobalLogic Inc.
Skype: sergey.nezdoliy
Twitter: @sergey_nezdoliy
Mail: sergey.nezdoliy@gmail.com
Thank you

More Related Content

What's hot

Continuous integration testing fundamentals
Continuous integration testing fundamentalsContinuous integration testing fundamentals
Continuous integration testing fundamentals
Cygnet Infotech
 

What's hot (20)

Tools for Software Testing
Tools for Software TestingTools for Software Testing
Tools for Software Testing
 
Continuous Integration - Oracle Database Objects
Continuous Integration - Oracle Database ObjectsContinuous Integration - Oracle Database Objects
Continuous Integration - Oracle Database Objects
 
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValueDevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
DevOps Continuous Integration & Delivery - A Whitepaper by RapidValue
 
Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration Continuous Delivery, Continuous Integration
Continuous Delivery, Continuous Integration
 
How to Embed Codeless Test Automation Into DevOps
How to Embed Codeless Test Automation Into DevOpsHow to Embed Codeless Test Automation Into DevOps
How to Embed Codeless Test Automation Into DevOps
 
Continuous testing for devops
Continuous testing for devopsContinuous testing for devops
Continuous testing for devops
 
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latestColorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latest
 
Continuous Delivery
Continuous DeliveryContinuous Delivery
Continuous Delivery
 
Start Your Automation Journey With Rapise
Start Your Automation Journey With Rapise Start Your Automation Journey With Rapise
Start Your Automation Journey With Rapise
 
Continuous everything
Continuous everythingContinuous everything
Continuous everything
 
10 Benefits of Automated Testing
10 Benefits of Automated Testing10 Benefits of Automated Testing
10 Benefits of Automated Testing
 
Build your QA Pipeline using Serenity , Selenium WebDriver , Rest Assured and...
Build your QA Pipeline using Serenity , Selenium WebDriver , Rest Assured and...Build your QA Pipeline using Serenity , Selenium WebDriver , Rest Assured and...
Build your QA Pipeline using Serenity , Selenium WebDriver , Rest Assured and...
 
Mobile Quality Assurance
Mobile Quality AssuranceMobile Quality Assurance
Mobile Quality Assurance
 
Increasing Quality with DevOps
Increasing Quality with DevOpsIncreasing Quality with DevOps
Increasing Quality with DevOps
 
Automation Tools Overview
Automation Tools OverviewAutomation Tools Overview
Automation Tools Overview
 
Elements of a Test Framework
Elements of a Test FrameworkElements of a Test Framework
Elements of a Test Framework
 
Introduction to Test Automation - Technology and Tools
Introduction to Test Automation - Technology and ToolsIntroduction to Test Automation - Technology and Tools
Introduction to Test Automation - Technology and Tools
 
Continuous integration testing fundamentals
Continuous integration testing fundamentalsContinuous integration testing fundamentals
Continuous integration testing fundamentals
 
Drive Faster Quality Insights through Customized Test Automation - Part 2
Drive Faster Quality Insights through Customized Test Automation - Part 2Drive Faster Quality Insights through Customized Test Automation - Part 2
Drive Faster Quality Insights through Customized Test Automation - Part 2
 
Building Security in Using CI
Building Security in Using CIBuilding Security in Using CI
Building Security in Using CI
 

Similar to Mobile Apps development best practices. TDD, CI, CD

Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...
Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...
Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...
Acquia
 

Similar to Mobile Apps development best practices. TDD, CI, CD (20)

Automated CI with AEM Cloud service
Automated CI with AEM Cloud serviceAutomated CI with AEM Cloud service
Automated CI with AEM Cloud service
 
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...
 
NET Code Testing
NET Code TestingNET Code Testing
NET Code Testing
 
Binary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code TestingBinary Studio Academy: .NET Code Testing
Binary Studio Academy: .NET Code Testing
 
High Productivity Web Development Workflow
High Productivity Web Development WorkflowHigh Productivity Web Development Workflow
High Productivity Web Development Workflow
 
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
 
AzureDay Kyiv 2016 Release Management
AzureDay Kyiv 2016 Release ManagementAzureDay Kyiv 2016 Release Management
AzureDay Kyiv 2016 Release Management
 
Turbocharge Your Automation Framework to Shorten Regression Execution Time
Turbocharge Your Automation Framework to Shorten Regression Execution TimeTurbocharge Your Automation Framework to Shorten Regression Execution Time
Turbocharge Your Automation Framework to Shorten Regression Execution Time
 
Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...
Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...
Drupal 8 Lessons From the Field: What is Continuous Delivery and Why it’s imp...
 
Developers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomonDevelopers Testing - Girl Code at bloomon
Developers Testing - Girl Code at bloomon
 
Continuous testing
Continuous testingContinuous testing
Continuous testing
 
Deploying large-scale, serverless and asynchronous systems - without integrat...
Deploying large-scale, serverless and asynchronous systems - without integrat...Deploying large-scale, serverless and asynchronous systems - without integrat...
Deploying large-scale, serverless and asynchronous systems - without integrat...
 
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
Дмитрий Лемешко. Comaqa Spring 2018. Continuous mobile automation in build pi...
 
Developing ML-enabled Data Pipelines on Databricks using IDE & CI/CD at Runta...
Developing ML-enabled Data Pipelines on Databricks using IDE & CI/CD at Runta...Developing ML-enabled Data Pipelines on Databricks using IDE & CI/CD at Runta...
Developing ML-enabled Data Pipelines on Databricks using IDE & CI/CD at Runta...
 
Continuous Integration to Shift Left Testing Across the Enterprise Stack
Continuous Integration to Shift Left Testing Across the Enterprise StackContinuous Integration to Shift Left Testing Across the Enterprise Stack
Continuous Integration to Shift Left Testing Across the Enterprise Stack
 
Innovate 2014: Get an A+ on Testing Your Enterprise Applications with Rationa...
Innovate 2014: Get an A+ on Testing Your Enterprise Applications with Rationa...Innovate 2014: Get an A+ on Testing Your Enterprise Applications with Rationa...
Innovate 2014: Get an A+ on Testing Your Enterprise Applications with Rationa...
 
Tce automation-d4
Tce automation-d4Tce automation-d4
Tce automation-d4
 
Secure DevOps: A Puma's Tail
Secure DevOps: A Puma's TailSecure DevOps: A Puma's Tail
Secure DevOps: A Puma's Tail
 
Quickstart for continuous integration
Quickstart for continuous integrationQuickstart for continuous integration
Quickstart for continuous integration
 
Sailing through devlopment with legacy code
Sailing through devlopment with legacy codeSailing through devlopment with legacy code
Sailing through devlopment with legacy code
 

More from GlobalLogic Ukraine

GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Ukraine
 

More from GlobalLogic Ukraine (20)

GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
GlobalLogic JavaScript Community Webinar #18 “Long Story Short: OSI Model”
 
Штучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptxШтучний інтелект як допомога в навчанні, а не замінник.pptx
Штучний інтелект як допомога в навчанні, а не замінник.pptx
 
Задачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptxЗадачі AI-розробника як застосовується штучний інтелект.pptx
Задачі AI-розробника як застосовується штучний інтелект.pptx
 
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptxЩо треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
Що треба вивчати, щоб стати розробником штучного інтелекту та нейромереж.pptx
 
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
GlobalLogic Java Community Webinar #16 “Zaloni’s Architecture for Data-Driven...
 
JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"JavaScript Community Webinar #14 "Why Is Git Rebase?"
JavaScript Community Webinar #14 "Why Is Git Rebase?"
 
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
GlobalLogic .NET Community Webinar #3 "Exploring Serverless with Azure Functi...
 
Страх і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic EducationСтрах і сила помилок - IT Inside від GlobalLogic Education
Страх і сила помилок - IT Inside від GlobalLogic Education
 
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
GlobalLogic .NET Webinar #2 “Azure RBAC and Managed Identity”
 
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”GlobalLogic QA Webinar “What does it take to become a Test Engineer”
GlobalLogic QA Webinar “What does it take to become a Test Engineer”
 
“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?“How to Secure Your Applications With a Keycloak?
“How to Secure Your Applications With a Keycloak?
 
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
GlobalLogic Machine Learning Webinar “Advanced Statistical Methods for Linear...
 
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
GlobalLogic Machine Learning Webinar “Statistical learning of linear regressi...
 
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
GlobalLogic C++ Webinar “The Minimum Knowledge to Become a C++ Developer”
 
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
Embedded Webinar #17 "Low-level Network Testing in Embedded Devices Development"
 
GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"GlobalLogic Webinar "Introduction to Embedded QA"
GlobalLogic Webinar "Introduction to Embedded QA"
 
C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"C++ Webinar "Why Should You Learn C++ in 2021-22?"
C++ Webinar "Why Should You Learn C++ in 2021-22?"
 
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
GlobalLogic Test Automation Live Testing Session “Android Behind UI — Testing...
 
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
GlobalLogic Azure TechTalk ONLINE “Marketing Data Lake in Azure”
 
GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”
GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”
GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”
 

Recently uploaded

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
 

Recently uploaded (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Mobile Apps development best practices. TDD, CI, CD

  • 1. ©2013 GlobalLogic Inc. CONFIDENTIAL
  • 2. CONFIDENTIAL©2013 GlobalLogic Inc. Mobile Dev Guide: TDD + CI + CD TDD: Test Driven Development CI: Continuous Integration CD: Continuous Delivery
  • 3. ©2013 GlobalLogic Inc. CONFIDENTIAL What is TDD? Why? How? What is CI? Why? How? What is CD? Why? How? 01 02 03
  • 4. 4 CONFIDENTIAL Test Driven Development: Basics
  • 6. 6 CONFIDENTIAL TDD: Basics − First understand the requirement − Create test that tests this requirement − Run test and expect FAIL − Provide basic implementation − Run test and expect PASS − Improve your implementation − Run test after improvements to test changes
  • 7. 7 CONFIDENTIAL TDD: Example − Requirement: validate email to match common email mask. − username: [a-zA-Z0-9-_]+ (e.g. My_user-09) − company: [a-zA-z0-9]+ (e.g. globallogic911) − domain: [a-zA-Z]{2,} (e.g. com) − E-mail structure: [username]@[company].[domain] − Valid e-mail: test-user@domain.com − Invalid e-mail: $uper~U$er123@ideal-company.z
  • 8. 8 CONFIDENTIAL TDD: Example (cont.) − Simple test: public void testEmailValidationForValidEmail() { //GIVEN String validEmail = "sergiy-nezdoliy@globallogic.com"; //WHEN bool result = SNUtilities.validateEmail(validEmail); //THEN assertTrue("Mail is valid: " + validEmail, result); }
  • 9. 9 CONFIDENTIAL TDD: Example (cont.) − Simple implementation: public static bool validateEmail(String intpuMail) { return FALSE; } //Leads to test FAIL //Refactor code to pass test public static bool validateEmail(String intpuMail) { boolean isValidEmail = false; Pattern pattern = Pattern.compile("^[_A-Za-z0-9-]+@[A-Za-z0-9-]+((.[A-Za-z]{2,}){1}$)"); isValidEmail = pattern.matcher(inputMail).matches(); return isValidEmail; } //Run test and – voila, PASSED
  • 10. 10 CONFIDENTIAL TDD: Example (cont.) − Improve? − Empty string − Null value − Extended mask for regexp (including dot support etc) − Do not forget to test negative cases 
  • 11. 11 CONFIDENTIAL TDD: Example (cont.) − As a result: //TESTS public void testValidateNullEmail() {...} public void testValidateEmptyValue() {...} public void testValidateInvalidEmail() {...} public void testValidateValidEmail() {...} //IMPLEMENTATION public static boolean validateEmail(String inputMail) { boolean isValidEmail = false; if (inputMail != null && inputMail.length() > 0) { Pattern pattern = Pattern.compile ("^[_A-Za-z0-9-]+(.[_A-Za-z0-9]+)*@[A-Za-z0-9-]+(.[A-Za-z0-9-]+)*((.[A-Za-z]{2,}){1}$)"); isValidEmail = pattern.matcher(inputMail).matches(); } return isValidEmail; }
  • 14. 14 CONFIDENTIAL TDD: Android tools − Unit tests: − Junit, − Instrumentation − UI tests: − Instrumentation, − Robotium, Robolectric, − monkey, monkeyrunner − Mocks: − android-mock:
  • 15. 15 CONFIDENTIAL TDD: Android – What to test? − Formatters − Parsing, serializing, marshaling data from server − Fields input validation (e.g. e-mail field) − Any inner calculations − Entities, models, DAO objects − Database layer − UI where possible (functional and integration testing) − …
  • 16. 16 CONFIDENTIAL TDD: Android Example //IMPLEMENTATION public static boolean validateEmail(String inputMail) { boolean isValidEmail = false; if (inputMail != null && inputMail.length() > 0) { Pattern pattern = Pattern.compile ("^[_A-Za-z0-9-]+(.[_A-Za-z0-9]+)*@[A-Za-z0-9-]+(.[A-Za-z0-9-]+)*((.[A-Za-z]{2,}){1}$)"); isValidEmail = pattern.matcher(inputMail).matches(); } return isValidEmail; } //TESTS public void testValidateNullEmail() {...} public void testValidateEmptyValue() {...} public void testValidateInvalidEmail() {...} public void testValidateValidEmail() {...}
  • 18. 18 CONFIDENTIAL TDD: iOS tools − Unit tests: − OCUnit, SenTestingKit (embedded into Xcode), − GHUnit − UI tests: − UI Automation, − Frank, Appium … (no success  ) − Mock: − OCMock
  • 19. 19 CONFIDENTIAL TDD: iOS– What to test? (TODO) − Core Data layer − Parsing, serializing, marshaling data from server − Fields input validation (e.g. e-mail field) − Any inner calculations − Entities, models, DAO objects − UI where possible (functional and integration testing) − …
  • 20. 20 CONFIDENTIAL TDD: iOS Example //IMPLEMENTATION + (BOOL) validateEmail:(NSString *)inputEmail{ BOOL isEmailValid = NO; if (inputEmail) { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,4}"; NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; isEmailValid = [emailTest evaluateWithObject:inputEmail]; } return isEmailValid; } //TESTS - (void)testValidateEmailWithValidEmail{ //GIVEN NSString *validEmail = @"test-user01@domain.com"; //WHEN BOOL result = [DemoUtils validateEmail:validEmail]; //THEN STAssertTrue(result, @"Valid with email: %@", validEmail); }
  • 22. 22 CONFIDENTIAL Continuous Integration: Why? − Reduce risks: − Fixing bugs late costs more − Lack of project visibility (metrics, changelogs) − Lack of deployable software − Reduce repetitive manual processes − Generate deployable software any time at any place − Test early and often − No painful waits for next build − Visible process of building your project
  • 23. 23 CONFIDENTIAL Continuous Integration: Schema Version Control System Build servers QA, clients, managers Developers CI Server CI Feedback 1. Check In 2. Check Out 3. Indicate Change 5. Set Status 4. Report Results 6. Notify
  • 24. 24 CONFIDENTIAL Continuous Integration: − Cross-system (Windows, Linux, Mac OS) − Extensible (plenty of plugins) − Provides good visibility of builds − Free − Chuck Norris supports Jenkins!
  • 27. 27 CONFIDENTIAL Continuous Integration: How? − Xcode command line tools (with some hacks) − Run tests from command line and fail in case if failed tests − ocunit2junit + gcovr for code coverage − keychain issues − Provisioning profiles import − Jenkins should run only on Mac
  • 28. 28 CONFIDENTIAL Continuous Integration: iOS CI: TDD & Code coverage? − Using gcovr tool − Configure project to generate .gcda data (Xcode 4.6.x): − Add to “Other C flags”: -lgcov, -ftest-coverage, -lprofile_rt − Set “Generate Test Coverage Files” to YES − Set “Generate Profiling Code” to YES − run tests -> ocunit2junit to get tests results − configure Jenkins job to handle test reports and code coverage (Cobertura)
  • 30. 30 CONFIDENTIAL Continuous Integration: How? − Using ant − Using Android build tools − Using Jenkins plugin for Android − Using bash − Analyzing tests results? Hack for tests needed in build.xml − Take a look at android-lint plugin: − scans your Android projects and reports on potential bugs, performance, security and translation issues, plus more
  • 31. 31 CONFIDENTIAL Continuous Integration: iOS Continuous Integration: TDD? − Add separate target to build.xml − Analyze results − Fail build in case if tests fail
  • 33. 33 CONFIDENTIAL Continuous Delivery: Why? − Allows to provide new builds to test continuously − Automation of providing builds to QA and customers − Painless releases, quick feedbacks
  • 35. 35 CONFIDENTIAL Continuous Delivery: How? − Installation over the air − Downloading build as artifact from Jenkins − Uploading to share (Android only) − Installation over Wi Fi (iOS – manual) − Cloud services: AppBlade, Knappsack, HockeyApp … - not Free  − … − TestFlightApp – ideal free solution to manage your app
  • 37. 37 CONFIDENTIAL TestFlightApp: Why? − Free − Supports automatic uploading (can be part of Jenkins job) − May be not embedded into app at all. − Email notifications − Easy to install on any allowed device (which is in Ad Hoc profile) − Cross platform (iOS, Android) − Provides additional services (crash reports, checkpoints etc) − You need to include TestFlight SDK into your project for this
  • 38. 38 CONFIDENTIAL TestFlightApp: example of upload curl http://testflightapp.com/api/builds.json -F file=@$IPA -F api_token=’<YOUR API TOKEN>' -F team_token=’<YOUR TEAM TOKEN>' -F notes="Uploaded on ${BUILD_ID} (Build#: '${BUILD_NUMBER}') (Build version#: '1.0').nChanges: $git_notes" -F notify=True -F distribution_lists=”QA"
  • 40. CONFIDENTIAL©2013 GlobalLogic Inc. Skype: sergey.nezdoliy Twitter: @sergey_nezdoliy Mail: sergey.nezdoliy@gmail.com Thank you