Continuous Delivery for Mobile with fastlane - Doron Katz - E-Book

Continuous Delivery for Mobile with fastlane E-Book

Doron Katz

0,0
34,79 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Competitive mobile apps depend strongly on the development team’s ability to deliver successful releases, consistently and often. Although continuous integration took a more mainstream priority among the development industry, companies are starting to realize the importance of continuity beyond integration and testing.
This book starts off with a brief introduction to fastlane—a robust command-line tool that enables iOS and Android developers to automate their releasing workflow.
The book then explores and guides you through all of its features and utilities; it provides the reader a comprehensive understanding of the tool and how to implement them. Themes include setting up and managing your certificates and provisioning and push notification profiles; automating the creation of apps and managing the app metadata on iTunes Connect and the Apple Developer Portal; and building, distributing and publishing your apps to the App Store.
You will also learn how to automate the generation of localized screenshots and mesh your continuous delivery workflow into a continuous integration workflow for a more robust setup. By the end of the book, you will gain substantial knowledge on delivering bug free, developer-independent, and stable application release cycle.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 295

Veröffentlichungsjahr: 2018

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Continuous Delivery for Mobile with fastlane

 

 

Automating mobile application development and deployment for iOS and Android

 

 

 

 

 

 

 

 

 

Doron Katz

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BIRMINGHAM - MUMBAI

Continuous Delivery for Mobile with fastlane

Copyright © 2018 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

Content Contributor: Kyle MewCommissioning Editor: Kunal ChaudhariAcquisition Editor: Isha RavalContent Development Editor:Jason PereiraTechnical Editor: Rutuja VazeCopy Editor: Safis EditingProject Coordinator: Sheejal ShahProofreader: Safis EditingIndexer: Rekha NairGraphics: Jason MonteiroProduction Coordinator: Deepika Naik

First published: February 2018

Production reference: 1270218

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-78839-851-0

www.packtpub.com

To my father, Angelo, for his inspiration and direction in molding what my career has become from pursuing computer science and falling in love with programming from an early age. To my wife, Serena, for her infinite patience throughout the late nights spent writing this book, and being the candle light of my life. 
– Doron Katz
mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

PacktPub.com

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

Foreword

Being an iOS developer for the last 6 years, I have spent a lot of time dealing with code signing, preparing localized screenshots, and doing manual deployments. After working on my first Ruby on Rails application, I saw how easy the release of software could be, so I decided to build fastlane.

fastlane solves all of the problems around iOS tooling that larger mobile development teams experience as they grow—automatic building, code signing, screenshots, push certificates, and others. Before fastlane, most companies maintained their own shell scripts, resulting in breaking builds every other month due to changes in the Xcode build system.

In this book, Doron gives an introduction to fastlane, and how you can use it to optimize your mobile development process. While fastlane offers documentation online, this book is a great resource to get started with mobile app automation using fastlane. Doron did a great job going through the available fastlane features and how you can make use of them.

 

Felix KrauseFounder of fastlane

Contributors

About the author

Doron Katz, originally from Sydney, Australia, completed his bachelor's in internet science (the University of Wollongong), before pursuing a master's in management (Charles Sturt University), including a certification in Microsoft Solutions Development.

On moving to San Francisco, Doron has worked with various companies, from start-ups to larger organizations, as a software engineer and project manager. Additionally, he is a regular contributor to various distinguished technical publications and has published numerous white papers and also coauthored Developing an iOS Edge.

I'd like to thank my father, Angelo, for inspiring me to be my best and pursue the technical path I eventually took; my mother for being so strong and inspirational; my wife, Serena, for being a source of support for me; and finally, Felix Krause, for authoring such a great tool in fastlane, supporting me, and writing the foreword for this book. I'd also like to thank Kyle Mew for his contribution to the content of the book.

About the reviewers

Dario started his career as an iOS developer in Rome, the eternal city, when he was 20. The context he liked most and which helped him to grow was working on the instant messaging platforms context with MONK software.

After four years in Rome, he realized he needed to be surrounded by a more international environment. Almost one year ago, he joined Tictrac, a London-based start-up that helps people to take care of themselves by providing health advice.

He loves travel, rock music, pasta, and red wine.

 

Muhammad Ali Ejaz currently works as a software development engineer at Amazon. His experience ranges from working as a developer to cofounding a start-up, to serving in outreach organizations, to giving talks on CI/CD at various prestigious conferences. His passion for computer science is reflected in his contributions to open source projects, such as GoCD and his role as a volunteer computer science teacher for underprivileged kids.

