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 veny <ve...@p2h.com.sg> on 2003/08/12 04:53:31 UTC

Mock object & cactus

Hi all,

I'm new to unit testing and Cactus.
Have some questions regarding Mock object. I've read this article:
http://jakarta.apache.org/cactus/mock_vs_cactus.html . It mentioned that
Cactus and Mock Object can actually be complementary:

"During the development phase, MO could be used to unit test the code logic
only. They run fast and you could use them easily inside your IDE. Then
every few hours, you'll run the Cactus tests which test interactions between
objects and container interactions. Then you'll run the
functional/acceptance tests when you deploy to the real platform. Note that
this is if you want to do the full cycle. A short cycle could simply be
Cactus tests and functional /acceptance tests."

How could the above-mentioned be done? Does it mean that i'll first write
the test code in Mock Object way and then refactor the code to run Cactus
test? I've silmilar problem with JDBC test.

Thanks.

Cheers,

Veny Handoko

RE: Mock object & cactus

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Veny,

No there's no need to refactor anything. The idea is that you write
focused and fine-grained mock object tests (i.e. you test your method in
*isolation* from the rest). Then, in order to verify integration between
components and with the container, you can write some *other* Cactus
tests.

-Vincent

-----Original Message-----
From: veny [mailto:veny@p2h.com.sg] 
Sent: 12 August 2003 04:54
To: cactus-user@jakarta.apache.org
Subject: Mock object & cactus

Hi all,
 
I'm new to unit testing and Cactus. 
Have some questions regarding Mock object. I've read this article:
http://jakarta.apache.org/cactus/mock_vs_cactus.html . It mentioned that
Cactus and Mock Object can actually be complementary:
 
"During the development phase, MO could be used to unit test the code
logic only. They run fast and you could use them easily inside your IDE.
Then every few hours, you'll run the Cactus tests which test
interactions between objects and container interactions. Then you'll run
the functional/acceptance tests when you deploy to the real platform.
Note that this is if you want to do the full cycle. A short cycle could
simply be Cactus tests and functional /acceptance tests."
 
How could the above-mentioned be done? Does it mean that i'll first
write the test code in Mock Object way and then refactor the code to run
Cactus test? I've silmilar problem with JDBC test.
 
Thanks.
 
Cheers,
 
Veny Handoko