Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Servlet test cases are inherited from ServletTestCase (as the name implies).
But ServletTestCase inherited classes need to instanciate TestSuite and NOT ServletTestSuite (eg. from the public static Test suite() method) as the latter are intended to be used with plain JUnit test cases.
Using by mistake ServletTestSuite leads to many erratics behaviors :
- beginXXX and endXXX methods are called twice
- on second endXXX call, WebResponse object returns allways an empty string on getText()
Some improvements could be :
- include a clear warning in the "Writing Test" page of the documentation (Option B: reuse a JUnit TestCase)
- include a warning in the javadoc documentation of the ServletTestSuite
- framework reporting a warning or any kind of error when trying to add a ServletTestCase in a ServletTestSuite