Search code examples
javaswingunit-testingjemmy

How to write Jemmy unit tests?


I'm searching for a good tool for writing regression tests for our Java Swing GUI. I found jemmy2 and I'm really satisfied with it.

There is one little drawback though: As the jemmy examples show, I have to write each test class as an org.netbeans.jemmy.Scenario: the test code goes to the public int runIt() method. I prefer to have more conventional unit tests with the usual given-when-then structure and with meaningful assertions. I'd really like to integrate jemmy with a unit testing framework like junit or testng.

So, the question: how can I do that? I know that it's possible because the JellyTools did it - in a NetBeans-specific way.

Alternatively, how can I get meaningful error reports from my jemmy scenarios?


Solution

  • Jemmy could be used with any test harness like JUnit, TestNG, what have you.

    You do not need to do anything special - just use Jemmy API directly from test methods. With JUnit and TestNG you also get nice @Before to run the tested app.

    Shura