java.lang.Object
net.serenitybdd.junit.finder.TestFinder
Direct Known Subclasses:
DataDrivenTestFinder, DefaultTestFinder, NormalTestFinder

public abstract class TestFinder extends Object
The TestFinder class lets you find the Thucydides tests or test methods underneath a given package.

You instantiate a TestFinder by providing the top-level package where the tests live.

You can then find the list of Thucydides test classes using getNormalTestClasses(), getDataDrivenTestClasses(), and getAllTestClasses() (which returns both normal and data-driven tests).

You may also need to retrieve the list of test methods for a particular category of class. You can do this using the getTestMethodsFrom() method, e.g.

new TestFinder("my.package").getTestMethodsFrom().normalTestClasses()
  • Field Details

    • rootPackage

      protected final String rootPackage
  • Constructor Details

    • TestFinder

      protected TestFinder(String rootPackage)
      Create a new test finder instance that will look for tests in the packages underneath the given root package.
      Parameters:
      rootPackage - The root package used as the starting point when looking for test classes.
  • Method Details

    • thatFinds

      public static TestFinderBuilderFactory thatFinds()
    • getClasses

      public abstract List<Class<?>> getClasses()
    • countTestMethods

      public abstract int countTestMethods()
    • findTestMethods

      public TestMethodFinder findTestMethods()
    • getAllTestClasses

      protected List<Class<?>> getAllTestClasses()
    • getNormalTestClasses

      protected Set<Class<?>> getNormalTestClasses()
    • getDataDrivenTestClasses

      protected List<Class<?>> getDataDrivenTestClasses()
    • sorted

      protected List<Class<?>> sorted(List<Class<?>> classes)
    • getAllTestMethods

      public List<Method> getAllTestMethods()