wood burning stoves 2.0*
The moose likes Threads and Synchronization and the fly likes Parallel Programming: how to test it? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Parallel Programming: how to test it?" Watch "Parallel Programming: how to test it?" New topic
Author

Parallel Programming: how to test it?

Gian Franco
blacksmith
Ranch Hand

Joined: Dec 16, 2003
Posts: 977
Hi Sergey,

How do you write your unit tests, what difficulties do
you encounter and what suggestions do you have?

Cheers,

Gian


"Eppur si muove!"
Sergey Babkin
author
Ranch Hand

Joined: Apr 05, 2010
Posts: 50
The biggest problem with unit tests is that writing and maintaining the detailed unit tests require about as much time as the program in the first place. Lots of work. Sometines you change one line that changes the results of 100 tests, and then you have to go through all of them and figure out, if it changed them in the right way or not.

Some of this difficulty can be reduced by making the test more high-level, running a more complete application and doing some action on a single aspect of it. It's kind of a balance between the detailed view and the overhead.

Also the original code for the low-level tests has to provide the hooks for the unit tests to access the internal state of the objects and check that it is correct. One typical way of doing this is by defining the wrapper classes. And then the rules are "no private anything, only protected; no final classes" etc, or these wrappers won't be able to access the state in the classes they wrap.
Sergey Babkin
author
Ranch Hand

Joined: Apr 05, 2010
Posts: 50
Adding to it, recently I find the integrated tests much more useful than the fine-grained unit tests. You still target the test toward one part of functionality, but if you run it in the context of the whole application, much more of the code gets exercised. Often this highlights some issues in a part of the code you've never thought of.

And the integrated tests usually take a lot less effort to develop than the detailed unit tests.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parallel Programming: how to test it?
 
Similar Threads
reflection
Carry content onto another page?
In how many ways we can create an object? could you Explain with example if possible.
PSPEC file??
Key Listeners