Integration Testing in Flutter: Getting Started | raywenderlich.com

Learn how to test UI widgets along with the backend services in your Flutter project using Integration Testing.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/29321816-integration-testing-in-flutter-getting-started

Probably one of the best articles I was able to find about integration testing, thank you!

However, I had several issues, which are worth mentioning:

  1. In the starter project the following fragment (copied from the article) won’t compile:

    await tester.drag(
      find.byKey(ValueKey(
        // This variable should name tempTitle as per acrticle 
        title.toString(),
      )),
      const Offset(-600, 0),
    );
    await addDelay(5000);
    

    Note, this is not the case in the final project.

  2. Both starter and final projects tests are failing to find the widget card to drag (so it can be removed). To fix this you have add key: ValueKey(ideasList[index].title!) within the Text widget inside the ListTile (file home_screen.dart, line 156).

  3. Maybe it is worth mentioning in the article, that ideally, unit tests shouldn’t rely on the order in which they are executed. This is not the case for integration testing (otherwise if you start the second test only it will fail, as the account doesn’t exist).

1 Like

Excellent introduction to integration testing!

Thanks for your feedback. I’ve updated the projects so they should now compile with the latest version of Flutter as well as fixed the code in the starter and final projects.