Skip to content

Run tests using line/col to support groups/test with dynamic names #4021

@MiniSuperDev

Description

@MiniSuperDev

Added by @DanTup:

Some test cases to ensure are handled:


Describe the bug
I have some functions to give a specific format to the descriptions of the groups and tests, like indentation, in this way it is easier to read them in the console, but when I execute a specific test, giving run in that group or test it tells me:

No tests match regular expression "^groupDescriptionFormatted\('group 1'\)".

To Reproduce
this is a minimal example:

import 'package:test/test.dart';

String groupDescriptionFormatted(String description) {
  return description;
}

String subGroupDescriptionFormatted(String description) {
  return '\n    $description';
}

void main() {
  group(
    groupDescriptionFormatted('group 1'),
    () {
      group(subGroupDescriptionFormatted('sub group 1'), () {
        test('test', () {
          expect(true, isTrue);
        });
      });
    },
  );
  group(
    groupDescriptionFormatted('group 2'),
    () {
      group(subGroupDescriptionFormatted('sub group 1'), () {
        test('test', () {
          expect(true, isTrue);
        });
      });
    },
  );
}

If you press run or debug on a specific group or test, you can see the error, an also in the testing tab you can see that the names are the function instead of the real test name.
image

If you press run or debug on main, or use the command run all tests, it runs normal but also in the testing tab keep the names are the function instead of the real test name, and now also the real tests names.

image

Thank you.

Please complete the following information:
Operating System and version: Windows 10
VS Code version: 1.68.0
Dart extension version: 3.42.0
Dart/Flutter SDK version: flutter 3.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    in testingRelates to test execution of Dart/Flutter tests for end usersis enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions