This is a really big question. Just having unit tests does not necessarily mean that your code is any better. Writing good unit tests is an art (for any code, not just Struts 2), and is hard to summarize in a few lines. A good book would be a good place to start. I haven't read too many books on the subject, but I liked "Pragmatic Unit Testing in Java with JUnit" [1].
I'm by no means a unit testing expert, but here's a few lessons learned from my own experience: - When writing tests for existing code, try not to look at the code you're writing tests for while writing the test. Instead, think of what the code should do for a set of given inputs, and write tests that ensure that the result is as expected. - Use mock frameworks with care. When used correct, it is a good tool to isolate boundaries and make it possible to test units in isolation. When used wrong, you end up with fragile tests that is testing what your code does, instead of testing what your code should do. - Don't get caught up in the code coverage hysteria. Focus on writing good tests instead of how many lines and branches of code you have tested. - Your test code is a part of your production system, so treat it like that. When the test code gets messy, refactor it and keep it on the same level of quality as the rest of your production code. Also, as Jeromy pointed out in another reply, set up a continuous build system so your tests are running all the time. But most of all, experience is important. So jump into it and start writing some tests. Good luck on your testing. Nils-H [1] - http://pragprog.com/titles/utj/pragmatic-unit-testing-in-java-with-junit On Sun, Apr 27, 2008 at 2:41 PM, Frans Thamura <[EMAIL PROTECTED]> wrote: > hi there, > > i just have several question around unit testing for our project, cimande > > and we have lack of skill to to unit testing for our core (cimande), and our > apps on cimande (postila, papaje, takatu, etc). > > anyone can share? > > how to start a good unit testing for Struts2 based application, so our code > is good > > F > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]