Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Common Mistakes in UI Testing

Common Mistakes in UI Testing

Testing is a crucial part of software development, but it is also an area where developers put less effort into extensibility, maintainability and performance of UI tests.

In this talk, we will discuss the following topics:
– How to design a UI test?
– How to handle flaky tests?
– How to create fast and reliable tests?
– Best Practices in UI testing

Alex Zhukovich

May 12, 2023
Tweet

More Decks by Alex Zhukovich

Other Decks in Programming

Transcript

  1. NOT DEFINING CLEAR TEST OBJECTIVES Design System Application Screen in

    isolation END-TO-END TESTING FUNCTIONAL 
 TESTING
  2. NOT DEFINING CLEAR TEST OBJECTIVES Design System Application Screen in

    isolation END-TO-END TESTING FUNCTIONAL 
 TESTING SCREENSHOT 
 TESTING
  3. NOT USING CORRECT TEST DATA @Test fun superImportantTest() { assertEquals(4,

    sum(2, 2)) } fun sum(a: Int, b: Int): Int { ... }
  4. @Test fun superImportantTest() { assertEquals(4, sum(2, 2)) } fun sum(a:

    Int, b: Int): Int { return 4 } NOT USING CORRECT TEST DATA
  5. GLOBAL TEST DATA FOR A TEST SUITE TEST DATA TEST

    CASE TEST CASE TEST CASE TEST CASE
  6. GLOBAL TEST DATA FOR A TEST SUITE TEST DATA TEST

    CASE TEST CASE TEST CASE TEST CASE
  7. DO NOT CLEAR DATA AFTER TEST CASE EXECUTION Test Case

    Test Case Test Case TEST CASE TEST CASE TEST CASE
  8. NOT TESTING DIFFERENT FONT & DISPLAY SIZES Display Size: Large

    Font Size: Largest Display Size: Default Font Size: Largest Display Size: Default Font Size: Default
  9. PARAMETERIZED TEST CASES @RunWith(TestParameterInjector::class) class WeekCalendarParamScreenshotTest( @TestParameter val uiMode: UiMode,

    @TestParameter val fontSize: FontSize, @TestParameter val todayIsSelectedDate: Boolean ) : ScreenshotTest { ... @Test fun weekCalendar_paramUiModeAndFontSizeAndSelectedDate() { val todayDate = if (todayIsSelectedDate) testDate.minusDays(1) else testDate.minusDays(2) val todayIsSelectedDateDescription = if (todayIsSelectedDate) "todayIsSelectedDate" else "todayIsNotSelectedDate" val activityScenario = ActivityScenarioConfigurator.ForComposable() .setUiMode(uiMode) .setFontSize(fontSize) .launchConfiguredActivity() .onActivity { it.setContent { AppTheme { WeekCalendar(...) } } } activityScenario.waitForActivity() compareScreenshot(composeTestRule, "weekCalendar_${uiMode}_${fontSize}_${todayIsSelectedDateDescription}") activityScenario.close() } }