Skip to content

Testing

  • Automated tests
  • Unit Test: test a single function
  • Widget Test: test a single widget (component)
  • Integration Test: test a complete app or a large part of it (e2e)

WidgetTester

  • Offers a way to navigate through the app and except several values and behaviors

Mocks

  • A flaky test is the test that itself calls external APIs not mocked, and therefore must be avoided because it's unstable
  • Mockito is a tool used to simulate tasks which depends on external sources

Directory structure

  • test/
  • flows/: actions that simulate an interaction in the app (e.g., navigation, saving)
  • matchers/
  • mocks/: generaeted mocks
  • unit/: unit tests
  • widgets/: widget tests