类 TestClassScanner
java.lang.Object
cn.taketoday.test.context.aot.TestClassScanner
TestClassScanner scans provided classpath roots for Infra integration
test classes using the JUnit Platform Launcher API which allows all
registered TestEngines to discover
tests according to their own rules.
The scanner currently detects the following categories of Infra integration test classes.
- JUnit Jupiter: classes that register the
InfraExtensionvia@ExtendWith. - JUnit 4: classes that register the
InfraJUnit4ClassRunnerorInfraRunnervia@RunWith. - Generic: classes that are annotated with
@ContextConfigurationor@BootstrapWith.
The scanner has been tested with the following
TestEngines.
- JUnit Jupiter
- JUnit Vintage
- JUnit Platform Suite Engine
- TestNG Engine for the JUnit Platform
- 从以下版本开始:
- 4.0
- 作者:
- Sam Brannen, Harry Yang
-
字段概要
字段 -
构造器概要
构造器构造器说明TestClassScanner(Set<Path> classpathRoots) Create aTestClassScannerfor the given classpath roots. -
方法概要
修饰符和类型方法说明assertPreconditions(Set<Path> classpathRoots) getJavaClass(org.junit.platform.engine.support.descriptor.ClassSource classSource) private static booleanisGenericInfraTestClass(Class<?> clazz) private booleanisInfraTestClass(Class<?> clazz) private static booleanisJUnit4InfraTestClass(Class<?> clazz) private static booleanisJupiterInfraTestClass(Class<?> clazz) scan()Scan the configured classpath roots for Infra integration test classes.Scan the configured classpath roots for Infra integration test classes in the given packages.
-
字段详细资料
-
构造器详细资料
-
TestClassScanner
Create aTestClassScannerfor the given classpath roots.For example, in a Gradle project that only supports Java-based tests, the supplied set would contain a single
Pathrepresenting the absolute path to the project'sbuild/classes/java/testfolder.- 参数:
classpathRoots- the classpath roots to scan
-
-
方法详细资料
-
scan
Scan the configured classpath roots for Infra integration test classes. -
scan
Scan the configured classpath roots for Infra integration test classes in the given packages.This method is currently only intended to be used within our own test suite to validate the behavior of this scanner with a limited scope. In production scenarios one should invoke
scan()to scan all packages in the configured classpath roots. -
getJavaClass
-
isInfraTestClass
-
isJupiterInfraTestClass
-
isJUnit4InfraTestClass
-
isGenericInfraTestClass
-
assertPreconditions
-