You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Vishal Kumar Singh <vi...@cisco.com> on 2002/04/08 11:04:59 UTC

problem using CactusStrutsTestCase

Hello ,
I faced problem using CactusStrutsTestCase.
When I derive my TestXXXAction from CactusStrutsTestCase , it gives the following
compilation error

TestPTFindPhonesAction.java:14: cannot access  org.apache.cactus.ServletTestCase
file org\apache\cactus\ServletTestCase.class not found
         public TestPTFindPhonesAction(String testname )
                                       ^

The problem is strutstestcase.jar has CactusStrutsTestCase  but  not
org.apache.cactus.ServletTestCase from
which it is derived wheras  MockStrutsTestCase is derived from
junit.framework.TestCase and
MockStrutsTestCase works fine just by putting junit.jar in the classpath.

When I downloaded Cactus lib files , the package was
org.apache.commons.cactus.ServletTestCase and not
org.apache.cactus.TestCase and hence it failed compilation.

My requirement is a method to get my FormBean in my TestXXXAction class.
This was not available using MockstrutsTestCase, so i wanted to use
CactusStrutstTestCase which provides a  getForm( ) method.
So, I extended the same class from CactusStrutsTestCase which was earlier
extended from MockStrutsTestCase.

Do I need to do some additional changes to use CactusStrutsTestCase. ?

The following is  package structure of CactusStrutsTestCase

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.apache.cactus.AbstractTestCase
                    |
                    +--org.apache.cactus.ServletTestCase
                          |
                          +--servletunit.struts.CactusStrutsTestCase

what should i do ? Should I change the package structure ?

regards
Vishal




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: problem using CactusStrutsTestCase

Posted by Vincent Massol <vm...@octo.com>.
Vishal,

See the Cactus FAQ on the web site (along with the Config Howto, also on
the web site that explains how to configure Cactus). It simply means you
do not have your cactus.properties file in your client side classpath.

-Vincent

> -----Original Message-----
> From: Vishal Kumar Singh [mailto:vishalkr@cisco.com]
> Sent: 08 April 2002 10:53
> To: Cactus Users List
> Subject: Re: problem using CactusStrutsTestCase
> 
> The problem of compilation has solved  as I got a distribution of
cactus
> which had
> the package structure as required by CactusStrutsTest.jar .
> But Now , I face a different problem :
> 
> It compiled properly , but, while execution gave the following error :
> I am following the same approach of executing test cases as I was
doing
> with
> MockStrutsTestCase.
> 
> /**************************ERROR*********************************/
> .log4j:ERROR No appenders could be found for category
> (com.cisco.nm.uii.example.
> actionform.TestPTFindPhonesAction).
> log4j:ERROR Please initialize the log4j system properly.
> E
> Time: 0.631
> There was 1 error:
> 1)
>
testPTFindPhonesResult(com.cisco.nm.uii.example.actionform.TestPTFindPho
ne
> sAc
> tion)
> java.lang.ExceptionInInitializerError:
java.util.MissingResourceException:
> Can't
>  find bundle for base name cactus, locale en_US
>         at
java.util.ResourceBundle.throwMissingResourceException(Unknown
> Source
> )
>         at java.util.ResourceBundle.getBundleImpl(Unknown Source)
>         at java.util.ResourceBundle.getBundle(Unknown Source)
>         at
> org.apache.cactus.client.AbstractHttpClient.<clinit>(AbstractHttpClie
> nt.java:88)
>         at
> org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
>         at
> org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
> /*****************************************************************/
> 
> 
> regards
> Vishal
> 
> Vishal Kumar Singh wrote:
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>
> 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: problem using CactusStrutsTestCase

Posted by Vishal Kumar Singh <vi...@cisco.com>.
The problem of compilation has solved  as I got a distribution of cactus which had
the package structure as required by CactusStrutsTest.jar .
But Now , I face a different problem :

It compiled properly , but, while execution gave the following error :
I am following the same approach of executing test cases as I was doing with
MockStrutsTestCase.

/**************************ERROR*********************************/
.log4j:ERROR No appenders could be found for category (com.cisco.nm.uii.example.
actionform.TestPTFindPhonesAction).
log4j:ERROR Please initialize the log4j system properly.
E
Time: 0.631
There was 1 error:
1) testPTFindPhonesResult(com.cisco.nm.uii.example.actionform.TestPTFindPhonesAc
tion)
java.lang.ExceptionInInitializerError: java.util.MissingResourceException: Can't
 find bundle for base name cactus, locale en_US
        at java.util.ResourceBundle.throwMissingResourceException(Unknown Source
)
        at java.util.ResourceBundle.getBundleImpl(Unknown Source)
        at java.util.ResourceBundle.getBundle(Unknown Source)
        at org.apache.cactus.client.AbstractHttpClient.<clinit>(AbstractHttpClie
nt.java:88)
        at org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:130)
        at org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:371)
/*****************************************************************/


regards
Vishal

Vishal Kumar Singh wrote:



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>