Class TestRecorderSuperClassCandidateScanner
java.lang.Object
com.vaadin.copilot.testrecordergenerator.TestRecorderSuperClassCandidateScanner
Finds the custom base classes used by recorded tests. By default it looks for
TestBench tests (methods annotated with
@BrowserTest in classes
extending BrowserTestBase). It can also be configured for other test
types, e.g. Browserless tests. Important note: This class does a heavy work,
so methods should run in async-
Constructor Summary
ConstructorsConstructorDescriptionCreates a scanner for TestBench tests.TestRecorderSuperClassCandidateScanner(Set<String> rootTypes, String testAnnotation, String defaultSuperClass, boolean acceptUnresolvedSuperClasses) Creates a scanner for the given root types. -
Method Summary
-
Constructor Details
-
TestRecorderSuperClassCandidateScanner
public TestRecorderSuperClassCandidateScanner()Creates a scanner for TestBench tests. -
TestRecorderSuperClassCandidateScanner
public TestRecorderSuperClassCandidateScanner(Set<String> rootTypes, String testAnnotation, String defaultSuperClass, boolean acceptUnresolvedSuperClasses) Creates a scanner for the given root types.- Parameters:
rootTypes- fully qualified names of the base types a candidate must extendtestAnnotation- simple name of the annotation that marks test methodsdefaultSuperClass- the class appended last to the candidatesacceptUnresolvedSuperClasses- whether a superclass whose source is not in the project is accepted as a candidate
-
-
Method Details
-
scan
Scans the test source folder for tests of the configured type and counts the custom superclasses they use.- Returns:
- fully qualified superclass names and the number of tests using each one
- Throws:
IOException- if the test source folder cannot be read
-
getCandidatesInOrder
Gets all candidate superclasses ordered by how often recorded tests use them. Candidates with the same count are ordered by class name.BrowserTestBaseis added as the last, fallback superclass.- Returns:
- fully qualified candidate superclass names, most frequently used first
- Throws:
IOException- if the test source folder cannot be read
-