Timing

Besides component recognition, timing is an inherently difficult problem in automatic testing. No two runs of a Java program are identical when it comes to timing. Too much depends on things like system load or memory usage. This can lead to a situation where a target component for an event is not available, because the VM is still busy popping up the dialog window that contains it.

To avoid needless failures of tests, QF-Test combines several tactics:

  • Events are synchronized with the AWT event queue, meaning that after each event sent to the SUT, QF-Test waits until the events generated as side effects have been processed, before it sends another event.
  • In some cases, especially with asynchronous updates, this doesn't suffice, so whenever a component is not available, QF-Test waits for a certain amount of time to give it a chance to appear. This delay can be customized through the option Wait for non-existent component (ms).
  • An additional timeout defined by the option Wait for non-existent item (ms) applies when looking for sub-items of a component, e.g. a tree node.
  • These default timeouts should be kept rather short, a few seconds at most, so in addition you can set individual timeouts and delays wherever applicable.