How do I run an individual Flutter test in Android Studio (Win10)?

Issue

I’m using Android Studio on Windows 10 to develop a Flutter app. I can run a group of tests just fine, but when I try to run an individual test in isolation (by clicking the little "play" button in front of the test name), I’m getting the following error:

No tests match regular expression "^Test name\.( \(variant: .*\))?$".

Here’s my test structure:

  group('Tests', () {
    testWidgets('Test name.', (WidgetTester tester) async {
      // Test logic
    });
  });

It works fine on my other computer which is running Ubuntu, but for some reason it’s acting up on Windows. Has anyone else come across this issue?

Solution

I’ve found a workaround for this – when you click on the little play button next to the test name, you have to click "Modify Run Configuration" first and then click "Ok". Then make sure you run the modified configuration from the top tool bar as opposed to clicking the play button in front of the test name again.

Answered By – Daniel

Answer Checked By – Katrina (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *