Index: lib/src/backend/live_test.dart |
diff --git a/lib/src/backend/live_test.dart b/lib/src/backend/live_test.dart |
index 4cc917a5a4af3efb1dbcd30c8b87256600c23484..00b0d11cf2a748bac3dac79410b59be89de4d114 100644 |
--- a/lib/src/backend/live_test.dart |
+++ b/lib/src/backend/live_test.dart |
@@ -6,6 +6,7 @@ library test.backend.live_test; |
import 'dart:async'; |
+import 'group.dart'; |
import 'state.dart'; |
import 'suite.dart'; |
import 'test.dart'; |
@@ -26,6 +27,12 @@ abstract class LiveTest { |
/// The suite within which this test is being run. |
Suite get suite; |
+ /// The groups within which this test is being run, from the outermost to the |
+ /// innermost. |
+ /// |
+ /// This will always contain at least the implicit top-level group. |
+ List<Group> get groups; |
+ |
/// The running test. |
Test get test; |
@@ -95,6 +102,19 @@ abstract class LiveTest { |
/// to happen, which may cause further errors. |
Future get onComplete; |
+ /// The name of this live test without any group prefixes. |
+ String get individualName { |
+ var group = groups.last; |
+ if (group.name == null) return test.name; |
+ if (!test.name.startsWith(group.name)) return test.name; |
+ |
+ // The test will have the same name as the group for virtual tests created |
+ // to represent skipping the entire group. |
+ if (test.name.length == group.name.length) return ""; |
+ |
+ return test.name.substring(group.name.length + 1); |
+ } |
+ |
/// Signals that this test should start running as soon as possible. |
/// |
/// A test may not start running immediately for various reasons specific to |