Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Automated Unit Testing Policy for Applet

 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Thanks.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic