Question

While not a torrent, but some articles can be found on the net about function testing (particularly http://blogs.oracle.com/geertjan/entry/gui_testing_on_the_netbeans). However the tools mentioned by them do not seem to be maintained, or don't have a plugin working with the most recent version of Netbeans (6.8).

Do you have any function test setup for GUI? What is your level of integration into the development process (IDE integration, ant, etc).

Additional candy is that Netbeans is not only the IDE, but the GUI app is also developed for Netbeans 6.8 Platform (so I'm mainly interested in GUI testing NB-platform apps, but tips for any Swing apps in general would be a help too).

Was it helpful?

Solution

The NetBeans developers do a lot of functional testing and that testing is supported as part of the NetBeans module project.

One of the modules that I work with that has functional tests is here: http://hg.netbeans.org/web-main/file/tip/j2ee.sun.appsrv81

If you create an nbm module project, there are not functional tests defined by default, so you need to create some directories and the like 'by hand' on the Files explorer:

  1. test/qa-functional/src

  2. an initial test

This is a minimal test to get you started.

package a;

import junit.framework.Test;
import org.netbeans.junit.NbTestCase;
import org.netbeans.junit.NbModuleSuite;

public class SampleTest extends NbTestCase {

    private final int SLEEP = 10000;

    public SampleTest(String testName) {
        super(testName);
    }

    public void testBogus() {

    }


    public static Test suite() {
        return NbModuleSuite.create(
                NbModuleSuite.createConfiguration(SampleTest.class).
                addTest(SampleTest.class, new String[] { "testBogus"}).
                enableModules(".*").clusters(".*"));
    }
}

After these things are in place, you should be able to do the following:

  1. Switch to the Files explorer (if you aren't there already)

  2. Right click on the node for the build.xml file

  3. Select the Run Target->Advanced... item. A dialog will open.

  4. Select test-qa-functional from the combobox entry field labeled 'Select targets to run:'

    Press the Run button to dismiss the dialog and execute the test.

Once you get the minimal test case running, you can start to examine the qa-functional test that have been written for the NetBeans IDE to learn more.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top