The test specification grammar provides a very flexible way to call out which tests to run. The basic structure is this:
specification ::= unary | binary | compound
unary ::= tags | suite | classMethods | properties
binary ::= (unary | compound) and | or (unary | compound)
compound ::= '(' binary ')'
tags ::= '<' tagName (',' (all | success | fail | error | failError)? '>'
suite ::= '[' suiteName (',' suiteName)* ']'
properties ::= '{' propertyName ':' singleQuotedValue (',' propertyName ':' singleQuotedValue)* '}'
classMethods ::= (('%' packageName)? ('@' className) | qualifiedName) ('#' methodName)? ('$' operationName)?
Probably the best way to explain this is with some examples:
Specification | Result |
---|---|
@classname | Run every method in every class with 'classname' in the name. |
%pack | Run every method in every class with 'pack' in the package name |
$operation | Run every class and method, but only execute operations named 'operation' |
#method | Matches just the method name |
%pack1@class1#method1$operation1 | Selects packages containing 'pack1', classes named 'class1', methods named 'method1', and only executes operations named 'operation1' |
@classname and %pack | Run every method which matches both of the previous conditions. This is a compound statement. |
<tag> | Run the tag named 'tag' using the 'all' set. |
<tag, fail> | Run the tag named 'tag' using the 'fail' set. |
[ aud ] | Run every method in every class with the @JoinSuite tag with the name aud. |
{ property: 'value' }
| Run every method in all classes which contain an operation with a parameter named 'property' and the value 'value' |
All of the selectors have the effect of choosing any test to run that they match. If an operation is specified (using $), only those operations are executed. The properties selector will select the entire method is a single operation matches.
Add Comment