Contained in: Android Test-Driven Development by Tutorials
android
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Hands-On Focused Refactoring
Jul 21 2021 · Chapter
…given the field that contains the breeds an ID of breed which is displayed by the CompanionViewHolder in the RecyclerView. <androidx.appcompat.widget.AppCompatTextView android:id="@+id/breed" android:layout_width="0dp" android:layout_height="wrap_content" android:paddingEnd="10dp" android:paddingStart="10dp" android:text="Breed" app:layout_constraintBottom_toBottomOf="@+id/sex" app:layout…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
High-Level Testing With Espresso
Jul 21 2021 · Chapter
…together. Open up the starter project and open the app level build.gradle. In addition to the normal Kotlin and Android dependencies, you have the following: // Glide implementation("com.github.bumptech.glide:glide:4.12.0") { exclude group: "com.android.support" } kapt 'com.github.bumptech.glide:compiler:4.12.0' // carouselview library implementation "com.synnapps:carouselview:0.1.5" // retrofit implementation "com.squareup.okhttp3:logging-interceptor…
Android & Kotlin
Android Test-Driven Development by Tutorials
Jul 21 2021 · Book
Learn Test-Driven Development on Android! Writing apps is hard. Writing testable apps is even harder, but it doesn’t have to be. Reading and understanding all the official Google documentation on testing can be time-consuming — and confusing. In this book, you’ll learn about Android test-driven development…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
User Interface
Jul 21 2021 · Chapter
…third and final part of the testing pyramid: User Interface (UI) tests, also known as end-to-end tests. Almost all Android apps have a UI, and subsequently, an essential layer for testing. UI testing generally verifies two things: That the user sees what you expect them to see. That…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Integration
Jul 21 2021 · Chapter
…interact together. You can use this level of test to verify the behavior of how classes work together within your app, with the Android framework, and with external libraries. It’s the next level up from unit tests. Unit tests are great for ensuring that all your individual pieces work…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Refactoring Your Tests
Jul 21 2021 · Chapter
…same tests using slower, but closer to real life, Espresso during less frequent Continuous Integration cycles to find potential issues on specific versions of Android. Up to this point with your refactoring, you have been focusing on running your tests in Espresso and putting them in androidTest. This…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Architecting for Testing
Jul 21 2021 · Chapter
…this kind of test in the next chapter. Effective Java by Joshua Bloch, introduced another Builder design pattern, focused on readability. The AlertDialog.Builder in Android is an example of this type of pattern: AlertDialog.Builder(this) .setTitle("Error!") .setMessage("There was an error, would you like to retry?") .setNegativeButton("Cancel", { dialogInterface…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Continuous Integration & Other Related Tools
Jul 21 2021 · Chapter
…main categories you will run across: Self hosted solutions. Cloud based solutions. Self hosted CI A large number of organizations, arguably a majority of Android teams, have historically used this approach. While there are number of tools that you can use for self hosted CI, one of the most popular…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
What You Need
Jul 21 2021 · Chapter
…following: Kotlin 1.5. This book uses Kotlin 1.5 throughout. The examples may work with an earlier version of Kotlin, but they are untested. Android Studio 4.2.1 or later. Android Studio is the main development tool for Android. You’ll need Android Studio 4.2.1 or later for the tasks in this…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Testing the Persistence Layer
Jul 21 2021 · Chapter
…ideas for all your friends and loved ones. To get started, find the starter project included for this chapter and open it up in Android Studio, or continue with the project from Chapter 8, “Integration.” Build and run the app. You’ll see a blank screen with a button…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Common Legacy App Problems
Jul 21 2021 · Chapter
…ideal world, your team will write a new Android app that will use TDD development techniques from the beginning. In this world, your app will have great test coverage, an architecture that is set up for TDD, and code with a high level of quality. Because of that, the team…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
The Testing Pyramid
Jul 21 2021 · Chapter
…raise bug tickets. Then, the developers went back and fixed the bugs. Even nowadays, without any kind of automation, this is happening on the Android ecosystem. Testing usually consists of compiling the release candidate application, installing it on a physical device or emulator, and passing it to the QA team…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Introduction
Jul 21 2021 · Chapter
Welcome to the first chapter of this book. If you’re curious about learning more about testing on Android, you’re in the right place. In this book, you’ll learn about test-driven development (TDD) on Android. You’ll do this by working step-by-step in real apps…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Testing Around Other Components
Jul 21 2021 · Chapter
…boundaries in your test and use strategies to help to interact with other libraries and parts of the Android framework…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Introduction to Mockito
Jul 21 2021 · Chapter
…need to add functionality to a repository. From the Project view, create a new package common ‣ repository under app ‣ src ‣ test ‣ java ‣ com ‣ raywenderlich ‣ android ‣ cocktails. Create a new file called RepositoryUnitTests.kt and add the following code: class RepositoryUnitTests { @Test fun saveScore_shouldSaveToSharedPreferences() { val api: CocktailsApi = mock() // 1 val sharedPreferencesEditor…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Unit Tests
Jul 21 2021 · Chapter
…your drink ready as you explore a cocktail app and write your unit tests in Android practicing test-driven development…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
About the Team
Jul 21 2021 · Chapter
About the Authors Victoria Gonda is an author of this book. Victoria is an Android Engineer and technical author. The conferences she has spoken at have been an enjoyable way to connect with the technical community and exchange information with others. She was drawn to programming because of its potential…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Testing the Network Layer
Jul 21 2021 · Chapter
…random joke every time you press a button. To start, find the starter project in the materials for this chapter and open it in Android Studio. Run the app, but you won’t see much yet: There will be no UI for you to play with until…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
Strategies for Handling Test Data
Jul 21 2021 · Chapter
Learn multiple ways to handle test data in your Android tests by learning by tutorials. In this chapter, you'll explore a variety of ways of using test data in your tests…
Android & Kotlin
Chapter in Android Test-Driven Development by Tutorials
What Is TDD?
Jul 21 2021 · Chapter
…before you write the actual code. Because it’s a process and not a library, you can apply it to any project, be it Android, iOS, web or anything else. There are several benefits to this that you’ll learn throughout this chapter and this book. Through using…