Testing and Debugging Compose Apps
Programming is a very creative process. Implementing great-looking user interfaces (UIs) with slick animations is pure fun with Jetpack Compose. However, making an outstanding app involves more than just writing code. Testing and debugging are equally important because no matter how carefully you design and implement your app, bugs and glitches are inevitable, at least in non-trivial programs. Yet there is nothing to fear, as there are powerful tools you can wield to check whether your code is acting as intended.
This chapter introduces you to these tools. The main sections included are listed here:
- Setting up and writing tests
- Understanding semantics
- Debugging Compose apps
In the first main section, I will walk you through important terms and techniques regarding testing. We will set up the infrastructure, write a simple unit test, and then turn to Compose specifics—for example, createComposeRule()
and createAndroidComposeRule...