When he is not coding, he enjoys traveling, reading, and tasting new cuisines. You can follow him on Twitter using the handle @mdaliejaz.

I want to thank my Mom and Dad, who have always been my inspiration. I’d also like to thank Ahmad and Sana, my siblings, who have been a constant source of cheerful support. A lot of what I am today is because of them.

Amit Kothari is a full-stack developer based in Melbourne, Australia. He has more than 12 years, experience in designing and developing software systems, and has worked on a wide range of projects across various domains, including telecommunication, retail, banking, and finance.

Amit is also the coauthor of the book—Chatbots for eCommerce: Learn how to build a virtual shopping assistant.

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Title Page

Copyright and Credits

Continuous Delivery for Mobile with fastlane

Dedication

www.PacktPub.com

Why subscribe?

PacktPub.com

Foreword

Contributors

About the author

About the reviewers

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Conventions used

Get in touch

Reviews

Introduction to fastlane and Continuous Delivery

Welcome to fastlane

Automation testing

Unit testing

Regression testing

Integration testing

Acceptance testing 

Continuous Integration 

Continuous Deployment

What is continuous delivery?

Benefits of CI, delivery, and deployment

What is fastlane?

Why fastlane?

The fastlane suite of tools

Spaceship under the hood

Accessing the fastlane documentation

Summary

Setting Up fastlane and Our Sample Project

Installing the Xcode command-line tools

Installing Homebrew, Git, and fastlane

Alternative methods of installing fastlane 

Updating fastlane

Installing Carthage

Troubleshooting common problems

Setting up our project – Firefox for iOS

Running Firefox for iOS

Configuring fastlane

Updating fastlane

Summary

Manage Provisioning Profiles with sigh

Introduction

Development distribution overview

Enrollment

Individuals

Organizations

Educational institutions

Develop

Distribute

What are provisioning profiles?

About Bundle IDs

Types of provisioning profiles

The development team provisioning profile

Ad hoc provisioning profile

App Store provisioning profile

Enterprise provisioning profiles

Expiration of provisioning profiles

Introducing sigh

Usage

List of sigh commands

Our project problem

Updating our Fastfile

Summary

Manage Code Signing Certificates with cert

What you will learn

Skills learned

What are certificates?

Developer and distribution certificates

Development certificate

Distribution certificate

Managing certificates manually

Creating a certificate through Xcode

Creating a certificate through the developer portal

Verifying the private/public keys in keychain throughout this workflow, when using your certificate and provisioning profile, you need

Installing missing intermediate certificate authorities

Recreating certificates

Backing up certificates and provisioning profiles

Introducing cert

Usage

List of cert commands

Our project problem

Updating our fastfile

Summary

Sync Profiles and Certificates with match

Collective code signing

Security 

Portal access management

Git access management

Encryption

Introducing match

Create a private Git repository

Initialize match

Running match for the first time

Recreating development certificates and provisioning profiles

Adding new team members

Handling multiple targets

Adding new devices

Our project problem

List of match commands

Summary

Manage Push Notification Profiles with pem

What push notifications are

How push notifications work

Provider

APNs

APNs-device trust connection

Local versus remote push notifications

Enabling push notifications

Enabling push notifications the traditional way via Xcode

Introducing pem

List of pem commands

Updating our Fastfile

Summary

Creating Our iOS and Android Apps with produce and supply

The process of creating an iOS

Registering your App ID with produce

Provisioning your app

Certificating your app

Distributing code-signing identities

Managing push notifications

Building and packaging your app

iTunes Connect versus Developer portal

Adding capabilities

iCloud/CloudKit

Passbook/Wallet

Apple Pay

In-App Purchase

Map/Location

Background Modes

App Groups

Inter-App Audio

HealthKit

Data Protection

Adding HomeKit support

Adding Associated Domains support

Keychain sharing support

Push notifications

Introducing produce

Usage

Enabling services

Optional parameters

App and bundle ID

Skipping iTunes Connect or Dev Center

Creating and associating a new app group

Updating our Fastfile

Introducing supply

Setting up a Google Play developer account

Setting up fastlane and supply

Using supply

Summary

Build and Package Apps for the App Store with gym

Traditional process of building an app

Using Xcode to build an app

Distributing your app for testing

Using xcodebuild to build an app for testing

Introducing gym

Usage

Parameters and options

Manifest files/app thinning

Storing gym configurations externally with a Gymfile

Exporting plist files

