assertj / assertj/assertj-swing
Testing issues with org.openide.DialogDisplayer
- Lingua principale
- Java
- Stelle
- 121
- Fork
- 52
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
_Issue by **[Mark Corkery](http://jira.codehaus.org/secure/ViewProfile.jspa?name=kramkroc)** from Thu, 24 Sep 2009 04:53:11 -0500_
_Originally opened as http://jira.codehaus.org/browse/FEST-226_
---
I'm having issues testing NetBeans Platforms DialogDescriptor. If I am testing the behavior in more than one test case the robot will not find the dialog panel in any test subsequent to the first test case which means that only the first test will pass. Netbeans Platform is
included as part of the standard netbeans IDE download. See the following page for more: http://platform.netbeans.org/
Testcase:
shouldDisplayDialog2(com.login.view.LoginFormTest):
Caused an ERROR
Timed out waiting for dialog to be found using matcher
org.fest.swing.core.matcher.DialogMatcher[name=<Any>, title='Hello',
requireShowing=false]
org.fest.swing.exception.WaitTimedOutError: Timed out waiting for
dialog to be found using matcher
org.fest.swing.core.matcher.DialogMatcher[name=<Any>, title='Hello',
requireShowing=false]
at org.fest.swing.timing.Pause.pause(Pause.java:74)
at org.fest.swing.timing.Pause.pause(Pause.java:58)
at org.fest.swing.fixture.ContainerFixture.findDialog
(ContainerFixture.java:165)
at org.fest.swing.fixture.ContainerFixture.dialog
(ContainerFixture.java:148)
at org.fest.swing.fixture.ContainerFixture.dialog
(ContainerFixture.java:143)
at com.login.view.LoginFormTest.shouldDisplayDialog2
(LoginFormTest.java:85)
I've created a cut down version of what my test looks like below (LoginForm could be replaced with any default JPanel object) :
package com.login.view;import org.fest.swing.driver.ComponentStateValidator;
import org.fest.swing.edt.FailOnThreadViolationRepaintManager;
import org.fest.swing.edt.GuiTask;
import org.fest.swing.fixture.Containers;
import org.fest.swing.fixture.DialogFixture;
import org.fest.swing.fixture.FrameFixture;
import org.fest.swing.core.matcher.DialogMatcher;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openide.DialogDescriptor;
import org.openide.DialogDisplayer;
import static org.fest.swing.edt.GuiActionRunner.*;public class LoginFormTest {
private LoginForm loginForm;
private FrameFixture testPanelFixture = null;@BeforeClass
public static void setUpOnce() {
FailOnThreadViolationRepaintManager.install();
}@Before
public void setUp() {execute(new GuiTask() {
@Override
protected void executeInEDT() throws Throwable {
loginForm = new LoginForm();
}
});
testPanelFixture = Containers.frameFixtureFor(loginForm);
//Aways call wait for idle after using the GuiActionRunner.
testPanelFixture.robot.waitForIdle();
}@After
public void cleanUp() {
testPanelFixture.robot.cleanUp();
}@Test
public void shouldDisplayDialog() throws Exception {
final DialogDescriptor dd = new DialogDescriptor("Hello", "Hello");
DialogDisplayer.getDefault().notifyLater(dd);
final DialogFixture loginDialog = testPanelFixture.dialog(DialogMatcher.withTitle("Hello"));
ComponentStateValidator.validateIsShowing(loginDialog.component());
loginDialog.focus();
}@Test
public void shouldDisplayDialog2() throws Exception {
final DialogDescriptor dd = new DialogDescriptor("Hello", "Hello");
DialogDisplayer.getDefault().notifyLater(dd);
final DialogFixture loginDialog = testPanelFixture.dialog(DialogMatcher.withTitle("Hello"));
ComponentStateValidator.validateIsShowing(loginDialog.component());
loginDialog.focus();
}
}
---
votes (original issue): 0
watches (original issue): 0
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia da LoginFormTest.java intorno alla riga 85 e riproduci il fallimento in shouldDisplayDialog e shouldDisplayDialog2. Traccia DialogDisplayer.notifyLater, ContainerFixture.dialog e il comportamento di pulizia del robot; il lavoro è completato quando entrambi i test riescono a trovare e validare la finestra di dialogo Hello dopo il setup e il cleanup.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- desktop, testing
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100