Groovy Documentation

## org.codehaus.groovy.grails.test.event
[Groovy] Class GrailsTestEventPublisher

    java.lang.Object
      org.codehaus.groovy.grails.test.event.GrailsTestEventPublisher

    class GrailsTestEventPublisher

Publishes test related events to the Grails build system.

Field Summary
`protected groovy.lang.Closure` | `event`

Constructor Summary
`GrailsTestEventPublisher(groovy.lang.Closure event)` @param event the "event" closure from the Grails build system

Method Summary
`void` | `testCaseEnd(java.lang.String name, java.lang.String out = null, java.lang.String err = null)` Signifies the end of a "unit" of tests.
`void` | `testCaseStart(java.lang.String name)` Signifies the start of a "unit" of tests.
`void` | `testEnd(java.lang.String name)` Signifies that a test has ended.
`void` | `testFailure(java.lang.String name, java.lang.Throwable failure, boolean isError = false)` Signifies that a test did not complete successfully.
`void` | `testFailure(java.lang.String name, java.lang.String failure = null, boolean isError = false)` Signifies that a test did not complete successfully.
`void` | `testStart(java.lang.String name)` Signifies the start of an individual test, inside a parent "unit".

Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### event

    protected groovy.lang.Closure event

Constructor Detail

### GrailsTestEventPublisher

    GrailsTestEventPublisher(groovy.lang.Closure event)

  Parameters:
    `event` - the "event" closure from the Grails build system

Method Detail

### testCaseEnd

    void testCaseEnd(java.lang.String name, java.lang.String out = null, java.lang.String err = null)

  Signifies the end of a "unit" of tests. (e.g. A JUnit TestCase). Must be called after testEnd(java.lang.String) with the same name as the most recent call to testCaseStart(java.lang.String). Publishes the event `TestCaseEnd` with `name` as the parameter.
  Parameters:
    `name` - a logical name for the test "unit"

### testCaseStart

    void testCaseStart(java.lang.String name)

  Signifies the start of a "unit" of tests. (e.g. A JUnit TestCase). Must be called first, or after testCaseEnd(String,String,String). Publishes the event `TestCaseStart` with `name` as the parameter.
  Parameters:
    `name` - a logical name for the test "unit"

### testEnd

    void testEnd(java.lang.String name)

  Signifies that a test has ended. Must be called after testStart(java.lang.String) with the same name, or testStart(java.lang.String, java.lang.String, boolean) or testStart(java.lang.String, java.lang.Throwable, boolean) with the same name. Publishes the event `TestEnd` with `name` as the parameter.
  Parameters:
    `name` - a logical name for the test
    `failure` - a description of the failure
    `isError` - true if this failure was due to an indirect error, false if this failure was a direct assertion failure or incorrect assumption

### testFailure

    void testFailure(java.lang.String name, java.lang.Throwable failure, boolean isError = false)

  Signifies that a test did not complete successfully. Must be called after testStart(java.lang.String) with the same `name`. Publishes the event `TestFailure` with `name`, `failure` and `isError` as the parameters.
  Parameters:
    `name` - a logical name for the test
    `failure` - the throwable raised from the failure
    `isError` - true if this failure was due to an indirect error, false if this failure was a direct assertion failure or incorrect assumption

### testFailure

    void testFailure(java.lang.String name, java.lang.String failure = null, boolean isError = false)

  Signifies that a test did not complete successfully. Must be called after testStart(java.lang.String) with the same name. Publishes the event `TestFailure` with `name`, `failure` and `isError` as the parameters.
  Parameters:
    `name` - a logical name for the test
    `failure` - a description of the failure
    `isError` - true if this failure was due to an indirect error, false if this failure was a direct assertion failure or incorrect assumption

### testStart

    void testStart(java.lang.String name)

  Signifies the start of an individual test, inside a parent "unit". Must be called after testCaseStart(java.lang.String) or after testEnd(java.lang.String). Publishes the event `TestStart` with `name` as the parameter.
  Parameters:
    `name` - a logical name for the test

Groovy Documentation