Updating our Fastfile

Summary

Distribute to Testers with TestFlight and Crashlytics

An overview of testing

Continuous delivery and testing

Beta testing tools

Overview of TestFlight

Setting up TestFlight

App information

Upload your test build

Managing and adding internal and external testers

View tester information

Crashlytics

Setting up Crashlytics

Distributing to Crashlytics manually

Introducing Pilot

Uploading a TestFlight build with fastlane

Listing all the builds

Managing TestFlight users with fastlane

Onboard new testers on TestFlight with onboard

Updating our Fastfile

Crashlytics and fastlane

Summary

Review Your App Metadata with precheck

An overview of App Store rules

App Store Review Guidelines

Safety

Objectionable content

User-generated content

Child content

Physical harm

Developer information

Performance related issues

Business related issues

Design related issues

Legal related issues

Common app rejections

Handy guideline references

Introducing precheck

Running a precheck

Precheckfile configuration

Updating our Fastfile

Summary

Taking Localized Screenshots with snapshot

An overview of capturing screenshots on iOS simulator

An overview of UI testing

XCTest framework

UI tests

XCUIApplication

XCUIElement

XCUIElementQuery

Accessibility

Introducing snapshot

Setting up snapshot in your project

Creating the UI Test Target

Initializing snapshot

Adding SnapshotHelper.swift to the target

Recording your app interactions

Generating snapshots

Confirming the screenshots

Other snapshot options

Working with snapfiles

Running Xcode simulators concurrently

Updating our Fastfile

An introduction to screengrab

Summary

Put Our Screenshots Inside Frames with frameit

An overview of how to design your App Store product page screenshots

Beautifying screenshots

Downloading the template files

Adding your own screenshots

Exporting the screenshots

Dealing with device variants for screenshots

Introducing frameit

Running a basic frameit command

Making our frames App Store compliant

Updating our Fastfile

Summary

Upload Screenshots and Metadata with deliver

How to manually upload a new build to iTunes Connect

Uploading using Xcode

Updating version and build number

Archiving

Uploading using Application Loader

Entering your app metadata

Submitting your app to be reviewed

Introducing deliver

Generating your deliverfile metadata

Uploading our metadata

Other deliver options

Updating our Fastfile

Summary

Automate Unit Tests with scan

An introduction to testing in iOS 11 and Swift 4

Create a test target

Adding a simple unit test

Examining other test cases

Introducing scan

Running a simple scan

Viewing the output results

Running a specific scan

Generating a Scanfile

Updating our Fastfile

Summary

Integrating Git into the fastlane Workflow

Introducing the various Git actions and commands

ensure_git_status_clean

ensure_git_branch

create_pull_request

git_pull

git_commit

push_to_git_remote

git_tag_exists

add_git_tag

push_git_tags

Calling bash commands using fastlane

Improving and optimizing our fastlane workflow

Working with the before_all lane

Ensuring our fastlane is always the latest

Optimizing our beta distribution workflow

Getting the latest code and ensuring a clean Git status

Building our app and running tests

Getting a list of commits to form the changelog

Bumping our project version, committing, and pushing our changes to Git

Summary

Creating and Using fastlane Action Plugins

Discovering new action plugins

build-in plugins

Third-party plugins

Implementing a fastlane plugin

self.run

self.description

self.details

self.available_options

self.example_code

self.category

self.authors

Creating your own fastlane plugin

Creating our new plugin

Creating our first Action

Testing our plugin

Publishing your plugin

Summary

Integrating Slack into the fastlane Workflow

Introducing Slack – a developer's communications platform of choice

Configuring Slack webhooks to connect to fastlane

Adding Slack actions into our workflow

Slack action arguments

Summary

Continuous Delivery Best Practices

Organizing your lanes

before_all and after_all lanes

Managing errors and exceptions

Managing the rest of our lanes

Making use of configuration files

Appfile

Deliverfile

Gymfile

Snapfile

Framefile

Matchfile

Scanfile

Real-world examples of configuration files

Private lanes and lane contexts

Final words

Configurations, Tools, and Resources

What you will learn

Skills learned

Working with fastlane and Gemfiles

Setting up two-factor authentication for your CI

Online resources

Other Books You May Enjoy

Leave a review - let other readers know what you think

Preface

While working for a start-up in San Francisco, as an iOS developer, I've had the arduous recurring task of having to gather all the coding contributions from my fellow colleagues, run some tests, and package the project for the stakeholders and beta testers to test, find bugs, patch, and re-distribute. 

