|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.cactus.internal.AbstractCactusTestCase
org.apache.cactus.ServletTestCase
org.apache.cactus.JspTestCase
test.util.MakumbaJspTestCase
public abstract class MakumbaJspTestCase
Utility class which enables it to quickly write tests based on the execution of a JSP. Since we know the expected result, we can fetch this result and store it into a file, and then compare the next executions of the test against this file.
Nested Class Summary | |
---|---|
static class |
MakumbaJspTestCase.JspTest
|
static class |
MakumbaJspTestCase.MakumbaJspTestCaseDecorator
|
static class |
MakumbaJspTestCase.Suite
|
Field Summary | |
---|---|
protected Map<String,String> |
differentNameJspsMap
for dynamically built suites, the tests whose included jsp has a different name |
protected Map<String,String> |
differentNameJspsReverseMap
|
(package private) Set<String> |
disabledTests
|
protected String |
jspDir
JSP dir of the suite |
protected boolean |
recording
recording mode |
protected com.meterware.httpunit.WebResponse |
submissionResponse
some tests will compare content against the response of a form submission |
protected String[] |
tests
for dynamically built suites, the names and order of tests |
Fields inherited from class org.apache.cactus.JspTestCase |
---|
out, pageContext |
Fields inherited from class org.apache.cactus.ServletTestCase |
---|
config, request, response, session |
Constructor Summary | |
---|---|
MakumbaJspTestCase()
|
Method Summary | |
---|---|
protected boolean |
compareTest(String result,
String testName)
Compares a test output to its stored (expected) result. |
protected void |
compareToFile(com.meterware.httpunit.WebResponse response,
String testName)
|
protected void |
compareToFileWithTestName(com.meterware.httpunit.WebResponse response)
Compare the given WebResponse to the file that has the name of the current test |
protected void |
differentNameJsps(String name,
String jsp)
|
protected void |
disableTest(String test)
|
protected void |
fetchValidTestResult(String output,
String testName,
boolean record)
Method that helps to fetch the result of a test, on the first run. |
protected com.meterware.httpunit.WebForm |
getFormInJsp(String page)
Retrieve the indicated page, compare the content to the comparison file with the test name, and return the first form in the page. |
protected com.meterware.httpunit.WebForm |
getFormInJsp(String page,
boolean check)
Retrieve the indicated page, optionally compare the content to the comparison file with the test name, and return the first form in the page. |
protected com.meterware.httpunit.WebForm |
getFormInJspWithTestName()
Retrieve the page with the test name from the suite JSP dir, compare the content to the comparison file with the test name, and return the first form in the page. |
protected com.meterware.httpunit.WebForm |
getFormInJspWithTestName(boolean check)
Retrieve the page with the test name from the suite JSP dir, optionally compare the content to the comparison file with the test name, and return the first form in the page. |
String |
getJspDir()
The JSP dir of this suite |
protected com.meterware.httpunit.WebResponse |
getJspResponse(String page,
boolean check)
Retrieve the indicated page, optionally compare the content to the comparison file with the test name. |
boolean |
getRecordingMode()
Recording mode of the suite, for generating comparison files. |
protected void |
includeJspWithTestName()
Include the JSP from the JSP dir of this suite that has the name of the currently running test |
static junit.framework.Test |
makeJspDirSuite(MakumbaJspTestCase prototype,
String queryLang)
Make a dynamic test suite, from a prototype object by looking into its JSP folder. |
static junit.framework.Test |
makeJspSuite(MakumbaJspTestCase prototype,
String queryLang)
Make a dynamic test suite, from a prototype object. |
static junit.framework.Test |
makeSuite(Class<?> claz,
String queryLang)
Make a test suite using the standard, reflection-based mechanism |
Methods inherited from class org.apache.cactus.JspTestCase |
---|
createProtocolHandler |
Methods inherited from class org.apache.cactus.internal.AbstractCactusTestCase |
---|
runBare, runBareServer |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runTest, setName, setUp, tearDown, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.cactus.internal.CactusTestCase |
---|
runBareServer |
Field Detail |
---|
protected boolean recording
protected String jspDir
protected String[] tests
protected Map<String,String> differentNameJspsMap
protected Map<String,String> differentNameJspsReverseMap
protected com.meterware.httpunit.WebResponse submissionResponse
Set<String> disabledTests
Constructor Detail |
---|
public MakumbaJspTestCase()
Method Detail |
---|
protected boolean compareTest(String result, String testName) throws Exception
result
- the new result, from the currently running test
true
if this worked out, false
otherwise.
FileNotFoundException
- in case the comparison basis file is not found, this indicates it
Exception
protected void fetchValidTestResult(String output, String testName, boolean record)
output
- the result (HTML code) of the page that was ran correctly.testName
- record
- TODOprotected void compareToFileWithTestName(com.meterware.httpunit.WebResponse response) throws Exception
response
- the WebResponse to compare
Exception
protected void compareToFile(com.meterware.httpunit.WebResponse response, String testName) throws Exception
Exception
protected void includeJspWithTestName() throws ServletException, IOException
ServletException
IOException
protected com.meterware.httpunit.WebForm getFormInJspWithTestName() throws MalformedURLException, IOException, SAXException, Exception
MalformedURLException
IOException
SAXException
Exception
protected com.meterware.httpunit.WebForm getFormInJspWithTestName(boolean check) throws MalformedURLException, IOException, SAXException, Exception
check
- whether to compare the content with the comparison file with test name
MalformedURLException
IOException
SAXException
Exception
protected com.meterware.httpunit.WebForm getFormInJsp(String page) throws MalformedURLException, IOException, SAXException, Exception
page
- the page to retrieve
MalformedURLException
IOException
SAXException
Exception
protected com.meterware.httpunit.WebForm getFormInJsp(String page, boolean check) throws MalformedURLException, IOException, SAXException, Exception
page
- the page to retrievecheck
- whether to compare the content with the comparison file with test name
MalformedURLException
IOException
SAXException
Exception
protected com.meterware.httpunit.WebResponse getJspResponse(String page, boolean check) throws MalformedURLException, IOException, SAXException, Exception
page
- the page to retrievecheck
- whether to compare the content with the comparison file with test name
MalformedURLException
IOException
SAXException
Exception
public String getJspDir()
public boolean getRecordingMode()
protected void differentNameJsps(String name, String jsp)
protected void disableTest(String test)
public static junit.framework.Test makeJspSuite(MakumbaJspTestCase prototype, String queryLang)
prototype
- the object whose tests[] array will be used to make the suitequeryLang
- query language used in the test
public static junit.framework.Test makeSuite(Class<?> claz, String queryLang)
claz
- the class where the tests are extracted fromqueryLang
- the query language used in the test
public static junit.framework.Test makeJspDirSuite(MakumbaJspTestCase prototype, String queryLang)
prototype
- the object whose tests[] array will be used to make the suitequeryLang
- query language used in the test
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |