I've cleaned up the jsp_precompile tests in Watchdog-4.0 in response to
Bug 5169.
- removed the goldenfile checks in the jsp-gtest.xml for those
precompile tests that used them.
- removed commented and invalid tests from that section
- added new functionality to GTest to assert cases where no
response body is expected from the server (precompile tests
are such a case).
- cleanup the assertion and test strategy text
The following goldenfiles should be removed from the repository.
${wgdir}/misc/precompilation/response.html
${wgdir}/misc/precompilation/no_parameter.html
Index: GTest.java
===================================================================
RCS file:
/home/cvspublic/jakarta-watchdog-4.0/src/tools/org/apache/tomcat/task/GTest.java,v
retrieving revision 1.3
diff -u -r1.3 GTest.java
--- GTest.java 2001/09/28 04:09:56 1.3
+++ GTest.java 2001/11/29 23:31:03
@@ -29,6 +29,7 @@
// Expected response
boolean magnitude=true;
boolean exactMatch=false;
+ boolean expectResponseBody=true;
// Match the body against a golden file
String goldenFile;
// Match the body against a string
@@ -163,6 +164,19 @@
exactMatch=Boolean.valueOf( exact ).booleanValue();
}
+ /**
+ * <code>setExpectResponseBody</code> will indicate
+ * whether or not a response body is expected from the
+ * server for a particular test. In some cases, no
+ * body should be returned to the client. This allows
+ * that assertion.
+ *
+ * @param b a <code>boolean</code> value
+ */
+ public void setExpectResponseBody( boolean b ) {
+ expectResponseBody = b;
+ }
+
/** Set the port as int - different name to avoid confusing ant
*/
public void setPortInt(int i) {
@@ -356,7 +370,7 @@
if( responseMatch != null ) {
// check if we got the string we wanted
- if( responseBody == null ) {
+ if( responseBody == null && expectResponseBody ) {
System.out.println("ERROR: got no response, expecting " +
responseMatch);
return false;
}
@@ -366,6 +380,11 @@
System.out.println(responseBody );
}
}
+
+ if ( !expectResponseBody && responseBody != null ) {
+ System.out.println( "ERROR: Received a response body from the server where
+none was expected" );
+ return false;
+ }
// compare the body
if( goldenFile==null) return responseStatus;
Index: jsp-gtest.xml
===================================================================
RCS file: /home/cvspublic/jakarta-watchdog-4.0/src/conf/jsp-gtest.xml,v
retrieving revision 1.9
diff -u -r1.9 jsp-gtest.xml
--- jsp-gtest.xml 2001/08/09 17:35:13 1.9
+++ jsp-gtest.xml 2001/11/29 23:39:02
@@ -15,63 +15,38 @@
<!-- Precompilation tests -->
<gtest request="GET
/jsp-tests/jsp/misc/precompilation/precompile.jsp?jsp_precompile HTTP/1.0"
debug="0" host="${host}" port ="${port}"
+ expectResponseBody="false"
returncode="200"
- testName="precompile.jsp"
- assertion="Test that the request is not sent to the JSP"
- testStrategy="No HTML page received when jsp_precompile has no value"
- />
+ testName="precompileNoValueTest"
+ assertion="If the jsp_precompile request parameter has no value, the
+request will not be delivered to the target JSP page. JavaServer Pages Specification
+v1.2, Sec. 8.4.2"
+ testStrategy="Validate that no response body is returned when
+jsp_precompile has no value"
+ />
- <gtest request="GET
/jsp-tests/jsp/misc/precompilation/precompile.jsp?jsp_precompile=false&test=insignificant
HTTP/1.0"
- debug="0" host="${host}" port ="${port}"
- goldenFile="${wgdir}/misc/precompilation/response.html"
- testName="precompile.jsp"
- assertion="Test that the request is forwarded properly when
jsp_precompile=false"
- testStrategy="The value of variable passed in the request is displayed if
the request goes to the JSP"
- />
-
<gtest request="GET
/jsp-tests/jsp/misc/precompilation/precompile.jsp?jsp_precompile=false HTTP/1.0"
- debug="0" host="${host}" port ="${port}"
- goldenFile="${wgdir}/misc/precompilation/no_parameter.html"
- testName="precompile.jsp"
- assertion="Test that the request is forwarded properly when
jsp_precompile=false"
- testStrategy="The request should be processed "
- />
-
-<!--
- <gtest request="GET
/jsp-tests/jsp/misc/precompilation/precompile.jsp?jsp_precompile=%22false%22 HTTP/1.0"
debug="0" host="${host}" port ="${port}"
- goldenFile="${wgdir}/misc/precompilation/no_parameter.html"
- testName="precompile.jsp"
- assertion="Test that the request is forwarded properly when
jsp_precompile=%22false%22"
- testStrategy="The request should be processed "
- />
--->
+ expectResponseBody="false"
+ testName="precompileFalseTest"
+ assertion="If the jsp_precompile request parameter is set to false, the
+request will not be delivered to the target JSP page. JavaServer Pages Specification
+v1.2, Sec. 8.4.2"
+ testStrategy="Validate that no response body is returned when
+jsp_precompile is set to false"
+ />
<gtest request="GET
/jsp-tests/jsp/misc/precompilation/precompile.jsp?jsp_precompile=true HTTP/1.0"
debug="0" host="${host}" port ="${port}"
returncode="200"
- testName="precompile.jsp"
- assertion="Test that the request is not sent to the JSP"
- testStrategy="No HTML page received when jsp_precompile=true "
- />
+ expectResponseBody="false"
+ testName="precompileTrueTest"
+ assertion="If the jsp_precompile request parameter is set to true, the
+request will not be delivered to the target JSP page. JavaServer Pages Specification
+v1.2, Sec. 8.4.2"
+ testStrategy="Validate that no response body is returned when
+jsp_precompile is set to true"
+ />
-<!--
- <gtest request="GET
/jsp-tests/jsp/misc/precompilation/precompile.jsp?jsp_precompile=%22true%22 HTTP/1.0"
- debug="0" host="${host}" port ="${port}"
- returncode="200"
- testName="precompile.jsp"
- assertion="Test that the request is not sent to the JSP"
- testStrategy="No HTML page received when jsp_precompile=true "
- />
--->
-
<gtest request="GET
/jsp-tests/jsp/misc/precompilation/precompile.jsp?jsp_precompile=any_invalid_value
HTTP/1.0"
debug="0" host="${host}" port ="${port}"
returncode="500"
- testName="precompile.jsp"
- assertion="Test that the proper error code is returned if jsp_precompile is
given an invalid value"
- testStrategy="check for status code 500"
- />
+ testName="precompileNegativeTest"
+ assertion="Valid parameter values for jsp_precompile are 'true',
+'false', and no value. Any other value will result in an HTTP Error; 500 (Server
+Error). JavaServer Pages specification v1.2, Sec. 8.4.2"
+ testStrategy="Set the jsp_precompile request paramter to a non valid
+value and validate that a 500 error occurs."
+ />
+
<!-- End Precompilation Tests -->
<!-- Begin TLD Resource Path tests -->
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>