Open dwilczyn opened 11 years ago
Does Java have a facility for testing the actual GUI controls (buttons, checkboxes, etc.)? I don't know what kind of testing this would even be called (Unit, Integration, ...?) but I did some Googling and found Marathon which seems to be designed to work with Swing. Is this something that we could use?
I don't know fully what's available in eclipse with junit. But if you find something appropriate, like Marathon, feel free to use it.
Unit testing of GUI code is done manually. You actually use the GUI itself. However, instead of agents running, you would have a Mock Agent print a message in the appropriate method - that an actual agent would have.
As for testing the animation, you could have a Mock Agent that has actual animation code. You hard code the behavior - like a Waiter going to get a Customer to seat them. You then would have a number of hard coded behaviors to show that each piece of animation works. You can simplify this, if you have a standard mechanism - like a particular method - that moves a GUI agent from point A to point B. If so, you only have to show a few cases that work, all the other cases should also work - since you are calling the same animation method.
A colleague of mine (and a former 201 student) develops tests for Swing-based applications as part of their internship using the Swing Library of the Robot Framework.
If a team is interested in pursuing this, she offered to give interested students a quick intro and sample code.
What exactly has to be unit tested? All agents and roles? The new functionality in the restaurant (which would not be tested against other people's code)? The city GUI? All GUIs? We don't have any single person working on just GUIs, so could they just unit test the Agents or Roles that they wrote?
Everything is to be unit tested. That is the fundamental definition of unit testing. Individual programmers (or even teams of two programmers working together) fully test their own code, BEFORE pushing it to the main branch/trunk. JUnit tests should be a part of your repository. GUI unit testing is a written script, that can be followed by anyone.
A question was raised whether if you were mostly (only) working on gui things (controls and animation) did you have to do unit testing. The answer is MOST CERTAINLY.
Unit testing is a technique that applies to all code written in a team environment. Agents/roles have special techniques because of their unique structure. But all code needs to be tested. The mock object idea is everpresent.
Say you are writing the code for the guiPerson, say others are writing the animation code, say others are writing the PersonAgent code. The tests for the guiPerson need to be surrounded by mockAnimation, mockPersonAgent and anything and everything it interacts with. That applies to EVERY pieces of code in the system.
Perhaps Prof. Crowley can chime in here since his former csci200 students, who were at the time responsible for controls and animation, had to do testing.