Finally, when we get to the green-light stage, we package the application once again for publication to the App Store, update the metadata, update or add new screenshots, and so forth. Of course, with start-ups growing as rapidly as they do, so do the size of their development teams, which leaves you having to spend time on-boarding the new team members and setting up their environments with provisioning profiles and certificates. 

Having your attention and focus diverted from your primary goal of feature development bug fixing in order to deal with  repetitious application-delivery tasks is certainly frustrating, which is what inspired me to investigate ways to automate this process. 

We already implement regression testing in an automated manner, through continuous integration, so there should be a way of being able to automate the process of packaging our apps, pushing them to TestFlight or the App Store, and dealing with provisioning our apps. Introducing fastlane...

Who this book is for

fastlane is a powerful Ruby-powered toolchain that empowers iOS (and Android) developers to automate the process of delivery through what is called continuous delivery. If your passion is for developing workflows that automate the process of building and packaging your apps for distribution, without having to deal with provisioning and other code-signing processes, this book is for you.

This book is primarily targeted at mobile developers (iOS primarily), although we will be touching on some tools that Android developers can take advantage of. This isn't a Swift or Objective-C book, and you will certainly be able to follow with just some basic mobile development skills, although we will be working a lot in the command line as well as Apple's Developer portal and iTunes Connect. Some knowledge of how apps are built, provisioned, signed, and distributed will be helpful, but we will also be introducing a lot of the basic concepts in each of the chapters. 

What this book covers

Chapter 1, Introduction to fastlane and Continuous Delivery, is an introduction to the fastlane toolchain, and why you should adopt continuous delivery as part of your workflow. 

Chapter 2, Setting Up fastlane and Our Sample Project, sets you up for the rest of the chapters by guiding you through setting up and installing fastlane and the sample project. 

Chapter 3, Manage Provisioning Profiles with sigh, covers how to manage provisioning profiles manually via Xcode and how to leverage fastlane to automate the process of provisioning your apps using sigh. 

Chapter 4, Manage Code Signing Certificates with cert, explains how to work with developer and production certificates using Xcode, and how to leverage fastlane to automate the process of certifying your apps using cert. 

Chapter 5, Sync Profiles and Certificates with match, covers how to improve your certificate and provisioning workflows leveraging match, making it easier for you to on-board new developers and share the right code-signing credentials to get that developer started right away.

Chapter 6, Manage Push Notification Profiles with pem, discusses how to manage push notification profiles manually, and automate your workflow using fastlane and pem. 

Chapter 7, Creating Our iOS and Android Apps with produce and supply, goes through how to easily create your app on iTunes Connect and the Developer portal via terminal and produce, by using fastlane, or by creating an Android app on the Google Play Store using Supply. 

Chapter 8, Build and Package Apps for the App Store with gym, explains how to build and package your apps the traditional way using Xcode, and how to leverage gym as part of your fastlane continuous delivery workflow to automate building and packaging your apps.

Chapter 9, Distribute to Testers with TestFlight and Crashlytics, covers how to add continuous delivery distribution to your testers using TestFlight and Crashlytics within fastlane. 

Chapter 10, Review Your App Metadata with precheck, explains how to automate the process of reviewing your app for red flags using precheck prior to uploading your app to the App Store for review. 

Chapter 11, Taking Localized Screenshots with snapshot, tells you how to automatically generate screenshots of your apps for iTunes Connect using snapshot. 

Chapter 12, Put Our Screenshots inside Frames with frameit, discusses how to prettify your screenshots by putting them inside frames using fastlane's frameit action.

Chapter 13, Upload Screenshots and Metadata with deliver, explains how to deliver your generated and prettified screenshots automatically to iTunes Connect, as part of your fastlane workflow, using deliver. 

Chapter 14, Automate Unit Tests with Scan, covers how to include automated testing as part of your fastlane workflow and continuous delivery goals using scan. 

Chapter 15, Integrating Git into the fastlane Workflow, discusses how to leverage the industry-leading Jenkins CI within your fastlane workflow in order to integrate continuous delivery with continuous integration for a completely robust, agile, end-to-end system workflow. 

Chapter 16, Creating and Using fastlane Action Plugins, explains how to make use of some powerful Git commands within fastlane in order to build an intimate relationship between your code repository and your continuous delivery workflow. 

Chapter 17, Integrating Slack into the fastlane Workflow, covers how to enrich and empower your fastlane continuous delivery workflow by leveraging system and third-party action plugins. 

