Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Question: How do I test something graphical? For example, I have routines that are generating charts and graphs in PNG format.

    Answer: One way would be to pre-generate "known good" charts and graphs, save them in a test_data directory and, run your routines and see if the output files are the same.

    Question: How would I test a GUI interface for something?

    Answer: I've struggled with this and for the most part, I don't think there are good, generic answers. One suggestion that I've heard is to have t

    • I've occasionally used another technique for testing the text output of legacy scripts to prevent regression while refactoring or fixing bugs. Redirect all output to a file, for both the new and old versions of the script, and then use "diff" to detect differences. This is certainly worse than fully automated testing, but much better than fully manual testing.

      Redirecting "all output" is slightly more challenging if the legacy code doesn't have the hooks Ovid recommends, but not impossible. Although "print" is usually called frequently, "open" is typically called infrequently. Adding a conditional to each "open" which causes output to go to STDOUT or STDERR instead of a file/pipe when in test mode is not too hard, and takes care of most output.

      This just leaves bidirectional pipes and sockets, which are much more challenging. For these, connect to a mock server/system if possible. But it is not always possible to build an accurate mock system if you have incomplete knowledge of the system you are connecting to: if you have the ability to test the validity of the mock system, you don't need the mock system in this case.

      Image output can be considered generic data output for testing purposes, if you have complete control over the input data, and the output format does not change at all.

      GUI testing is a completely different problem. For web-based systems, functionality of the GUI can be tested automatically, but it's not always easy.