jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reiko HIROSE" <r-hir...@fjh.fujitsu.com>
Subject the server returns the html source, not the test result.
Date Tue, 30 Sep 2003 23:51:32 GMT
hi,

i've been unable to get the test result from cactus.
the server does not return the test result. instead it returns the whole
html source which i wrote in the testee class.

i found some similar cases on the web, but they refer to the cases
that the server returns 404 error.

what i get is (in short. the whole message is at the end of this mail.):
org.apache.cactus.util.ChainedRuntimeException: Failed to get the test
results.
This is probably due to an error that happened on the server side when
trying to
 execute the tests. Here is what was returned by the server : [<html>
<head><title>
Hello
</title></head>
Hello
<body>
</body></html>
]
        at
org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(Abstract
HttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):120)

but seems like ServletRedirector is workng. when i enter the url :
http://localhost:8080/MySampleWebApp/ServletRedirector?Cactus_Service=RUN_TEST
it gives me back a blank page, which i think is what's expected to happen.

-- start
(quoted from
http://www.google.co.jp/search?q=cache:RtTLyGOy6WEJ:javaboutique.internet.com/tutorials/StrutsTestCase/index-13.html+ServletRedirector%3FCactus_Service%3DRUN_TEST&hl=ja&ie=UTF-8)
To see if the ServletRedirector servlet is working, enter

http://localhost:8080/cactusdvdlib/ServletRedirector?Cactus_Service=RUN_TEST
If you get a blank page back, the servlet works!
-- end

the environment :
WIN2000
Apache Tomcat/4.1.24-LE-jdk14
cactus-1.4.1.jar
cactus-ant-1.4.1.jar

i have a simple test class like this :
package cactest;
-- start
import org.apache.cactus.*;
import junit.framework.*;

public class TestHelloServlet extends ServletTestCase {

    public TestHelloServlet(String name) {
        super(name);
    }

    protected void setUp() {
        System.out.println("debug: setting up...");
    }

    protected void tearDown() {
    }

    public void beginSimpleTest(WebRequest webrequest)  {
    }

    public void testSimpleTest()
        throws java.io.IOException {
        System.out.println("# testSimpleTest start");
        HelloServlet servlet = new HelloServlet();
        System.out.println("servlet hash :" + servlet.hashCode());
        servlet.doGet(request, response);
        System.out.println("# testSimpleTest end");
    }
    public void endSimpleTest(WebResponse response)
        throws java.io.IOException {
        System.out.println("#endSimpleTest start");
        int idx = response.getText().indexOf("Hello");
        assertTrue("if found, success", idx != -1);
        System.out.println("#endSimpleTest end");
    }
}
-- end

and here's my "cactus.properties"
-- start
cactus.contextURL=http://localhost:8080/MySampleWebApp
cactus.servletRedirectName=ServletRedirector
cactus.enableLogging=false
and the whole message from the server is :
-- end

-- start
C:\cygwin\home\lei\myApp\cactus_sample\MySampleWebApp\WEB-INF\classes>j
ava
junit.textui.TestRunner cactest.TestHelloServlet
log4j:WARN No appenders could be found for logger
(org.apache.cactus.util.JUnitV
ersionHelper).
log4j:WARN Please initialize the log4j system properly.
.E
Time: 0.401
There was 1 error:
1) testSimpleTest(cactest.TestHelloServlet)
org.apache.cactus.util.ChainedRuntimeException: Failed to get the test
results.
This is probably due to an error that happened on the server side when
trying to
 execute the tests. Here is what was returned by the server : [<html>
<head><title>
Hello
</title></head>
Hello
<body>
</body></html>
]
        at
org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(Abstract
HttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):120)
        at
org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHt
tpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):1218)
        at
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient
.java;org/apache/cactus/util/log/LogAspect.aj(1k):104)
        at
org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestC
ase.java:260)
        at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
        at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195)

org.apache.cactus.client.ParsingException: Not a valid response
        at
org.apache.cactus.client.WebTestResultParser.readRootElement(WebTestR
esultParser.java;org/apache/cactus/util/log/LogAspect.aj(1k):140)
        at
org.apache.cactus.client.WebTestResultParser.dispatch29_parse(WebTest
ResultParser.java;org/apache/cactus/util/log/LogAspect.aj(1k):101)
        at
org.apache.cactus.client.WebTestResultParser.around29_parse(WebTestRe
sultParser.java;org/apache/cactus/util/log/LogAspect.aj(1k):1218)
        at
org.apache.cactus.client.WebTestResultParser.parse(WebTestResultParse
r.java;org/apache/cactus/util/log/LogAspect.aj(1k):96)
        at
org.apache.cactus.client.AbstractHttpClient.callGetResult(AbstractHtt
pClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):230)
        at
org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(Abstract
HttpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):114)
        at
org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHt
tpClient.java;org/apache/cactus/util/log/LogAspect.aj(1k):1218)
        at
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient
.java;org/apache/cactus/util/log/LogAspect.aj(1k):104)
        at
org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestC
ase.java:260)
        at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
        at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195)


FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1

-- end

if you have a clue, could you help me?

cheers,

leiko


Mime
View raw message