getPath function
List<String>
getPath(
- Test test,
- List<TestGroup> groups,
- TestSuite suite
)
Implementation
List<String> getPath(Test test, List<TestGroup> groups, TestSuite suite) {
groups = groups.where((element) => element.name.isNotEmpty).toList();
List<String> result = [];
String name = test.name //
.replaceFirst(groups.lastOrNull?.name ?? '', '')
.trim();
result.add(name);
for (var i = groups.length - 1; i >= 0; i--) {
final parentGroup = i == 0 ? null : groups[i - 1];
result.add(groups[i].name.replaceFirst(parentGroup?.name ?? '', '').trim());
}
result.add(
suite.path! //
.split('/')
.skipWhile((value) => value != 'test')
.join('/'),
);
return result.reversed.toList();
}