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 Vincent Massol <vm...@pivolis.com> on 2003/09/08 17:16:50 UTC

Externalizing test data (was RE: Cactus coverage in "Java extreme Programming Cookbook")

Hi Mark,

Yeah, I have long debated as to whether I should include functional
testing in the book. However, in the end I found that I had a lot to say
purely on unit testing and that there's a lot to say on functional
testing too. Instead of diluting the message and addressing half of both
domains, I preferred to better address the unit testing part. I do talk
about HttpUnit when it comes to integrating it in Cactus (in the chapter
about unit testing JSPs and Taglibs) but not in general terms.

Now back to your question...

Abstracting out test data is relatively easy: Use the following in the
test code:

System.getProperty("login");

And pass the property either from the Ant build file when calling the
<junit> task or using -Dlogin=xxxx on the command line.

If you have a strong need for intensive data-driven testing, I suggest
looking at some junit extensions that do this
(http://www.junit.org/news/extension/index.htm).

Thanks
-Vincent

> -----Original Message-----
> From: Mark Lybarger [mailto:Mark.Lybarger@CBC-Companies.com]
> Sent: 08 September 2003 14:06
> To: 'Cactus Users List'
> Subject: RE: Cactus coverage in "Java extreme Programming Cookbook"
> 
> Since you're advertising, I thought I'd throw in a quick comment.  I
don't
> see any info in the book on HttpUnit or its variations :(.  I'm
currently
> looking into using HttpUnit for regression testing, but have hardcoded
> url's
> and data expectancies (site logins/passwords, etc) in the tests.  Any
> suggestions on how to abstract this easily out to a properties file or
> some
> such that can be swapped out at build time to use different url's and
data
> for a QA environment?
> 
> 
> -----Original Message-----
> From: Vincent Massol [mailto:vmassol@pivolis.com]
> Sent: Saturday, September 06, 2003 10:11 AM
> To: 'Cactus Users List'
> Cc: karthik_guru2000@yahoo.com
> Subject: RE: Cactus coverage in "Java extreme Programming Cookbook"
> 
> 
> Hi Karthik,
> 
> A bit late... No, I haven't read it and thus I can't comment on it.
> 
> <advertising>
> However, I'm just finishing a book on unit testing java applications
> (JUnit in Action, http://manning.com/massol/) which has a special
focus
> of unit testing J2EE applications. I can tell you that the Cactus
> coverage is excellent and it covers Cactus 1.5 ;-)
> </advertising>
> 
> Thanks
> -Vincent
> 
> -----Original Message-----
> From: karthik Guru [mailto:karthik_guru2000@yahoo.com]
> Sent: 26 June 2003 14:41
> To: Cactus Users List
> Subject: Cactus coverage in "Java extreme Programming Cookbook"
> 
> Hi Vincent/ All,
> Did anyone get a chance to read this book from oreilly. How is the
> cactus coverage and in general the book? Does it teach you nice tricks
?
> Thought i w'd grab this one if it's good. I liked the available Junit
> chapter. Did'nt get a chance to read other chapters.
> thanks,karthik
> 
> 
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
> 
> 
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.509 / Virus Database: 306 - Release Date: 8/12/2003
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org