Add a "variant: " prefix to variant descriptions in test names (#86701)

This commit is contained in:
Danny Tuppeny 2021-07-20 17:16:03 +01:00 committed by GitHub
parent 7d026b6b8b
commit 91b67e8eb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -149,7 +149,13 @@ void testWidgets(
final WidgetTester tester = WidgetTester._(binding);
for (final dynamic value in variant.values) {
final String variationDescription = variant.describeValue(value);
final String combinedDescription = variationDescription.isNotEmpty ? '$description ($variationDescription)' : description;
// IDEs may make assumptions about the format of this suffix in order to
// support running tests directly from the editor (where they may have
// access to only the test name, provided by the analysis server).
// See https://github.com/flutter/flutter/issues/86659.
final String combinedDescription = variationDescription.isNotEmpty
? '$description (variant: $variationDescription)'
: description;
test(
combinedDescription,
() {

View File

@ -697,7 +697,10 @@ void main() {
if (debugDefaultTargetPlatformOverride == null) {
expect(tester.testDescription, equals('variant tests have descriptions with details'));
} else {
expect(tester.testDescription, equals('variant tests have descriptions with details ($debugDefaultTargetPlatformOverride)'));
expect(
tester.testDescription,
equals('variant tests have descriptions with details (variant: $debugDefaultTargetPlatformOverride)'),
);
}
}, variant: TargetPlatformVariant(TargetPlatform.values.toSet()));
});