|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.struts.action.Action
com.jcorporate.expresso.core.controller.Controller
com.jcorporate.expresso.core.controller.DBController
com.jcorporate.expresso.ext.controller.TestController
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.
| Field Summary | |
protected junit.runner.TestSuiteLoader |
fTestLoader
|
| Fields inherited from class com.jcorporate.expresso.core.controller.Controller |
CONTROLLER_PARAM_KEY, CTL_SUCC_CTL, CTL_SUCC_STATE, CTL_SUCC_TRAN, mLog, NEWSTATE_EXCEPTION_KEY, ORIGINAL_URL_KEY, REQUEST_KEY, RESPONSE_KEY, RETURN_TO_SENDER_TRAN, STATE_ERR_CTL, STATE_ERR_STATE, STATE_ERR_TRAN, STATE_PARAM_KEY, STATE_SUCC_CTL, STATE_SUCC_STATE, STATE_SUCC_TRAN |
| Fields inherited from class org.apache.struts.action.Action |
ACTION_SERVLET_KEY, APPLICATION_KEY, DATA_SOURCE_KEY, defaultLocale, ERROR_KEY, EXCEPTION_KEY, FORM_BEANS_KEY, FORWARDS_KEY, LOCALE_KEY, MAPPING_KEY, MAPPINGS_KEY, MESSAGE_KEY, MESSAGES_KEY, MULTIPART_KEY, PLUG_INS_KEY, REQUEST_PROCESSOR_KEY, servlet, SERVLET_KEY, TRANSACTION_TOKEN_KEY |
| Constructor Summary | |
TestController()
Default constructor |
|
| Method Summary | |
void |
addError(junit.framework.Test test,
Throwable t)
|
void |
addFailure(junit.framework.Test test,
junit.framework.AssertionFailedError t)
Added since JUnit 3.7 |
void |
addFailure(junit.framework.Test test,
Throwable t)
|
protected void |
clearStatus()
Clears the status message. |
protected junit.framework.TestResult |
createTestResult()
Creates the TestResult to be used for the test run. |
protected junit.framework.TestResult |
doRun(junit.framework.Test suite,
boolean wait)
|
String |
elapsedTimeAsString(long runTime)
Returns the formatted string of the elapsed time. |
void |
endTest(junit.framework.Test test)
|
String |
extractClassName(String className)
|
static junit.runner.TestSuiteLoader |
getLoader()
Returns the loader to be used. |
junit.framework.Test |
getTest(String suiteClassName)
Returns the Test corresponding to the given suite. |
String |
getTitle()
Return the title of this Controller |
static boolean |
inVAJava()
|
protected Class |
loadSuiteClass(String suiteClassName)
Returns the loaded Class for a suite name. |
ControllerResponse |
newState(String newState,
ControllerRequest params)
Standard method to select the appropriate next state as the controller moves from state to state. |
void |
print(junit.framework.TestResult result)
Prints failures to the log |
void |
printErrors(junit.framework.TestResult result)
Prints the errors to the log |
void |
printFailures(junit.framework.TestResult result)
Prints failures to the log |
void |
printHeader(junit.framework.TestResult result)
Prints the header of the report |
static void |
run(Class testClass)
Runs a suite extracted from a TestCase subclass. |
static void |
run(junit.framework.Test suite)
Runs a single test and collects its results. |
protected void |
runFailed(String message)
|
protected void |
runPromptTestState(ControllerRequest request,
ControllerResponse response)
test a transition to a controller/state which requires a form |
protected void |
runTransition2FormTestState(ControllerRequest request,
ControllerResponse response)
test a transition to a controller/state which requires a form |
protected void |
runTransitionFromFormTestState(ControllerRequest request,
ControllerResponse response)
test a transition from a controller/state which uses a form to one that does not use a form |
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 junit.framework.TestResult |
start(String testName)
Starts a test run. |
void |
startTest(junit.framework.Test test)
|
static String |
truncate(String s)
Truncates a String to the maximum length. |
| Methods inherited from class com.jcorporate.expresso.core.controller.DBController |
getString, isAllowed, stateAllowed |
| Methods inherited from class org.apache.struts.action.Action |
execute, generateToken, getDataSource, getDataSource, getLocale, getResources, getResources, getResources, getServlet, isCancelled, isTokenValid, isTokenValid, perform, perform, resetToken, saveErrors, saveMessages, saveToken, setLocale, setServlet, toHex |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected junit.runner.TestSuiteLoader fTestLoader
| Constructor Detail |
public TestController()
| Method Detail |
public ControllerResponse newState(String newState,
ControllerRequest params)
throws ControllerException,
NonHandleableException
newState in class ControllernewState - params - The calling controllerRequest object.
ControllerException - on Error
NonHandleableException - if the error should not be handled
by an error controller
public void addError(junit.framework.Test test,
Throwable t)
addError in interface junit.framework.TestListenertest - t -
public void addFailure(junit.framework.Test test,
Throwable t)
test - t - protected junit.framework.TestResult createTestResult()
protected junit.framework.TestResult doRun(junit.framework.Test suite,
boolean wait)
suite - wait -
public void endTest(junit.framework.Test test)
endTest in interface junit.framework.TestListenertest -
public void addFailure(junit.framework.Test test,
junit.framework.AssertionFailedError t)
addFailure in interface junit.framework.TestListenerpublic void print(junit.framework.TestResult result)
result - public void printErrors(junit.framework.TestResult result)
result - public void printFailures(junit.framework.TestResult result)
result - public void printHeader(junit.framework.TestResult result)
result - public static void run(Class testClass)
testClass - public static void run(junit.framework.Test suite)
public static void main (String[] args) {
test.textui.TestRunner.run(suite());
}
suite -
protected junit.framework.TestResult start(String testName)
throws Exception
testName -
Exceptionprotected void runFailed(String message)
message - public void startTest(junit.framework.Test test)
startTest in interface junit.framework.TestListenertest - public junit.framework.Test getTest(String suiteClassName)
suiteClassName -
public String elapsedTimeAsString(long runTime)
runTime -
public String extractClassName(String className)
className -
public static String truncate(String s)
s -
protected Class loadSuiteClass(String suiteClassName)
throws ClassNotFoundException
suiteClassName -
ClassNotFoundExceptionprotected void clearStatus()
public static junit.runner.TestSuiteLoader getLoader()
public static boolean inVAJava()
public String getTitle()
Controller
getTitle in class Controller
protected void runTransition2FormTestState(ControllerRequest request,
ControllerResponse response)
throws ControllerException,
NonHandleableException
ControllerException
NonHandleableException
protected void runTransitionTestState(ControllerRequest request,
ControllerResponse response)
throws ControllerException,
NonHandleableException
ControllerException
NonHandleableException
protected void runPromptTestState(ControllerRequest request,
ControllerResponse response)
throws ControllerException,
NonHandleableException
ControllerException
NonHandleableException
protected void runTransitionFromFormTestState(ControllerRequest request,
ControllerResponse response)
throws ControllerException,
NonHandleableException
ControllerException
NonHandleableException
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||