Groovy Documentation

lsst.gruth.grutils
[Groovy] Class GruScript

java.lang.Object
  groovy.lang.GroovyObjectSupport
      groovy.lang.Script
          lsst.gruth.grutils.GruScript

abstract class GruScript
extends groovy.lang.Script

Base script class for Gru DSL.
Contains all the base calls (functions the describe a test set) and calls common to all contexts.
There are three phase for tests:


Base calls: Base utilities functions ; (TODO: document _thisG, and _thisL -group and local binding-)
Functions and variables accessible only during a test run:


Property Summary
groovy.lang.Binding _env

the calling environment (not used for the moment)

groovy.lang.Binding _this

A current binding for all the script.

GroupSpec currentBatchSpec

static GruScript running

 
Constructor Summary
GruScript()

GruScript(groovy.lang.Binding binding)

 
Method Summary
java.lang.Object _defaultBundle(java.lang.String name)

Helps resultReporters to determin a default bundle name for reports (example: a base name for files containing the report)

java.lang.Object _failIf(java.lang.String stringBooleanExpr)

Adds an AssertionReport to the current TztRun object: the result is FAILED if the evaluation of the string is true (the report also contains the evaluated string).

java.lang.Object _failIf(java.lang.String message, boolean booleanExpr)

Adds an AssertionReport to the current TztRun object: the result is FAILED if the evaluation of the expression is true (the report also contains the message)

java.lang.Object _failIfNot(java.lang.String stringBooleanExpr)

same specs as failIf but fails if false

java.lang.Object _failIfNot(java.lang.String message, boolean booleanExpr)

same specs as failIf but fails if false

java.lang.Object _message(java.lang.String message)

adds a message to the report @return

java.lang.Object _neutral(java.lang.String stringExpression)

Adds an AssertionReport to the current TztRun object: the result is NEUTRAL if the evaluation of the string is true (the report also contains the evaluated string).

java.lang.Object _neutral(java.lang.String message, groovy.lang.Closure closure)

Adds an AssertionReport to the current TztRun object: the result is NEUTRAL if the evaluation of the expression is true (the report also contains the message)

java.lang.Object _okIfCaught(java.lang.Class throwClass)

Adds an AssertionReport to the current TztRun object: forces the report to be ok if exception of this type is fires.

java.io.Serializable _reportData(java.io.Serializable data)

used to add some data to the report (does not change the result of the test)

java.lang.Object _run(BuildGroupSpec buildSpec)

NOT IMPLEMENTED

java.lang.Object _runAll()

run all the test still registered in the global "groups" variable and run the reports.

TaggedsMap _vars(java.util.Map map)

Declares a set of Tagged objects.

TaggedsMap _vars()

java.lang.Object _warnIf(java.lang.String stringBooleanExpr)

Adds an AssertionReport to the current TztRun object: the result is WARNINGS if the evaluation of the string is true (the report also contains the evaluated string).

java.lang.Object _warnIf(java.lang.String message, boolean booleanExpr)

Adds an AssertionReport to the current TztRun object: the result is WARNINGS if the evaluation of the expression is true (the report also contains the message)

java.lang.Object _warnIfNot(java.lang.String stringBooleanExpr)

same specs as warnIf but warns if false

java.lang.Object _warnIfNot(java.lang.String message, boolean booleanExpr)

same specs as warnIf but warns if false

BuildGroupSpec _withClass(java.lang.Class clazz)

Starts registering a group of test specs for an existing class.

GroupRun _withClass(java.lang.Class clazz, groovy.lang.Closure clos)

Enables a simplified syntax for _withClass clazz _group { /test code / } that could be written : _withClass class {/ test code / }

BuildGroupSpec _withClass(java.lang.String className)

Starts registering a group of test specs for a class that may exist of not.

BuildGroupSpec _withClass(java.lang.String className, groovy.lang.Closure closure)

InvokeGroupSpec _withObjects(java.lang.Object... objs)

Starts registering tests on tagged objects (instance methods are going to be tested)

java.lang.Object _xport(java.lang.String name, TaggedsMap map)

same as _vars but these are going to be exported to other tests batch
NOT IMPLEMENTED
TODO: with .gruh files?

java.lang.Object get_args()

java.lang.Object get_argsNames()

java.lang.String get_className()

normally not to be called but who knows?

java.lang.Object get_it()

java.lang.String get_methodName()

