Hallo zusammen,
ich schreibe gerade UI Tests für meine Applikation. Das klappt auch soweit ganz gut. Aber nur solange ich die Tests lokal ausführe.
Wenn ich auf dem Jenkins server die Tests laufen lasse, funktioniert es nicht. Jenkins läuft auf einem Build-Server. Also nicht lokal.
Was kann ich tun?
Mein Test sieht wie folgt aus:
public class TableExportComponentTest {
@test
public void testComponent() throws InterruptedException {
JTable table = new JTable(new String[][] { { "ValA1", "ValB1", "ValC1" }, { "ValA2", "ValB2", "ValC2" }, { "ValA3", "ValB3", "ValC3" } }, new String[] { "ColA", "ColB", "ColC" });
JButton createExportButton = TableExportComponent.createExportButton(table, "TestTable");
Thread clickThread = new Thread(new Runnable() {
@Override
public void run() {
createExportButton.doClick();
}
});
Thread robotThread = new Thread(new Runnable() {
@Override
public void run() {
Robot robot;
try {
robot = new Robot();
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
}
catch (AWTException e) {
Thread.currentThread().interrupt();
}
}
});
robotThread.start();
clickThread.start();
clickThread.join();
robotThread.join();
}
}
Danke im Voraus
ich schreibe gerade UI Tests für meine Applikation. Das klappt auch soweit ganz gut. Aber nur solange ich die Tests lokal ausführe.
Wenn ich auf dem Jenkins server die Tests laufen lasse, funktioniert es nicht. Jenkins läuft auf einem Build-Server. Also nicht lokal.
Was kann ich tun?
Mein Test sieht wie folgt aus:
public class TableExportComponentTest {
@test
public void testComponent() throws InterruptedException {
JTable table = new JTable(new String[][] { { "ValA1", "ValB1", "ValC1" }, { "ValA2", "ValB2", "ValC2" }, { "ValA3", "ValB3", "ValC3" } }, new String[] { "ColA", "ColB", "ColC" });
JButton createExportButton = TableExportComponent.createExportButton(table, "TestTable");
Thread clickThread = new Thread(new Runnable() {
@Override
public void run() {
createExportButton.doClick();
}
});
Thread robotThread = new Thread(new Runnable() {
@Override
public void run() {
Robot robot;
try {
robot = new Robot();
robot.delay(1000);
robot.keyPress(KeyEvent.VK_ENTER);
}
catch (AWTException e) {
Thread.currentThread().interrupt();
}
}
});
robotThread.start();
clickThread.start();
clickThread.join();
robotThread.join();
}
}
Danke im Voraus