public class JUnitFixtureMethodsExtension extends java.lang.Object implements IGlobalExtension
Before, After, BeforeClass and AfterClass fixture mechanism to Spock.
The method signature requirements that JUnit has for fixture methods apply exactly to Spock as well. That is, fixture methods
must return void, must take no arguments and must be public. Moreover, Before and After fixture
methods must be instance methods while BeforeClass and AfterClass fixture methods must be static.
Any methods that do not meet the requirements will be silently ignored.
BeforeClass fixture methods will be executed once before any feature methods or Before or setup()
methods, and before the setupSpec() method (if present). Inheritance semantics are identical
to setupSpec(), i.e. methods are executed for each class in the hierarchy in turn from parent to child.
Before fixture methods will be executed before every feature method and before
the setup() method (if present). Inheritance semantics are identical to setup(), i.e. methods are
executed for each class in the hierarchy in turn from parent to child.
After fixture methods will be executed after every feature method and after
the cleanup() method (if present). Inheritance semantics are identical to cleanup(), i.e. methods are
executed for each class in the hierarchy in turn from child to parent.
AfterClass fixture methods will be executed once after all feature methods and after After and
cleanup() methods, and after the cleanupSpec() method (if present). Inheritance semantics
are identical to cleanupSpec(), i.e. methods are executed for each class in the hierarchy in turn from child to parent.
The execution order of fixture methods of the same type withing the same class is undefined (as it is with JUnit).
| Constructor and Description |
|---|
JUnitFixtureMethodsExtension() |
public void visitSpec(SpecInfo spec)
visitSpec in interface IGlobalExtensionCopyright © 2012. All rights reserved