java testing methodologies, choosing the appropriate one!

H

hvt

Objective:
Preparation of JUnit testcases for bundle of classes, require almost
full test coverage.

Scenario:
struts based application, with very heavy middle tier code which
mainly performs:
1. interaction with database
2. application logic implementation
3. talking to other web-servers and handling response back from them

Problem:
I require preparation of junit testcases for above mentioned
middletier javacode. For simpler method with clear ip/op it's very
easy to write test cases though for heavy methods which performs lots
of database operation or other implementations there is the problem in
writing test cases.
These method requires a particular state of system. Number of such
methods are really large.

I 've come across following possible solution none seems to fit in a
smooth way:
1. Using Cactus, JTestCase with JICE to automate the test case
Automation in terms of input/assert-output preparation, through
jice it's easy to write your input beans/complex-type such as hashmap
etc.
Problem in using this approach was when the input bean has member
beans which may extend some base class the size of xml becomes really
very large, now for developer to fill in the value of every field
which in turn denotes the state of the system that leads to many
manual errors.
I though try to automate xml formation but then if the return value is
bean/complex-type JTestCase doesn't support jice tags inside assert/
assertgroups.

2. Using JMock or JDummy for preparation of mock object
Though it's intended for good development practice, I 've tried it
for already developed code which then I found difficult to automate
and somewhat complex for developers. The doc clearly says it's usage
is when u start developing a code.


I assume this to be a common problem/challenge for such applications
which are huge and already developed now requires test case
preparation.
It would appreciate any suggestions/comments on proper approach for
handling such situation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top