Package groovy.test
Class GroovyTestSuite
java.lang.Object
junit.framework.TestSuite
groovy.test.GroovyTestSuite
- All Implemented Interfaces:
junit.framework.Test
public class GroovyTestSuite
extends junit.framework.TestSuite
A TestSuite which will run a Groovy unit test case inside any Java IDE
either as a unit test case or as an application.
You can specify the GroovyUnitTest to run by running this class as an application
and specifying the script to run on the command line.
java groovy.test.GroovyTestSuite src/test/Foo.groovy
Or to run the test suite as a unit test suite in an IDE you can use
the 'test' system property to define the test script to run.
e.g. pass this into the JVM when the unit test plugin runs...
-Dtest=src/test/Foo.groovy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static StringOptional script path supplied from the command line when running as an application.protected final GroovyClassLoaderClass loader used to compile and load Groovy test sources. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionClass<?>Compiles the supplied Groovy source file into a class.voidLoads the configured Groovy test source and adds the resulting test to this suite.static voidRuns the suite as a standalone application.static junit.framework.Testsuite()Creates a suite for the configured Groovy test script.Methods inherited from class junit.framework.TestSuite
addTest, addTestSuite, countTestCases, createTest, getName, getTestConstructor, run, runTest, setName, testAt, testCount, tests, toString, warning
-
Field Details
-
file
Optional script path supplied from the command line when running as an application. -
loader
Class loader used to compile and load Groovy test sources.
-
-
Constructor Details
-
GroovyTestSuite
public GroovyTestSuite()
-
-
Method Details
-
main
Runs the suite as a standalone application.- Parameters:
args- optional command-line arguments, where the first argument is the test script path
-
suite
public static junit.framework.Test suite()Creates a suite for the configured Groovy test script.- Returns:
- a suite containing the compiled test or script adapter
-
loadTestSuite
Loads the configured Groovy test source and adds the resulting test to this suite.- Throws:
Exception- if the test source cannot be compiled or adapted
-
compile
Compiles the supplied Groovy source file into a class.- Parameters:
fileName- the Groovy source file to compile- Returns:
- the compiled class
- Throws:
Exception- if compilation fails
-