Search in sources :

Example 1 with ScriptTestAdapter

use of org.apache.groovy.test.ScriptTestAdapter in project groovy by apache.

the class GroovyTestSuite method loadTestSuite.

public void loadTestSuite() throws Exception {
    String fileName = System.getProperty("test", file);
    if (fileName == null) {
        throw new RuntimeException("No filename given in the 'test' system property so cannot run a Groovy unit test");
    }
    System.out.println("Compiling: " + fileName);
    Class type = compile(fileName);
    String[] args = {};
    if (!Test.class.isAssignableFrom(type) && Script.class.isAssignableFrom(type)) {
        // let's treat the script as a Test
        addTest(new ScriptTestAdapter(type, args));
    } else {
        addTestSuite(type);
    }
}
Also used : Script(groovy.lang.Script) ScriptTestAdapter(org.apache.groovy.test.ScriptTestAdapter)

Aggregations

Script (groovy.lang.Script)1 ScriptTestAdapter (org.apache.groovy.test.ScriptTestAdapter)1