Matt, See inline.
> -----Original Message----- > From: Matt Raible [mailto:[EMAIL PROTECTED]] > Sent: 05 April 2002 15:42 > To: 'Cactus Users List' > Subject: RE: JunitPP for ServletTestCase? > > I realize this, and this is what I'm doing in the meantime. JunitPP > gives me the ability to either (1) name my properties file the same name > as the class and it will be found automatically, OR (2) pass in a > argument to a file that contains keys: > > <junit...> > <jvmarg value="-Djunit.conf=./src/onpoint/PersistenceTestValues.ini"/> > </junit> you can exactly the same with the strategy I have highlighted in my previous email. > > JunitPP also has functionality to retrieve the data from a RDBMS to use > as test values (I haven't used this yet). This is actually quite simple with Cactus as it is executing in the container and you can have in your container a datasource pointing to your database. See for example the dbunit project (http://www.dbunit.org/bestpractices.html#connections). > Below is the documentation on > the loading of properties files with ConfigurableTestCase. Is it > possible to do this with Cactus - using ResourceBundles and Arguments? > > > How is the properties file found when an instance of > ConfigurableTestCase is executed? It is assumed that the property file > has the same name as the class file but a different extension, i.e. the > property file for the FooTest.class would be named FooTest.conf. The > property file is either looked up in the current directory or in the > list of directories defined in the classpath variable. > In some projects this approach might not work (e.g. using a single > property file for all test suites) therefore the system property > 'junit.conf' either defines a property file or a starting directory for > the search. > java -Djunit.conf=MyFooTest.conf junit.swingui.TestRunner FooTest > java -Djunit.conf=./test/data junit.swingui.TestRunner FooTest > Figure 3 - Specifying a test data repository > How is an entry in the property file defined? To access the test data > repository the class name, the name of the test case and the property > name are concatenated to generate the key in the following order: > . fully qualified class name + test name + property name > . class name without package name + test name + property name > . class name without package name + property name > . property name > > This implementation allows the reuse of test data definitions shared by > one or more test suites, e.g. the name of the sever used for testing a > client/server application with multiple test suites. > # FooTest.conf > > foo.FooTest.testFoo.key1=XYZ > FooTest.testFoo.key2=true > FooTest.key3=9999 > Key4=3.1415927 > Figure 4 - Content of a test data repository > In the case of a master test suite the corresponding property file > contains references to the property files of the contained test suites, > which are loaded recursively. > yes, I had read this. Thanks -Vincent > > > -----Original Message----- > > From: Vincent Massol [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 05, 2002 12:56 AM > > To: 'Cactus Users List'; [EMAIL PROTECTED] > > Subject: RE: JunitPP for ServletTestCase? > > > > Hi Matt, > > > > I've had a look at junitpp and although it seems nice I still don't > > really understand its value. Cactus has no such "built-in" API for > > loading data from a properties file. However that's not really an > issue > > I think. Here's how you would do it (for example) : > > > > public void setUp() > > { > > ResourceBundle rb = > > ProertyResourceBundle.getBundle("/configuration"); > > } > > > > public void testXXX() > > { > > String someProperty = rb.getString("myProperty"); > > [...] > > } > > > > This would execute on the server side and would look for a file > > configuration.properties (or with your locale suffixed) in your webapp > > classpath (i.e. you would usually put it in WEB-INF/classes). > > > > Is that what you were looking for ? > > Thanks > > -Vincent > > > > > > > -----Original Message----- > > > From: Matt Raible [mailto:[EMAIL PROTECTED]] > > > Sent: 03 April 2002 15:01 > > > To: [EMAIL PROTECTED] > > > Subject: JunitPP for ServletTestCase? > > > > > > Hello, > > > > > > I'm a newbie using Cactus. Is there anyway to externalize > properties > > > from into a text file using Cactus. I'm using JUnitPP's > > > ConfigurableTestCase for my regular bean and JDBC tests - very > handy. > > > > > > More info at http://junitpp.sourceforge.net/. > > > > > > Thanks, > > > > > > Matt > > > > > > > > > -- > > > To unsubscribe, e-mail: <mailto:cactus-user- > > > [EMAIL PROTECTED]> > > > For additional commands, e-mail: <mailto:cactus-user- > > > [EMAIL PROTECTED]> > > > > > > > > > > > > > -- > > To unsubscribe, e-mail: <mailto:cactus-user- > > [EMAIL PROTECTED]> > > For additional commands, e-mail: <mailto:cactus-user- > > [EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: <mailto:cactus-user- > [EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:cactus-user- > [EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
