Skip to content

Concepts of Instrumentation Testing

Devrath edited this page Oct 27, 2023 · 1 revision

github-header-image (1)

What are instrumentation tests

  • Here we try to simulate real-world actions on a UI, Then perform a visual assertion on the UI, and check whether or not the conditions are met.
  • Some of the testing involves
    • Specific text is displayed on the composable?
    • A button composable is enabled or not?
    • When you perform an action, could you check whether a navigation transition happens?
  • Usually UI tests are more flaky than unit tests.

The categories the instrumentation tests belong

Instrumentation testing belongs to all the three categories unit-testing,integration-testing, end-end testing`

Instrumentation-testing in the unit testing category

  • Here we can have an isolated UI test meaning we will be testing a specific UI component(composable) in isolation.
  • Here only a specific UI component is there and without other classes being involved.
  • We can have a specific static state object, and ensure the UI looks the same with that static state object.
  • You can set the state object as loading to true in the state object and check if the UI displays the loading boolean.
  • Here it's not the view-model that changes the state to true.

Instrumentation-testing in the integration testing category

  • Integration testing is when we test the interaction between two classes
  • Say we perform some action on the screen like a button click that would make a view-model to change the state.
  • Then we perform the assertion that the UI is displaying as expected
  • Here we are checking the interaction between the composable and view model, Thus multiple classes are involved.

Instrumentation-testing in the end-to-end testing category

  • These are used to check the complete user flows.
  • Typically it will not be a single screen but it will be multiple screens.