Migrating my Mind to Maven (Part 7) – Functional Testing

Functional testing with JellyTools is fairly unfamiliar territory for me, so this morning I decided to spend some time to learn how it works with a Maven-based NetBeans Platform Application. JellyTools is a library based on Jemmy, which allows you to manipulate GUI components during automated functional testing.

My first attempt at following the Writing JellyTools Tests Guide almost succeeded. I created a JUnit test in one of my modules and modified it according to the guide. I also added a test dependency on org.netbeans.api:org-netbeans-modules-jellytools-platform. The test compiled and was executed as expected, but the error message returned by the test was that the class org.netbeans.Main was not found.

So I decided to try moving it to the application module. And that did the trick!

Now I have the following test class in my application module:

[java]import java.util.logging.Level;
import junit.framework.Test;
import org.netbeans.jellytools.JellyTestCase;
import org.netbeans.jellytools.TopComponentOperator;
import org.netbeans.jemmy.operators.JButtonOperator;
import org.netbeans.junit.NbModuleSuite;

public class FirstScreenTest extends JellyTestCase {

private JButtonOperator _btn;
private TopComponentOperator _tc;

public FirstScreenTest(String name) {

public static Test suite() {
NbModuleSuite.Configuration conf =
conf = conf.addTest(“clickButtonTest”);
return NbModuleSuite.create(conf);

public void clickButtonTest() {
System.out.println(“test case: click button”);
_tc = new TopComponentOperator(“TC”);
_btn = new JButtonOperator(_tc, “Button”);

When I test the application (right-click on the application project and choose Test), the GUI is started up and the first button on the first screen is successfully pushed by the testing framework. 🙂

Useful Links

And only after writing this I also found the useful pages below. Where were they hiding earlier? 🙂

And here are some resources on running these tests as part of a Jenkins build.

Instructional designer, educational technologist and occasional lecturer who loves travel and photography

3 thoughts on “Migrating my Mind to Maven (Part 7) – Functional Testing”

  1. As you found, functional tests need to be a part of the “application” project, so that they can run in the context of the complete application – the NB Platform plus all of your modules. Unlike the Ant-based harness, Maven module projects are truly independent: they “know nothing” more than their list of direct module dependencies (and the cluster name, typically the same as the branding token). So unit tests in a module are fine, but functional tests are not really possible.

  2. Jesse, with maven it is also possible tu run JellyTest. We are running them and they look very cool.

    Although, new challege is knocking on my door and it is combination of JellyTest and Cucumber. Problem is that you need to run one from other one (in this case Cucumber from JellyTest).

    What I am facing now is that Cucumber class cannot be found, while it is not part of application (because it is test dependency) and can’t be part of application (nothing related to test should be distributed with application). I looking for an option to sneak something to classpath (additional JARs) when tests starts.

    So far no luck. Maybe I am missing something.



Leave a Comment