This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
It's developed without any unit testing. So the first thing I concern is how to add testing to the legacy code, or just add testing to new code?
The architecture is simple, an applet provides fields for configuration, encapsulate the data with XML and transport to server via HTML. Which test cases should be added? Of course XMLBuilder/XMLParser need test cases. How about each detail screen? It's said test GUI is a little difficult. What makes it worse is the GUI is built by NetBeans GUI builder.
Another thing is the server won't update its interface often when I do Applet side. Will some Mock API tools make my life easier?
I don't know how Test-Driven can be used here. Because the process is same, there are just differences between the parameters and commands.
I hope I would describe my question clearly. But I've never written any test cases before, so I don't know what will be the biggest problem when writing test cases. Would you shed some light on me?
If you have never written tests before, I'd advise to start by just developing your new code test-first.
Unit testing legacy code is possible, but is certainly an advanced topic. Once you get the hang on writing tests for new code, get a copy of "Working Effectively with Legacy Code" by Micheal Feathers. It contains tons of good advice, but assumes that you are already used to unit testing in general.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: Jan 28, 2005
Thank you Ilja. Concentrating on new code test-first makes things easier. I've run some examples with JUnit yesterday, and read some articles on it, especially Micheal's "Humble Dialog".
Come back to my applet, the client is thin enough, the logic is the same with every detail screens. Just set&get commands. So I don't see what's the value of testing here.