Chapter 18, Continuous Delivery Best Practices, explains how to leverage the popular communications platform Slack to inform your development team as part of your continuous delivery workflow. 

Appendix, Configurations, Tools, and Resources, contains tips on how to make the most of fastlane through best practices and anti-patterns. 

To get the most out of this book

You are encouraged to follow the examples sequentially, from Chapter 1, Introduction to fastlane and Continuous Delivery,  to the final chapter, using the sample project and code.

The Chapter 2, Setting Up fastlane and Our Sample Project, covers setting up your environment, installing fastlane, and any other prerequisite tools.

You will also need to have an active Apple Developer account, which you can get from developer.apple.com.

Download the example code files

You can download the example code files for this book from your account at www.packtpub.com. If you purchased this book elsewhere, you can visit www.packtpub.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

Log in or register at

www.packtpub.com

.

Select the

SUPPORT

tab.

Click on

Code Downloads & Errata

.

Enter the name of the book in the

Search

box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR/7-Zip for Windows

Zipeg/iZip/UnRarX for Mac

7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub athttps://github.com/PacktPublishing/Continuous-Delivery-for-Mobile-with-fastlane/tree/master. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available athttps://github.com/PacktPublishing/. Check them out!

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Open Client.xcodeproj in Xcode, then switch to the Fennec scheme."

A block of code is set as follows:

export_options( method: "ad-hoc", provisioningProfiles: { "com.doronkatz.firefox": "Provisioning Profile Name" }, manifest: { appURL: "https://yourapp.com/yourapp.ipa", }, thinning: "<thin-for-all-variants>" )

Any command-line input or output is written as follows:

fastlane init

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "You are also able to create new signing identities from this dialog screen by selecting the Create button."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email [email protected] and mention the book title in the subject of your message. If you have questions about any aspect of this book, please email us at [email protected].

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packtpub.com.

Introduction to fastlane and Continuous Delivery

Welcome to the first chapter in Continuous Delivery for Mobile with fastlane, as we begin our exciting journey of making our lives as developers more efficient. Before we begin to dive deeper into all the powerful tools that make up fastlane, we will first talk about what fastlane is, giving you a high-level introduction to the suite of tools that make up this powerful toolset, and explain why you need them.

This chapter will serve a segue into the subsequent chapters of this book, offering a broad understanding of what the fastlane suite of tools consists of before we start setting up our project and fastlane environments.

Welcome to fastlane

As mobile developers, we constantly strive for efficiency, optimizing our code base through refactoring, proper code decoupling, intelligent code reusability, and other object-oriented best practices. These are even more pivotal when working in teams, working with tools like Git for collaborative code sharing, and tracking tasks using agile methodologies.

For project managers, being able to mitigate risks, reduce risks, and quantify development is pivotal to a project's success. This is what has led to the umbrella concept of Continuous Development, which encompasses the iterative methodologies of Continuous Integration (CI) and continuous deployment and delivery.

Development is a complicated domain in and of itself, and through rapidly introducing new code authored by different developers, the risk of introducing bugs is extremely likely. Besides the obvious errors, regression issues can many times be masked into future iterations, only to be discovered later, when technical code commitment is deeply entrenched. 

Automation testing

Continuous Delivery (CD) and Continuous Integration (CI) have emerged as an industry standard in order to instill confidence in each iteration of code change. Tool automation relies on automation testing, which is broken down into several types of testing and testing categories:

Unit testing

Regression testing

Integration testing

Acceptance testing

Unit testing

Unit testing is the lowest level of testing, whereby the developer asserts a set of conditions that need to be true, as well as some that should be false and should essentially be very narrow and well-defined in scope. For instance, developers would assert what should happen when a text field has no input or when special characters are inputted, and will test various other constraints of the text field.

Regression testing

Regression testing is a type of testing that is written to address a bug and ensure that the bug will not occur again in the future. It will, therefore, be tested in future builds, and new tests will be added on top to ensure that those tests pass perpetually, providing the same outcome. 

Integration testing

Integration testing is performed across various realms or containers to ensure that in a decoupled environment, a code is fit into a bigger piece with another bit of code, and to make sure the integration is successful.

Acceptance testing 

Acceptable testing is not an automated test but is rather manual testing that is done by the product owner to ensure the feature is implemented correctly. The testing is not done based on code/component isolation, but as a complete use case, end-to-end, from a user's perspective. 

