Women in Technology

Hear us Roar



Article:
  More Test-Driven Development in Python
Subject:   Test Driven GUI Development?
Date:   2005-02-08 12:13:46
From:   kumar303
Response to: Test Driven GUI Development?

To my knowledge there is no easy, automated way to unit test an object that takes a textual input and outputs an image. however, there are still some approaches which will strengthen your application. First, a PHP "View" object of MVC, Savant, has this to say about eyeball unit testing. I have also done something similar when unit testing an object that used Image Magick to generate images.


In case you have a GUI framework that your application is using (and you probably are unless you are writing in Assembler) then you will be able to do automated testing via expectations. You can take a mock object approach like PHP's SimpleTest (I believe this is based on JUnit mock objects). You would create a mock object for the interface of your GUI controller object and then set up expectations. For instance [I am making this up] :
mockGUI.expectOnce('drawMenu', expectedParameters)
... in the test you would call your application's menuInit() method (or whatever) and the test would fail if the GUI object didn't make a call to drawMenu() with the correct parameters. Of course... for this to be effective you have to assume that the GUI library you are using is 100% functional :)