Testing Multithreaded Applications

Frankenstein makes it easy to test multithreaded applications. In a multithreaded Swing application, worker threads are usually spawned as a result of a user action. At the end of every test step, Frankenstein waits until all worker thread activity ceases.

A Thread naming convention based approach

Using a thread naming convention based approach requires minimal code changes, and should work well for most cases.

The basic approach is as follows:

An alternate approach: implement the WorkerThreadMonitor interface

Another approach is to implement the WorkerThreadMonitor interface.

    package com.thoughtworks.frankenstein.application;
    
    /**
     * Monitor worker thread activity.
     */
    public interface WorkerThreadMonitor {
        /**

         * Called at the start of a test run.
         */
        public void start();
    
        /**
         * Blocking call, that returns after worker thread activity ceases.
         */
        public void waitForIdle();

    }