![]() The biggest problem is the same that we have with integration and UI tests: speed. Using the emulator can work, but it also comes with some problems. When looking at these libraries, we need to differentiate between two distinct types: those that use an emulator and those that don't. But what can we use for screenshot testing? There are several libraries available, the most popular being facebook/screenshot-tests-for-android, pedrovgs/Shot and cashapp/paparazzi, but of course, there are more out there. For integration tests we have Robolectric. In the error message, the CI will return the screenshot test method which failed.įor writing unit tests we are using the JUnit library. If there is something different in the image, the build will fail. When the images are the same, the test will pass and your CI build will succeed. To validate that nothing has changed and your UI still looks the same as when you generated the golden master, the continuous integration system will run the screenshot tests, generate the screenshot images from the tests in memory, and compare them to the committed golden masters. ![]() The screenshot images are now called the ‘ golden masters.’ As a result, we have one screenshot only of this element in a specific state.Īfter writing a screenshot test, the screenshot images will be generated and included in the Git commit where the written screenshot tests are also committed. This UI component will be rendered with static data and a screenshot will be taken in isolation. What is Screenshot Testing?įor screenshot testing, you take one user interface component, which can either be a small UI element like a button, a ViewHolder from a RecyclerList, or even a whole screen from a fragment. With screenshot testing, we can easily verify all the different states a ViewItem has, check there is no regression, and designers can review our work. To solve this problem, GetYourGuide’s Android engineers rely on screenshot testing. Additionally, UI tests are not made for validating design aspects like padding or font size. It’s also often the case that you break a view state while fixing another one. The testing pyramid isn’t helping you with these kinds of questions, and manual testing of all the different ViewItem states is tedious work. Have you ever created a ViewItem for a RecyclerView with a dozen different states, and the preview of your XML file isn’t really helpful? Is your designer using Figma to create a design that you should implement but there’s no way to validate the actual implementation? And when you update a library – for example the material design library from Google – how do you make sure the design of the app is still correct? The result is pretty good testing coverage across our app. We all know that according to the famous testing pyramid we should write many unit tests, some integration tests, and a few UI tests. Here’s why we added them, what they are, and how we combined them into our codebase. ![]() One of our newly added testing types are screenshot tests. For this reason, I regularly look into our Android testing strategy to identify where we have weak spots, and determine how we can fix them. We must not only provide a smooth checkout experience for the user, we also need to make sure the checkout is working all the time. My team’s main area of responsibility is the Checkout domain. I joined GetYourGuide as a Senior Mobile Engineer in August 2021 and am based in the company’s Zurich office. He shares an overview of what they are and how we use them at GetYourGuide. A fundamental part of our testing strategies are screenshot tests. Senior Mobile Engineer Benedict Pregler is currently working on the testing strategy for our Android app.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |