Test, Configuration, testlist.txt - epam/Gepard GitHub Wiki

AllTestRunner

The main class is the com.epam.gepard.AllTestRunner java class. AllTestRunner loads the tests specified in testlist.txt (see below). Then the tests are run, logs are generated, results are counted etc.

testlist.txt

Gepard use testlist.txt to collect tests to be executed. The location of this file (and its filename) is specified in gepard.properties file in the following way:

gepard.basefolder=.
gepard.test.resource.path=${gepard.basefolder}/build/resources/main
gepard.testlist.file=${gepard.test.resource.path}/testlist.txt

The file contains rows in the following format:

packagename.classname[,[feederdescriptor][,blockerstring]]

Where:

  • packagename.classname is the full class name of the test class, like: com.epam.gepard.examples.core.basic.SampleOtherTest
  • feederdescriptor - is the data feeder information, see details below
  • blockerstring - used to manage parallel execution of the test class, see more information below

Note: Empty rows and rows started with "#" are ignored.

Note 2: In old version of Gepard (V3.x), testlist row format was packagename.classname[,[classdatafeeder][,[classleveltimeoutinsec][,blockerstring]]], where the classleveltimeoutinsec specified a timeout on class level. For new version of Gepard (>=V4.0), this is not necessary, because JUnit timeout handling become available.

Example (from gepard-examples package):

# Simple test class execution, non-data-driven
com.epam.gepard.examples.core.basic.BasicTest

# Sample for using blocker strings in case of parallel test execution
com.epam.gepard.examples.core.basic.SampleParallelTestA,,AAA
com.epam.gepard.examples.core.basic.SampleParallelTestB,,BBB
com.epam.gepard.examples.core.basic.SampleParallelTestC,9,AAA*

# Sample usage of feeders and data driven tests
com.epam.gepard.examples.core.datadriven.DataDrivenSampleTestCSV,SimpleMultiplierDataFeeder:11
com.epam.gepard.examples.core.datadriven.DataDrivenSampleTest,SimpleMultiplierDataFeeder:11@SingleRowSelectorDataFeeder:2
com.epam.gepard.examples.core.datadriven.DataDrivenSampleTestCSVTestParameterTest,11
com.epam.gepard.examples.core.datadriven.DataDrivenSampleTestCSVB,SimpleMultiplierDataFeeder:11@BruteMultiplierDataFeeder:5
com.epam.gepard.examples.core.datadriven.LabelBasedDataFeederTest,:[]+[feeders.ONE:3:LABEL1]x[feeders.TWO:::RANDOM]

Feeder Descriptior

The feederdescriptor part may be very complex, as the following possibilities are all accepted:

  • param - if param is a number, use SimpleMultiplierFeeder class is used as Feeder class
  • :param - uses the default feeder class, specified in gepard.datadriven.feeder.class property of gepard.properties file, with the given parameter
  • feederdescriptor - feeder descriptor describes the used feeder classes, the used parameters and may chain to the next feeder descriptor, so the following possibilities we have:
    • feederclass - like: FakeDataFeeder
    • feederclass:param - like: SingleRowSelectorDataFeeder:2
    • feederclass:param@feederdescriptor - like: SimpleMultiplierDataFeeder:11@SingleRowSelectorDataFeeder:2
    • feederclass@feederdescriptor - like: FakeDataFeeder@SingleRowSelectorDataFeeder:2

Blocker String

During parallel test execution, the following rules are applied:

  • within a single Test Class, if there are more than one test method in a test class, all test methods executed in serial way, however the order of the test method execution is not specified (should be considered as in random order)
  • in case no blocker string present, that means the test class can be executed in parallel with any other test classes (including itself, if the test class executed several times)
  • in case a blocker string present, the Test Classes those marked with the same blocker string, executed in serial mode, and in order
  • in case there is a "*" at the end of a blocker string, that means it cannot be executed in parallel with other test cases marked with the same blocker string, but can be executed in parallel to itself (if the test class executed several times).

Filters

The test class search can be filtered by a „filter expression”, which is evaluated by a test class filter class that loads the testlist.txt. It can be specified using gepard.properties file. The default filter class gepard.filter.class=com.epam.gepard.filter.DefaultTestFilter is included in Gepard. It accepts filter expression for the test class name or test ID with optional ’?’ wildcard characters in it, and list of expressions. The ’?’ filter expression matches everything. You can create custom filters by extending com.gargoylesoftware.base.testing.AcceptAllTestFilter and implementing the com.epam.gepard.filter.Expression interface. The overridden public boolean accept(java.lang.Class clazz) method can decide whether to accept include a found test class or not.

The filters take their effect too when we specify test list. You can decrease the range of the test cases to perform with applying the precedence description. If we don't pass test list parameter then searching will be performed.