|
|||||||||||||||||||
| 30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| WebappTestRunner.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* ========================================================================
|
|
| 3 |
*
|
|
| 4 |
* Copyright 2001-2004 The Apache Software Foundation.
|
|
| 5 |
*
|
|
| 6 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
| 7 |
* you may not use this file except in compliance with the License.
|
|
| 8 |
* You may obtain a copy of the License at
|
|
| 9 |
*
|
|
| 10 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
| 11 |
*
|
|
| 12 |
* Unless required by applicable law or agreed to in writing, software
|
|
| 13 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
| 14 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
| 15 |
* See the License for the specific language governing permissions and
|
|
| 16 |
* limitations under the License.
|
|
| 17 |
*
|
|
| 18 |
* ========================================================================
|
|
| 19 |
*/
|
|
| 20 |
package org.apache.cactus.internal.server.runner;
|
|
| 21 |
|
|
| 22 |
import junit.framework.AssertionFailedError;
|
|
| 23 |
import junit.framework.Test;
|
|
| 24 |
import junit.runner.BaseTestRunner;
|
|
| 25 |
import junit.runner.TestSuiteLoader;
|
|
| 26 |
|
|
| 27 |
/**
|
|
| 28 |
* JUnit Test Runner that can load test cases that are in the classpath of
|
|
| 29 |
* a webapp. This test runner is supposed to be executed from within the
|
|
| 30 |
* webapp.
|
|
| 31 |
*
|
|
| 32 |
* @version $Id: WebappTestRunner.java 238991 2004-05-22 11:34:50Z vmassol $
|
|
| 33 |
*/
|
|
| 34 |
public class WebappTestRunner extends BaseTestRunner |
|
| 35 |
{
|
|
| 36 |
/**
|
|
| 37 |
* Error message if the suite failed to load.
|
|
| 38 |
*/
|
|
| 39 |
private String errorMessage;
|
|
| 40 |
|
|
| 41 |
/**
|
|
| 42 |
* Overridden from BaseTestRunner in order to use either the context
|
|
| 43 |
* class loader or the webapp one.
|
|
| 44 |
*
|
|
| 45 |
* @return a loader that loads classes using the context class loader or
|
|
| 46 |
* the webapp class loader.
|
|
| 47 |
*/
|
|
| 48 | 0 |
public TestSuiteLoader getLoader()
|
| 49 |
{
|
|
| 50 | 0 |
return new WebappTestSuiteLoader(); |
| 51 |
} |
|
| 52 |
|
|
| 53 |
/**
|
|
| 54 |
* Event called by the base test runner when it fails to load a test suite.
|
|
| 55 |
*
|
|
| 56 |
* @param theMessage the message of the failure
|
|
| 57 |
*/
|
|
| 58 | 0 |
protected void runFailed(String theMessage) |
| 59 |
{
|
|
| 60 | 0 |
this.errorMessage = theMessage;
|
| 61 |
} |
|
| 62 |
|
|
| 63 |
/**
|
|
| 64 |
* @return the error message provided by <code>BaseTestRunner</code> if it
|
|
| 65 |
* failed to load the test suite
|
|
| 66 |
*/
|
|
| 67 | 0 |
public String getErrorMessage()
|
| 68 |
{
|
|
| 69 | 0 |
return this.errorMessage; |
| 70 |
} |
|
| 71 |
|
|
| 72 |
/**
|
|
| 73 |
* Event called by the base test runner when the test ends.
|
|
| 74 |
*
|
|
| 75 |
* @param theTestName the test case name
|
|
| 76 |
*/
|
|
| 77 | 0 |
public void testEnded(String theTestName) |
| 78 |
{
|
|
| 79 |
// not used
|
|
| 80 |
} |
|
| 81 |
|
|
| 82 |
/**
|
|
| 83 |
* Event called by the base test runner when the test fails.
|
|
| 84 |
*
|
|
| 85 |
* @param theStatus the status code of the error
|
|
| 86 |
* @param theTest the test object that failed
|
|
| 87 |
* @param theThrowable the exception that was thrown
|
|
| 88 |
*/
|
|
| 89 | 0 |
public void testFailed(int theStatus, Test theTest, Throwable theThrowable) |
| 90 |
{
|
|
| 91 |
// not used
|
|
| 92 |
} |
|
| 93 |
|
|
| 94 |
/**
|
|
| 95 |
* Event called by the base test runner when the test starts.
|
|
| 96 |
*
|
|
| 97 |
* @param theTestName the test case name
|
|
| 98 |
*/
|
|
| 99 | 0 |
public void testStarted(String theTestName) |
| 100 |
{
|
|
| 101 |
// not used
|
|
| 102 |
} |
|
| 103 |
|
|
| 104 |
/**
|
|
| 105 |
* @see BaseTestRunner#addError(Test, Throwable)
|
|
| 106 |
*/
|
|
| 107 | 0 |
public void addError(Test theTest, Throwable theThrowable) |
| 108 |
{
|
|
| 109 |
// not used
|
|
| 110 |
} |
|
| 111 |
|
|
| 112 |
/**
|
|
| 113 |
* @see BaseTestRunner#addFailure(Test, AssertionFailedError)
|
|
| 114 |
*/
|
|
| 115 | 0 |
public void addFailure(Test theTest, |
| 116 |
AssertionFailedError theAssertionFailedError) |
|
| 117 |
{
|
|
| 118 |
// not used
|
|
| 119 |
} |
|
| 120 |
|
|
| 121 |
/**
|
|
| 122 |
* @see BaseTestRunner#endTest(Test)
|
|
| 123 |
*/
|
|
| 124 | 0 |
public void endTest(Test theTest) |
| 125 |
{
|
|
| 126 |
// not used
|
|
| 127 |
} |
|
| 128 |
|
|
| 129 |
/**
|
|
| 130 |
* @see BaseTestRunner#startTest(Test)
|
|
| 131 |
*/
|
|
| 132 | 0 |
public void startTest(Test theTest) |
| 133 |
{
|
|
| 134 |
// not used
|
|
| 135 |
} |
|
| 136 |
} |
|
| 137 |
|
|
||||||||||