Hi,
When you use ServletTestRunner servlet to run your test, I dont think you will need the cactus.properties. I tested that. I think that ServletTestRunner will search for the test class in the context path in which it has been called and excecute. Example http://localhost:8080/app1/ServletTestRunner?suite=com.test.TestMyJava, then ServletTestRunner will search for class in the context path http://localhost:8080/app1 .
In the case ServletTestRunner, it is single JVM.
Regards,
Ramesh.


Murali Mohan Annapragada wrote:

Hello All,

I downloaded the "jakarta-cactus-13-1.5-beta1" to perform the servlet
testing. In my company, we have automated the EJB unit testing using JUnitEE
framework and after lot of searching we decided that Cactus is best for
automating servlet testing.  I am running into lot of problems to setup test
environment. I am writing down what exactly i am trying to do and it would
be great if you can provide me some help.

I have a web application which has servlets deployed on weblogic 6.1 SP5. I
want to test these servlets but not using any JunitRunner or any UI tool
instead i want to be able to run the test cases from the browser.

To explain the problem i will refer the webapplication that has servlets to
be tested as "app1".  I created another webapplication called "app2" and has
both the servlets and my test classes under web-inf/classes.  In the
web-inf/lib of app2 i placed all the jar files that are listed in the
documentation along with xalan for html generation. I added
'cactus.properties' under web-inf/classes which has
"cactus.contextURL=http://localhost:7001/app1"; and
cactus.servletRedirectorName = ServletRedirector defined. In "app1" which is
my server, I also added my test classes under web-inf/classes and made
changes to web.xml to add entries for "ServletRedirector". I also added all
the libraries under web-inf/lib for server too. When i start my weblogic and
access the test classes in app2 like in this URL..
http://localhost:7001/app2/ServletTestRunner?suite=TestMasterCatalogServlet&;
transform=yes I assumed that this will invoke the test classes in app2 and
will execute beginXXX() at this end and on "app1" side it will execute
"setUp(), textXXX(), tearDown()" in that order. But what happpens is it
executes beginXXX( ), doesn't print the statement in setUp() but executes
testXXx() and throws NullPointerException when either "session" or "request"
are accessed.  Based on above scenario i have following doubts..

1. Can i use 2 different contexts like app1, app2 in weblogic, one as server
and another as client? (They run on same instance of weblogic)
2. As a follow up question, is it must to run client on seperate JVM?
3. I placed "cactus.properties" file in web-inf/classes of the client
application, but it doesn't seem to be loading it when i printed the
"theRequest.getRedirectorName()" in beginXXx() it printed Null so i
explicitly did this "theRequest.setRedirectorName("ServletRedirector");".

I maybe totally on wrong track, i will be glad to provide any details..
Could you please help me?

The exception it prins is ::

java.lang.NullPointerException
at
com.digitalthink.ast.catalog.servlet.TestMasterCatalogSvlt.testAddCourse(Tes
tMasterCatalogSvlt.java:154)
at
org.apache.cactus.internal.server.ServerTestCaseDelegate.runServerTest(Serve
rTestCaseDelegate.java;org/apache/cactus/util/log/LogAspect.aj[1k]:214)
at
org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.
java:156)
at
org.apache.cactus.server.AbstractWebTestController.dispatch133_handleRequest
(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:
130)
at
org.apache.cactus.server.AbstractWebTestController.around133_handleRequest(A
bstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:11
58)
at
org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWeb
TestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:101)
at
org.apache.cactus.server.ServletTestRedirector.dispatch160_doPost(ServletTes
tRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:125)
at
org.apache.cactus.server.ServletTestRedirector.around160_doPost(ServletTestR
edirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.
java;org/apache/cactus/util/log/LogAspect.aj[1k]:109)
at
org.apache.cactus.server.ServletTestRedirector.dispatch159_doGet(ServletTest
Redirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:96)
at
org.apache.cactus.server.ServletTestRedirector.around159_doGet(ServletTestRe
director.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.j
ava;org/apache/cactus/util/log/LogAspect.aj[1k]:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:265)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:200)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:2546)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2260)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)

Thanks & Regards
Murali

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to