com.mycila.testing.core.plugin
Class DefaultTestPlugin

java.lang.Object
  extended by com.mycila.testing.core.plugin.DefaultTestPlugin
All Implemented Interfaces:
com.mycila.plugin.api.Plugin, TestPlugin
Direct Known Subclasses:
AnnotationTestPlugin

public class DefaultTestPlugin
extends Object
implements TestPlugin

Adapter implementation of a Test Plugin which does nothing. It is strongly adviced that plugins extends this class instead of implementing directly TestPlugin interfaces, to avoid any code break when changing or enhancing the API.

Author:
Mathieu Carbou (mathieu.carbou@gmail.com)

Constructor Summary
DefaultTestPlugin()
           
 
Method Summary
 void afterClass(TestContext context)
          This method will be called on each plugin in order of dependency after all test method of a test instance have finished.
 void afterTest(TestExecution testExecution)
          This method will be called on each plugin in order of dependency after each test method has finished, even if the method failed.
 void beforeTest(TestExecution testExecution)
          This method will be called on each plugin in order of dependency to execute code required before a test method can run.
 List<String> getAfter()
           
 List<String> getBefore()
           
 void prepareTestInstance(TestContext context)
          This method will be called on each plugin in order of dependency to prepare the test instance before all tests begin to be executed.
 void shutdown(TestContext context)
          This method will be called at JVM shutdown if the plugin needs to close some resources cleanly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTestPlugin

public DefaultTestPlugin()
Method Detail

prepareTestInstance

public void prepareTestInstance(TestContext context)
                         throws Exception
Description copied from interface: TestPlugin
This method will be called on each plugin in order of dependency to prepare the test instance before all tests begin to be executed.

Specified by:
prepareTestInstance in interface TestPlugin
Parameters:
context - The test context, relative to one test instance
Throws:
Exception - If anything wrong occurs in plugin execution. Exception will be catched by the testing API.

getBefore

public List<String> getBefore()
Specified by:
getBefore in interface com.mycila.plugin.api.Plugin

getAfter

public List<String> getAfter()
Specified by:
getAfter in interface com.mycila.plugin.api.Plugin

beforeTest

public void beforeTest(TestExecution testExecution)
                throws Exception
Description copied from interface: TestPlugin
This method will be called on each plugin in order of dependency to execute code required before a test method can run.

Specified by:
beforeTest in interface TestPlugin
Parameters:
testExecution - The test execution context of this test method. The text execution enables plugins to control whethere the test method should be skipped or not
Throws:
Exception - If anything wrong occurs in plugin execution. Exception will be catched by the testing API.

afterTest

public void afterTest(TestExecution testExecution)
               throws Exception
Description copied from interface: TestPlugin
This method will be called on each plugin in order of dependency after each test method has finished, even if the method failed.

Specified by:
afterTest in interface TestPlugin
Parameters:
testExecution - The test execution context of this test method. The test execution context enables the plugins to handle what to do in case of a failed test, with the provided exception in the context
Throws:
Exception - If anything wrong occurs in plugin execution. Exception will be catched by the testing API.

afterClass

public void afterClass(TestContext context)
                throws Exception
Description copied from interface: TestPlugin
This method will be called on each plugin in order of dependency after all test method of a test instance have finished.

Specified by:
afterClass in interface TestPlugin
Parameters:
context - The context of this test
Throws:
Exception - If anything wrong occurs in plugin execution. Exception will be catched by the testing API.

shutdown

public void shutdown(TestContext context)
              throws Exception
Description copied from interface: TestPlugin
This method will be called at JVM shutdown if the plugin needs to close some resources cleanly.

Specified by:
shutdown in interface TestPlugin
Parameters:
context - The context of this test
Throws:
Exception - If anything wrong occurs in plugin execution. Exception will be catched by the testing API.


Copyright © 2008-2011 Mycila. All Rights Reserved.