This kind of test falls under continuous delivery, which we will be discussing later in this chapter, whereby the business/product team must assert whether a feature has been implemented correctly for it to be a candidate for production release. 

CI is the practice of having developers continuously (several times a day) integrate code into a shared Git repository, triggering an automated build that will regressively verify the integrity of the latest code commit. We will take a look at what CI and CD are next. 

Continuous Integration 

CI serves to detect errors in the entire code base early on through the frequency of code integration by developers, whereas having significant gaps between integrations will result in more masked and complex errors accumulating.

CI entices developers to commit early and frequently, integrating the code commits into shared code repositories daily, or even hourly, instead of building features and code in isolation to integrate them when the feature is complete. Committing frequently and early adds greater transparency and the ability for other developers to access new code and catch potential issues early on. It solicits opinions, debates, and testing in a more agile manner, and reduces merge conflicts; or, at the very least, it discovers conflicts early on. 

Through development strategies such as GitFlow (https://www.atlassian.com/git/tutorials/comparing-workflows), teams appoint a team member who will review code rapidly, prior to it being pushed into the main development branch where an automated test tool picks up the latest code and tests for regression issues.

Prominent CI tools widely used in the industry include Jenkins (https://github.com/jenkinsci/jenkins), CircleCI (https://circleci.com/about/), Atlassian's Bamboo (https://www.atlassian.com/software/bamboo), and TravisCI (https://github.com/travis-ci/travis-ci), which ideally perform the part of either detecting new commits as they come into a branch or working at daily/hourly intervals and performing an automated build, as well as running predefined test cases. The outcome of these tests is composed in a CI report that details the result of the build, as well as all the test cases.

The key term isautomation,the use of tools to automate testing and delivery continuously, reducing the possibilities for developers and testers to cause errors. 

In the later chapters of the book, we will demonstrate how to integrate fastlane into a development-CI workflow with Jenkins. Now, we will take a look at CD.

Continuous Deployment

Continuous Deployment, according to Agile Alliance, is the philosophy of minimizing the timelapse between development writing one line of code and the new code being used by live users in production. In fact, it can be considered an extension of CI. 

CI reduces risk through automated bug discovery (unit testing and regression testing); Continuous Deployment reduces risk by being able to distribute the product to alpha and beta testers more frequently, to obtain feedback more quickly.

That is, teams will benefit from being able to solicit earlier feedback and test hypotheses more rapidly through Continuous Deployment, which affords practices such as A/B beta testing. Reducing lead time reduces the risk of the unknown that comes with assumptions. 

To achieve Continuous Deployment, the team relies on infrastructure that automates and instruments various steps leading to deployment so that after each integration successfully meets the release criteria, the live application is updated with new code.

Instruments and processes, such as CI, which we just mentioned, provide the process and mechanism for continuously pushing code to a centralized repository branch, triggering an automated CI build to test for any regression concerns. 

What is continuous delivery?

Continuous delivery is commonly mistaken with CD; however, they are distinct differences, despite sharing commonalities. CD implies that every change is deployed to production continuously, whereas continuous delivery implies that the team ensures every change can be deployed to production but may opt not to. The distinction is the ability to filter or omit a change from production. This is usually due to business reasons (release timing). Take a look at the following diagram:

Figure 1: Family of tools that are part of fastlane (Source: fastlane.tools)

Like Continuous Deployment, continuous delivery focuses on automation tools in order to promote code from the shared code repository into distribution to beta testers or production. The code is picked up from a branch that should always be in a deployable state, gets built through CI, and is subsequently deployed using CD. Continuous delivery is the business choice to promote beta features into production manually. 

This doesn't mean that the feature is not delivered to beta testers; in fact, it is more common that the feature makes it to the beta testers as well as a business team to decide on the timing of the release. It is also based on other factors, such as if the code been well-tested, with the decision left to the product owner.

Benefits of CI, delivery, and deployment

The benefits of CD and CI include the following:

Lower-risk releases

: By being able to constantly release software internally and externally, the risk of long-term and hard-to-detect errors/issues is low. 

Quality releases

: Through automation tools, more automated testing, CD, and CI, developers gain the benefit of being less prone to errors.

Unit testing

and

regression testing

ensure that the code is more soundly built. 

Respond to market faster:

 Releasing frequent small changes, to not only testers but even production, allows for

User Experience

(

UX

) and other feature feedback to be given more continuously, allowing for the project to pivot more quickly. This reduces the cost of having to change a larger set of features through a commitment to less code prior to feedback. 

This is where CD comes in, along with fastlane,