java.lang.String get_rawTestName()

java.lang.Object get_result()

groovy.lang.Binding get_thisL()

private void initThis()

 
Methods inherited from class groovy.lang.Script
groovy.lang.Script#println(), groovy.lang.Script#println(java.lang.Object), groovy.lang.Script#run(), groovy.lang.Script#run(java.io.File, [Ljava.lang.String;), groovy.lang.Script#setProperty(java.lang.String, java.lang.Object), groovy.lang.Script#getProperty(java.lang.String), groovy.lang.Script#print(java.lang.Object), groovy.lang.Script#printf(java.lang.String, java.lang.Object), groovy.lang.Script#printf(java.lang.String, [Ljava.lang.Object;), groovy.lang.Script#evaluate(java.lang.String), groovy.lang.Script#evaluate(java.io.File), groovy.lang.Script#getBinding(), groovy.lang.Script#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.Script#setBinding(groovy.lang.Binding), groovy.lang.Script#getMetaClass(), groovy.lang.Script#setMetaClass(groovy.lang.MetaClass), groovy.lang.Script#wait(), groovy.lang.Script#wait(long), groovy.lang.Script#wait(long, int), groovy.lang.Script#equals(java.lang.Object), groovy.lang.Script#toString(), groovy.lang.Script#hashCode(), groovy.lang.Script#getClass(), groovy.lang.Script#notify(), groovy.lang.Script#notifyAll()
 
Methods inherited from class groovy.lang.GroovyObjectSupport
groovy.lang.GroovyObjectSupport#setProperty(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#getProperty(java.lang.String), groovy.lang.GroovyObjectSupport#getMetaClass(), groovy.lang.GroovyObjectSupport#invokeMethod(java.lang.String, java.lang.Object), groovy.lang.GroovyObjectSupport#setMetaClass(groovy.lang.MetaClass), groovy.lang.GroovyObjectSupport#wait(), groovy.lang.GroovyObjectSupport#wait(long), groovy.lang.GroovyObjectSupport#wait(long, int), groovy.lang.GroovyObjectSupport#equals(java.lang.Object), groovy.lang.GroovyObjectSupport#toString(), groovy.lang.GroovyObjectSupport#hashCode(), groovy.lang.GroovyObjectSupport#getClass(), groovy.lang.GroovyObjectSupport#notify(), groovy.lang.GroovyObjectSupport#notifyAll()
 

Property Detail

_env

groovy.lang.Binding _env
the calling environment (not used for the moment)


_this

groovy.lang.Binding _this
A current binding for all the script. Typically variables declared through the _vars are setted in the _this context. A special variable NO_ARG is kept here. It is also where "global" variables are kept.

Global variables :


currentBatchSpec

GroupSpec currentBatchSpec


running

static GruScript running


 
Constructor Detail

GruScript

GruScript()


GruScript

GruScript(groovy.lang.Binding binding)


 
Method Detail

_defaultBundle

java.lang.Object _defaultBundle(java.lang.String name)
Helps resultReporters to determin a default bundle name for reports (example: a base name for files containing the report)
Parameters:
name
Returns:


_failIf

java.lang.Object _failIf(java.lang.String stringBooleanExpr)
Adds an AssertionReport to the current TztRun object: the result is FAILED if the evaluation of the string is true (the report also contains the evaluated string). [NOT WORKING PROPERLY -YET-]
Parameters:
stringBooleanExpr - a Gstring representing a valid Groovy expression
Returns:


_failIf

java.lang.Object _failIf(java.lang.String message, boolean booleanExpr)
Adds an AssertionReport to the current TztRun object: the result is FAILED if the evaluation of the expression is true (the report also contains the message)
Parameters:
message - to be displayed in the report
booleanExpr - before evaluating exceptionfired should be tested
Returns:


_failIfNot

java.lang.Object _failIfNot(java.lang.String stringBooleanExpr)
same specs as failIf but fails if false
Parameters:
stringBooleanExpr
Returns:


_failIfNot

java.lang.Object _failIfNot(java.lang.String message, boolean booleanExpr)
same specs as failIf but fails if false


_message

java.lang.Object _message(java.lang.String message)
adds a message to the report
Returns:


_neutral

java.lang.Object _neutral(java.lang.String stringExpression)
Adds an AssertionReport to the current TztRun object: the result is NEUTRAL if the evaluation of the string is true (the report also contains the evaluated string). [NOT WORKING PROPERLY -YET-]
Parameters:
stringBooleanExpr - a Gstring representing a valid Groovy expression
Returns:


