Class JUnitFixtureMethodsExtension
- java.lang.Object
-
- org.spockframework.runtime.extension.builtin.JUnitFixtureMethodsExtension
-
- All Implemented Interfaces:
IGlobalExtension
public class JUnitFixtureMethodsExtension extends java.lang.Object implements IGlobalExtension
Adapts the JUnitBefore,After,BeforeClassandAfterClassfixture 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 bepublic. Moreover,BeforeandAfterfixture methods must be instance methods whileBeforeClassandAfterClassfixture methods must be static. Any methods that do not meet the requirements will be silently ignored.BeforeClassfixture methods will be executed once before any feature methods orBeforeorsetup()methods, and before thesetupSpec()method (if present). Inheritance semantics are identical tosetupSpec(), i.e. methods are executed for each class in the hierarchy in turn from parent to child.Beforefixture methods will be executed before every feature method and before thesetup()method (if present). Inheritance semantics are identical tosetup(), i.e. methods are executed for each class in the hierarchy in turn from parent to child.Afterfixture methods will be executed after every feature method and after thecleanup()method (if present). Inheritance semantics are identical tocleanup(), i.e. methods are executed for each class in the hierarchy in turn from child to parent.AfterClassfixture methods will be executed once after all feature methods and afterAfterandcleanup()methods, and after thecleanupSpec()method (if present). Inheritance semantics are identical tocleanupSpec(), 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).
- Author:
- Luke Daley
-
-
Constructor Summary
Constructors Constructor Description JUnitFixtureMethodsExtension()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisitSpec(SpecInfo spec)
-
-
-
Method Detail
-
visitSpec
public void visitSpec(SpecInfo spec)
- Specified by:
visitSpecin interfaceIGlobalExtension
-
-