test function
void
test(})
Drop-in replacement for package:test's test with Allure reporting.
Implementation
void test(
Object? description,
FutureOr<dynamic> Function() body, {
String? testOn,
t.Timeout? timeout,
Object? skip,
Object? tags,
Map<String, dynamic>? onPlatform,
int? retry,
t.TestLocation? location,
@Deprecated('Debug only') bool solo = false,
}) {
_ensureAllureInstalled();
final packagePath = resolvePackageTestPathFromDeclaration(
locationUri: location?.uri,
stackTrace: StackTrace.current,
);
final groupPath = PackageTestScopeRegistry.instance.currentPath;
PackageTestScopeRegistry.instance.registerTest(packagePath: packagePath);
final declaredMetadata = buildPackageTestMetadata(
rawName: description?.toString() ?? '',
rawTags: normalizePackageTestTags(tags),
groupPath: groupPath,
packagePath: packagePath,
skipped: skip != null && skip != false,
);
PackageTestScopeRegistry.instance.registerMetadata(declaredMetadata);
Object? effectiveSkip = skip;
final testPlan = parseTestPlan();
if (testPlan != null &&
!includedInTestPlan(
testPlan,
id: declaredMetadata.externalId,
fullName: declaredMetadata.fullName,
nativeSelector: declaredMetadata.nativeSelector,
tags: declaredMetadata.rawTags,
) &&
(skip == null || skip == false)) {
effectiveSkip = 'Excluded by Allure test plan';
}
t.test(
description,
body,
testOn: testOn,
timeout: timeout,
skip: effectiveSkip,
tags: tags,
onPlatform: onPlatform,
retry: retry,
location: location,
solo: solo,
);
}