I actually did exactly this for a forthcoming article on IBM's
developerworks. I used AspectJ (www.aspectj.org) to change the test case's
parent class depending on which deployment I was running. Cool stuff. I'll
be sure to post a link to the article here as soon as it's published.

Cheers,


Nicholas Lesiecki
Principal Software Engineer
eBlox, Inc.
(520) 615-9345 x104
Check out my new book!:
Java Tools for Extreme Programming: Mastering Open Source Tools, including
Ant, JUnit, and Cactus

http://www.amazon.com/exec/obidos/ASIN/047120708X/

Check out my article on AspectJ:
http://www-106.ibm.com/developerworks/library/j-aspectj/index.htmlloc=dwmain


-----Original Message-----
From: Mike Wyszinski [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 08, 2002 4:19 PM
To: [EMAIL PROTECTED]
Subject: dual in/out container testing?


OK,

Is it possible for cactus tests to be run as
standalone plain old junit tests?

Here's our situation:

1)We are writting some "Foundation" SessionEJBs
2)We using Sun J2EE Business Delegate pattern to
isolate clients from our deployment architecture
Therefore, we can run the same logic/code from within
a EJB environment or not.
2)we chose to write POJT (plain old junit tests) to
test the basic logic AND use cactus to test
in-container reaction to our code.

Well doing it that way has meant us having to copy n'
paste the same test logic into 2 classes:

1)public class XTest extends TestCase
2)public class XCactus extends ServletTestCase

We'd like to get rid of the duplication effort, any
ideas on  how to centralize the test code and have it
runnable as ServletTestCase And TestCase?

BTW we thought about using composition ie:
public class XTestLogic{
        //all test code in here
}
public class XTest extends TestCase {
        private XTestLogic testlogic = new XTestLogic()
}
public class XCactus extends ServletTestCase{
        private XTestLogic testlogic = new XTestLogic()
}

but all the assertX() are obviously not available in
XTestLogic.

any insight would be appreciated,
Mike

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to