question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Oct 4, 2022

I tested this using latest Flutter master (I missed you were using Flutter, so it should’ve been flutter test) and it seems to work as you’d like:

Screenshot 2022-10-04 at 12 31 16

So at least for a future version of Flutter, once this is implemented I believe what you’re after works. (I tested it with rendersText in another file too, same result - I just inlined it here for the screenshot).

0reactions
DanTupcommented, Nov 9, 2022

Started looking at this, but think we may be blocked on:

How to proceed will depend a little on the response to the test issue. If this is WAI and can’t be changed, we may have to change how things work here a little more.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you generate dynamic (parameterized) unit tests in ...
I would imagine this method of dynamically creating test methods is more compatible with the introspection used by unittest to determine how many...
Read more >
Guide to Dynamic Tests in Junit 5 - Baeldung
Learn about dynamic tests introduced in JUnit 5 - a new programming model that supports full test lifecycle.
Read more >
How to group test cases in TestNG [with Examples]
The framework supports data-driven testing, parallel test ... As the name indicates, grouping in TestNG lets you group multiple test methods ...
Read more >
Dynamic Agent selection for test runs - ACCELQ
This allows remote/local execution of test runs while providing complete ... For example, in the image below, any Agent with a name starting ......
Read more >
Configure unit tests by using a .runsettings file - Microsoft Learn
The run settings file for a project is specified by the property RunSettingsFilePath. Project-level run settings is currently supported in C#, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found