Class ScriptTestAdapter

java.lang.Object
org.apache.groovy.test.ScriptTestAdapter
All Implemented Interfaces:
junit.framework.Test

public class ScriptTestAdapter extends Object implements junit.framework.Test
An adapter to make any Groovy Script class an instance of a JUnit Test
  • Constructor Summary

    Constructors
    Constructor
    Description
    ScriptTestAdapter(Class scriptClass, String[] arguments)
    Creates an adapter that runs the supplied Groovy script class as a JUnit test.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of test cases represented by this adapter.
    void
    run(junit.framework.TestResult result)
    Executes the adapted script and reports the result to JUnit.
    Returns a human-readable description of the adapted script test.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ScriptTestAdapter

      public ScriptTestAdapter(Class scriptClass, String[] arguments)
      Creates an adapter that runs the supplied Groovy script class as a JUnit test.
      Parameters:
      scriptClass - the compiled Groovy script class to execute
      arguments - the command-line arguments passed to the script
  • Method Details

    • countTestCases

      public int countTestCases()
      Returns the number of test cases represented by this adapter.
      Specified by:
      countTestCases in interface junit.framework.Test
      Returns:
      always 1
    • run

      public void run(junit.framework.TestResult result)
      Executes the adapted script and reports the result to JUnit.
      Specified by:
      run in interface junit.framework.Test
      Parameters:
      result - the TestResult receiving lifecycle callbacks and errors
    • toString

      public String toString()
      Returns a human-readable description of the adapted script test.
      Overrides:
      toString in class Object
      Returns:
      the script test description