_neutral

java.lang.Object _neutral(java.lang.String message, groovy.lang.Closure closure)
Adds an AssertionReport to the current TztRun object: the result is NEUTRAL if the evaluation of the expression is true (the report also contains the message)
Parameters:
message - to be displayed in the report
booleanExpr
Returns:


_okIfCaught

java.lang.Object _okIfCaught(java.lang.Class throwClass)
Adds an AssertionReport to the current TztRun object: forces the report to be ok if exception of this type is fires. if any evaluation of assertions crashes the result is still ok
arg:
Throwable classes (should be a List?)
Returns:


_reportData

java.io.Serializable _reportData(java.io.Serializable data)
used to add some data to the report (does not change the result of the test)
Parameters:
data - any serializable data
Returns:
the argument


_run

java.lang.Object _run(BuildGroupSpec buildSpec)
NOT IMPLEMENTED
Parameters:
buildSpec
Returns:


_runAll

java.lang.Object _runAll()
run all the test still registered in the global "groups" variable and run the reports.
after this call the groups variable has no groups to run.
Returns:


_vars

TaggedsMap _vars(java.util.Map map)
Declares a set of Tagged objects. These are known to the local tests batch (that is to the current gru file)
Parameters:
map
Returns:


_vars

TaggedsMap _vars()


_warnIf

java.lang.Object _warnIf(java.lang.String stringBooleanExpr)
Adds an AssertionReport to the current TztRun object: the result is WARNINGS if the evaluation of the string is true (the report also contains the evaluated string). [NOT WORKING PROPERLY -YET-]
Parameters:
stringBooleanExpr - a Gstring representing a valid Groovy expression
Returns:


_warnIf

java.lang.Object _warnIf(java.lang.String message, boolean booleanExpr)
Adds an AssertionReport to the current TztRun object: the result is WARNINGS if the evaluation of the expression is true (the report also contains the message)
Parameters:
message - to be displayed in the report
booleanExpr
Returns:


_warnIfNot

java.lang.Object _warnIfNot(java.lang.String stringBooleanExpr)
same specs as warnIf but warns if false


_warnIfNot

java.lang.Object _warnIfNot(java.lang.String message, boolean booleanExpr)
same specs as warnIf but warns if false


_withClass

BuildGroupSpec _withClass(java.lang.Class clazz)
Starts registering a group of test specs for an existing class. this suppose that the class exists when specifying the script.
Parameters:
clazz - the class on which constructors or static code is to be tested
Returns:
BuildGroupSpec object (see class)


_withClass

GroupRun _withClass(java.lang.Class clazz, groovy.lang.Closure clos)
Enables a simplified syntax for _withClass clazz _group { /test code / } that could be written : _withClass class {/ test code / }
Parameters:
clazz - Class on which to call constructor
clos - group test specification
Returns:
a group run


_withClass

BuildGroupSpec _withClass(java.lang.String className)
Starts registering a group of test specs for a class that may exist of not. if the class does not exist the results will be NOT_YET_IMPLEMENTED.
Parameters:
className - the class on which constructors or static code is to be tested
Returns:
BuildGroupSpec object (see class)


_withClass

BuildGroupSpec _withClass(java.lang.String className, groovy.lang.Closure closure)


_withObjects

InvokeGroupSpec _withObjects(java.lang.Object... objs)
Starts registering tests on tagged objects (instance methods are going to be tested)
Parameters:
objs
Returns:


_xport

java.lang.Object _xport(java.lang.String name, TaggedsMap map)
same as _vars but these are going to be exported to other tests batch
NOT IMPLEMENTED
TODO: with .gruh files?
Parameters:
map
Returns:


get_args

java.lang.Object get_args()


get_argsNames

java.lang.Object get_argsNames()


get_className

java.lang.String get_className()
normally not to be called but who knows?
arg:
a list of Throwable classes
Returns:
def _failIfCaught(Class throwClass) { }


get_it

java.lang.Object get_it()


get_methodName

java.lang.String get_methodName()


get_rawTestName

java.lang.String get_rawTestName()


get_result

java.lang.Object get_result()


get_thisL

groovy.lang.Binding get_thisL()


initThis

private void initThis()


 

Groovy Documentation