How to run auto gui test cases in AWT thread?

(uyentvu) #1


I am using a JUnit GUI testing framework called WindowTester to auto test my GUIs. When I ran my auto gui test cases using ant, they seemed to work fine. However, when I ran my auto gui test cases using gradle, I kept getting this error “not in AWT thread”.

Does anyone know how to configure/force the auto gui tests using WindowTester running in AWT thread?

Thanks in advance!

Below is the assetion error I got every time I ran the auto gui tests:

java.lang.AssertionError: Not in AWT thread





at javax.swing.DefaultListSelectionModel.fireValueChanged(

at javax.swing.DefaultListSelectionModel.fireValueChanged(

at javax.swing.DefaultListSelectionModel.fireValueChanged(

at javax.swing.DefaultListSelectionModel.changeSelection(

at javax.swing.DefaultListSelectionModel.changeSelection(

at javax.swing.DefaultListSelectionModel.setSelectionInterval(


at javax.swing.JTable.setRowSelectionInterval(




at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(

at sun.reflect.DelegatingMethodAccessorImpl.invoke(

at java.lang.reflect.Method.invoke(

at junit.framework.TestCase.runTest(

at junit.framework.TestCase.runBare(

at com.windowtester.runtime.common.UITestCaseCommon.access$0(

at com.windowtester.runtime.common.UITestCaseCommon$

at com.windowtester.runtime.common.UITestCaseCommon$

at com.windowtester.internal.runtime.junit.core.SequenceRunner$

(Stefan Sieber) #2

This doesn’t sound like a gradle problem to me, but maybe I got something wrong.

  • How do you execute the tests? - Did you use a special Ant - Task when running the Tests from Ant? - Are the tests normal JUnit - tests which just happen to reference a special testing Library (windowtester)? - maybe you can share parts of the gradle build script?

(uyentvu) #3

Here is how I execute the GUI tests using Gradle command: >gradle runAutoGuiTests

Below is my task defined in Gradle:

task runAutoGuiTests(type: Test) {

beforeTest { descriptor ->

logger.lifecycle("Running: " + descriptor)


include ‘com/abc/windowtester/**AutoTest.*’


I do not use any special Ant task at all. However, when I use Ant to run my Ant target called runAutoGuiTests, it ran successfully. Our project was using Ant to build in the past. I am migrating our project to Gradle at the moment.

We use WindowTester to automate the process of our GUI testings and run the tests using Gradle.