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 Mike Wyszinski <mi...@yahoo.com> on 2002/05/09 01:18:35 UTC

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: dual in/out container testing?

Posted by Nicholas Lesiecki <ni...@eblox.com>.
Yep, sorry I didn't post the link earlier, it's been an exciting weekend.

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 articles on AspectJ:
Test flexibly with AspectJ and mock objects:
http://www-106.ibm.com/developerworks/java/library/j-aspectj2/?loc=j

Introduction to AspectJ
http://www-106.ibm.com/developerworks/library/j-aspectj/index.htmlloc=dwmain


-----Original Message-----
From: Vincent Massol [mailto:vmassol@octo.com]
Sent: Tuesday, May 21, 2002 2:31 PM
To: 'Cactus Users List'
Subject: RE: dual in/out container testing?


... and the article is available at
http://www-106.ibm.com/developerworks/java/library/j-aspectj2/?loc=j and
has been added to the Cactus web site in the news and resource web
pages.

Thanks Nick!

-Vincent

> -----Original Message-----
> From: Nicholas Lesiecki [mailto:nick@eblox.com]
> Sent: 09 May 2002 21:43
> To: Cactus Users List
> Subject: RE: dual in/out container testing?
>
> 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:mike_wyszinski@yahoo.com]
> Sent: Wednesday, May 08, 2002 4:19 PM
> To: cactus-user@jakarta.apache.org
> 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:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: dual in/out container testing?

Posted by Vincent Massol <vm...@octo.com>.
... and the article is available at
http://www-106.ibm.com/developerworks/java/library/j-aspectj2/?loc=j and
has been added to the Cactus web site in the news and resource web
pages.

Thanks Nick!

-Vincent

> -----Original Message-----
> From: Nicholas Lesiecki [mailto:nick@eblox.com]
> Sent: 09 May 2002 21:43
> To: Cactus Users List
> Subject: RE: dual in/out container testing?
> 
> 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:mike_wyszinski@yahoo.com]
> Sent: Wednesday, May 08, 2002 4:19 PM
> To: cactus-user@jakarta.apache.org
> 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:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: dual in/out container testing?

Posted by Nicholas Lesiecki <ni...@eblox.com>.
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:mike_wyszinski@yahoo.com]
Sent: Wednesday, May 08, 2002 4:19 PM
To: cactus-user@jakarta.apache.org
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:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>