Skip to main content

Introduction

This page contains a brief overview of the variety of tools, provided by Litho, to write different types of tests.

Unit Testing​

Litho provides a suite of helpers to make unit testing easier. To learn about the setup with the Litho JUnit Rules and AssertJ helpers, refer to the Getting Started page of the 'Unit Tests' section of the Litho documentation.

  • Sub-Component Testing - a common way to test components is by testing assertions on the component hierarchy; this means finding components that are expected to be present or absent in the component tree. The sub-component APIs provide utility methods to easily write such tests.

  • Prop Matching - provides APIs to write tests for asserting the prop values set on the components in the hierarchy:

  • Testing Section - Section hierarchies can be tested using the SectionComponentTestHelper and SubSection APIs.

End-to-End Testing (E2E Tests)​

Litho also provides utilities for writing E2E tests powered by Espresso. For more information, see the End-to-End Tests page in the 'UI Tests' section of the Litho documentation.

Android Studio​

To run unit tests in Android Studio, refer to the Testing in Android Studio page.