You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Allen, Daniel" <Da...@kbcfp.com> on 2008/04/08 21:45:23 UTC

Accessing test.properties from within a test case class?

Hi, all.

I feel like this must be a really obvious question, but I haven't found
an example yet. When I started my project from an archetype (struts 2,
specifically) my /test/resources folder got a file called
test.properties. It seems pretty clear that this is where properties
that my test cases will use should go, but I'm not sure how to access
them from within the test case classes.

In case specifics are needed, I want to test database-related functions,
and am looking for the correct place to put the connection string, user
name, etc, as well as the way to access them in Java code so that I can
open connections accordingly.


Thanks in advance,
~Dan Allen

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Accessing test.properties from within a test case class?

Posted by "Allen, Daniel" <Da...@kbcfp.com>.
Ok, thanks. 

Sorry, I knew it was going to something simple that I was just missing.

~DVA 

-----Original Message-----
From: Brian E. Fox [mailto:brianf@reply.infinity.nu] 
Sent: Tuesday, April 08, 2008 3:59 PM
To: Maven Users List
Subject: RE: Accessing test.properties from within a test case class?

It will be on the classpath, so load that property file as a resource
from the cp.

-----Original Message-----
From: Allen, Daniel [mailto:Daniel.Allen@kbcfp.com] 
Sent: Tuesday, April 08, 2008 3:45 PM
To: Maven Users List
Subject: Accessing test.properties from within a test case class?

Hi, all.

I feel like this must be a really obvious question, but I haven't found
an example yet. When I started my project from an archetype (struts 2,
specifically) my /test/resources folder got a file called
test.properties. It seems pretty clear that this is where properties
that my test cases will use should go, but I'm not sure how to access
them from within the test case classes.

In case specifics are needed, I want to test database-related functions,
and am looking for the correct place to put the connection string, user
name, etc, as well as the way to access them in Java code so that I can
open connections accordingly.


Thanks in advance,
~Dan Allen

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


RE: Accessing test.properties from within a test case class?

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
It will be on the classpath, so load that property file as a resource
from the cp.

-----Original Message-----
From: Allen, Daniel [mailto:Daniel.Allen@kbcfp.com] 
Sent: Tuesday, April 08, 2008 3:45 PM
To: Maven Users List
Subject: Accessing test.properties from within a test case class?

Hi, all.

I feel like this must be a really obvious question, but I haven't found
an example yet. When I started my project from an archetype (struts 2,
specifically) my /test/resources folder got a file called
test.properties. It seems pretty clear that this is where properties
that my test cases will use should go, but I'm not sure how to access
them from within the test case classes.

In case specifics are needed, I want to test database-related functions,
and am looking for the correct place to put the connection string, user
name, etc, as well as the way to access them in Java code so that I can
open connections accordingly.


Thanks in advance,
~Dan Allen

-- 
This message may contain confidential, proprietary, or legally
privileged information. No confidentiality or privilege is waived by any
transmission to an unintended recipient. If you are not an intended
recipient, please notify the sender and delete this message immediately.
Any views expressed in this message are those of the sender, not those
of any entity within the KBC Financial Products group of companies
(together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise,
on the part of KBC FP. It is not an offer (or solicitation of an offer)
of, or a recommendation to buy or sell, any financial product. Any
prices or other values included in this message are indicative only, and
do not necessarily represent current market prices, prices at which KBC
FP would enter into a transaction, or prices at which similar
transactions may be carried on KBC FP's own books. The information
contained in this message is provided "as is", without representations
or warranties, express or implied, of any kind. Past performance is not
indicative of future returns.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org