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 Mark Slater <ma...@analogsoftware.com> on 2004/06/19 09:58:12 UTC

what is the location of data files for testing?

I'm sure this is documented all over the place, but for the life of me, 
I couldn't find it after looking for the two hours or so.  I'm using 
the maven plugin to run my cactus tests. In the setUp() method, I'd 
like to load a couple of image files to use in the testing. Where in 
the directory structure would I put those files so the are accessible 
with getClass().getResource("image.jpg") inside the setUp() method?

Thanks!

Mark


RE: what is the location of data files for testing?

Posted by Vincent Massol <vm...@pivolis.com>.

> -----Original Message-----
> From: Mark Slater [mailto:mark@analogsoftware.com]
> Sent: 19 June 2004 19:29
> To: cactus-user@jakarta.apache.org
> Subject: Re: what is the location of data files for testing?
> 
> Hi Vincent,
> 
> I'm testing an Entity bean that takes a picture and stores it in the
> DB. It's a somewhat contrived test, but the whole app is contrived.
> It's a technology demonstration that I can use to show the people who
> will be rotating in and out of the project over the next few years,
and
> it will (hopefully) cover the vast majority of situations they'll
> encounter. In this case, the bean is pretty lame. However, I can
> imagine other test cases where I want a file (maybe a test CSV data
> file with all the test entity data, or an XML file that some
> intermediary session bean has to process) included in the test WAR so
> that cactus can load it up. My understanding is that for Local Entity
> beans, there is no client side, so running the setup from outside the
> server, a la begin() and end(), either wouldn't work, or would be poor
> style.
> 
> Of course, I'm still new at this too, so I could be way off. I just
> figured there would be a standard place to put such files so they are
> available server-side for testing.

Ok. Then you can put it anywhere in the server side classpath
(WEB-INF/classes, container classpath, etc).

-Vincent

> 
> Mark
> 
> On Jun 19, 2004, at 06:51 AM, Vincent Massol wrote:
> 
> > Hi Mark,
> >
> > The setUp() method is executed in the server side classpath. Are you
> > sure you do not want to use a begin() method instead? (see
> > http://jakarta.apache.org/cactus/writing/howto_testcase.html).
> >
> > -Vincent
> >
> > On Jun 19, 2004, at 12:58 AM, Mark Slater wrote:
> >
> >> I'm sure this is documented all over the place, but for the life of
> >> me, I couldn't find it after looking for the two hours or so.  I'm
> >> using the maven plugin to run my cactus tests. In the setUp()
method,
> >> I'd like to load a couple of image files to use in the testing.
Where
> >> in the directory structure would I put those files so the are
> >> accessible with getClass().getResource("image.jpg") inside the
> >> setUp() method?
> >>
> >> Thanks!
> >>
> >> Mark
> >>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org



Re: what is the location of data files for testing?

Posted by Mark Slater <ma...@analogsoftware.com>.
Hi Vincent,

I'm testing an Entity bean that takes a picture and stores it in the 
DB. It's a somewhat contrived test, but the whole app is contrived. 
It's a technology demonstration that I can use to show the people who 
will be rotating in and out of the project over the next few years, and 
it will (hopefully) cover the vast majority of situations they'll 
encounter. In this case, the bean is pretty lame. However, I can 
imagine other test cases where I want a file (maybe a test CSV data 
file with all the test entity data, or an XML file that some 
intermediary session bean has to process) included in the test WAR so 
that cactus can load it up. My understanding is that for Local Entity 
beans, there is no client side, so running the setup from outside the 
server, a la begin() and end(), either wouldn't work, or would be poor 
style.

Of course, I'm still new at this too, so I could be way off. I just 
figured there would be a standard place to put such files so they are 
available server-side for testing.

Mark

On Jun 19, 2004, at 06:51 AM, Vincent Massol wrote:

> Hi Mark,
>
> The setUp() method is executed in the server side classpath. Are you
> sure you do not want to use a begin() method instead? (see
> http://jakarta.apache.org/cactus/writing/howto_testcase.html).
>
> -Vincent
>
> On Jun 19, 2004, at 12:58 AM, Mark Slater wrote:
>
>> I'm sure this is documented all over the place, but for the life of 
>> me, I couldn't find it after looking for the two hours or so.  I'm 
>> using the maven plugin to run my cactus tests. In the setUp() method, 
>> I'd like to load a couple of image files to use in the testing. Where 
>> in the directory structure would I put those files so the are 
>> accessible with getClass().getResource("image.jpg") inside the 
>> setUp() method?
>>
>> Thanks!
>>
>> Mark
>>


Re: what is the location of data files for testing?

Posted by Kazuhito SUGURI <su...@lab.ntt.co.jp>.
Hi Mark,

In article <69...@analogsoftware.com>,
Sat, 19 Jun 2004 00:58:12 -0700,
Mark Slater <ma...@analogsoftware.com> wrote: 
mark> I'm sure this is documented all over the place, but for the life of me, 
mark> I couldn't find it after looking for the two hours or so.  I'm using 
mark> the maven plugin to run my cactus tests. In the setUp() method, I'd 
mark> like to load a couple of image files to use in the testing. Where in 
mark> the directory structure would I put those files so the are accessible 
mark> with getClass().getResource("image.jpg") inside the setUp() method?

There is no standard place, I believe.
Only thing to consider is that the location of the resource can be found
by the classloader of the test class.
See Also: java.lang.Class#getResource(String) javadoc.

How about under WEB-INF/classes?
You may combine test data set in a jar file, test-resources.jar for example,
and put that as WEB-INF/lib/test-resources.jar.

Regards,
----
Kazuhito SUGURI
mailto:suguri.kazuhito@lab.ntt.co.jp

RE: what is the location of data files for testing?

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Mark,

The setUp() method is executed in the server side classpath. Are you
sure you do not want to use a begin() method instead? (see
http://jakarta.apache.org/cactus/writing/howto_testcase.html).

-Vincent

> -----Original Message-----
> From: Mark Slater [mailto:mark@analogsoftware.com]
> Sent: 19 June 2004 09:58
> To: cactus-user@jakarta.apache.org
> Subject: what is the location of data files for testing?
> 
> I'm sure this is documented all over the place, but for the life of
me,
> I couldn't find it after looking for the two hours or so.  I'm using
> the maven plugin to run my cactus tests. In the setUp() method, I'd
> like to load a couple of image files to use in the testing. Where in
> the directory structure would I put those files so the are accessible
> with getClass().getResource("image.jpg") inside the setUp() method?
> 
> Thanks!
> 
> Mark
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org