Hi Murali,

> -----Original Message-----
> From: Murali Mohan Annapragada [mailto:[EMAIL PROTECTED]
> Sent: 23 July 2003 12:01
> To: 'Cactus Users List'
> Subject: Help Please
> Importance: High
> 
> 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.  

FYI, Cactus also offers the same feature as JUnitEE to unit test EJBs
(AFAIK).

> 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.

ok

> 
> 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.  

No, that's not possible. The Servlet specifications prevents this! You
can't call app1 from app2 (and you'll have classloader issues).

> 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. 

The cactus.properties is not needed when running from a browser as
Cactus is able to infer the contextURL, and "ServletRedirector" is the
default used.

> 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=TestMasterCatalogServ
le
> t&
> 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)

no

> 2. As a follow up question, is it must to run client on seperate JVM?

yes

> 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");".

You don't need to do all that.

[snip]

Try using only one webapp as described here
(http://jakarta.apache.org/cactus/integration/howto_classpath.html) and
we'll go from there.

Thanks
-Vincent



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

Reply via email to