| com.jcorporate.expresso.core.controller.DBController com.jcorporate.expresso.ext.controller.TestController
TestController | public class TestController extends DBController implements TestListener(Code) | | TestController is a controller that can access and run
JUnit unit tests, but from within an Expresso environment (e.g.
with the DBConnection pool, Cache, and other Expresso items
available, and from a servlet (such as ControllerServlet).
This allows tests that require the servlet environment or Expresso
components to be executed.
author: Michael Nash |
Method Summary | |
public synchronized void | addError(Test test, Throwable t) | public synchronized void | addFailure(Test test, Throwable t) | public void | addFailure(Test test, AssertionFailedError t) | protected void | clearStatus() Clears the status message. | protected TestResult | createTestResult() Creates the TestResult to be used for the test run. | protected synchronized TestResult | doRun(Test suite, boolean wait) | public String | elapsedTimeAsString(long runTime) Returns the formatted string of the elapsed time. | public void | endTest(Test test) | public String | extractClassName(String className) | public static TestSuiteLoader | getLoader() Returns the loader to be used. | public Test | getTest(String suiteClassName) Returns the Test corresponding to the given suite. | public String | getTitle() | public static boolean | inVAJava() | protected Class | loadSuiteClass(String suiteClassName) Returns the loaded Class for a suite name. | public ControllerResponse | newState(String newState, ControllerRequest params) Standard method to select the appropriate next state as the
controller moves from state to state. | public synchronized void | print(TestResult result) | public void | printErrors(TestResult result) | public void | printFailures(TestResult result) | public void | printHeader(TestResult result) | public static void | run(Class testClass) Runs a suite extracted from a TestCase subclass. | public static void | run(Test suite) Runs a single test and collects its results. | protected void | runFailed(String message) | protected void | runPromptTestState(ControllerRequest request, ControllerResponse response) | protected void | runTransition2FormTestState(ControllerRequest request, ControllerResponse response) | protected void | runTransitionFromFormTestState(ControllerRequest request, ControllerResponse response) | protected void | runTransitionTestState(ControllerRequest request, ControllerResponse response) test a transition to a controller/state
note that the ControllerSecurityMatrix output uses the default layout,
so the title at the top of that page will show this test controller. | protected synchronized TestResult | start(String testName) Starts a test run. | public synchronized void | startTest(Test test) | public static String | truncate(String s) Truncates a String to the maximum length. |
fMaxMessage | static int fMaxMessage(Code) | | |
fTestLoader | protected TestSuiteLoader fTestLoader(Code) | | |
TestController | public TestController()(Code) | | Default constructor
|
addError | public synchronized void addError(Test test, Throwable t)(Code) | | Parameters: test - Parameters: t - |
addFailure | public synchronized void addFailure(Test test, Throwable t)(Code) | | Parameters: test - Parameters: t - |
addFailure | public void addFailure(Test test, AssertionFailedError t)(Code) | | Added since JUnit 3.7
|
clearStatus | protected void clearStatus()(Code) | | Clears the status message.
|
createTestResult | protected TestResult createTestResult()(Code) | | Creates the TestResult to be used for the test run.
|
doRun | protected synchronized TestResult doRun(Test suite, boolean wait)(Code) | | Parameters: suite - Parameters: wait - |
elapsedTimeAsString | public String elapsedTimeAsString(long runTime)(Code) | | Returns the formatted string of the elapsed time.
Parameters: runTime - |
endTest | public void endTest(Test test)(Code) | | Parameters: test - |
extractClassName | public String extractClassName(String className)(Code) | | Parameters: className - |
getLoader | public static TestSuiteLoader getLoader()(Code) | | Returns the loader to be used.
|
getTest | public Test getTest(String suiteClassName)(Code) | | Returns the Test corresponding to the given suite. This is
a template method, subclasses override runFailed(), clearStatus().
Parameters: suiteClassName - |
inVAJava | public static boolean inVAJava()(Code) | | |
print | public synchronized void print(TestResult result)(Code) | | Prints failures to the log
Parameters: result - |
printErrors | public void printErrors(TestResult result)(Code) | | Prints the errors to the log
Parameters: result - |
printFailures | public void printFailures(TestResult result)(Code) | | Prints failures to the log
Parameters: result - |
printHeader | public void printHeader(TestResult result)(Code) | | Prints the header of the report
Parameters: result - |
run | public static void run(Class testClass)(Code) | | Runs a suite extracted from a TestCase subclass.
Parameters: testClass - |
run | public static void run(Test suite)(Code) | | Runs a single test and collects its results.
This method can be used to start a test run
from your program.
public static void main (String[] args) {
test.textui.TestRunner.run(suite());
}
Parameters: suite - |
runFailed | protected void runFailed(String message)(Code) | | Parameters: message - |
start | protected synchronized TestResult start(String testName) throws Exception(Code) | | Starts a test run. Analyzes the command line arguments
and runs the given test suite.
Parameters: testName - |
startTest | public synchronized void startTest(Test test)(Code) | | Parameters: test - |
truncate | public static String truncate(String s)(Code) | | Truncates a String to the maximum length.
Parameters: s - |
|
|