Empty component hierarchy sometimes
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- java
- Ambito
- desktop, testing-qa
Direzione di ricerca
Inizia con AdhocTradeEntryDlgTest.testAmendETFuture e il relativo metodo di supporto setupDialog(), quindi eseguilo con CacioTestRunner su Linux per riprodurre la gerarchia vuota intermittente. Segui il problema attraverso DialogFixture e BasicComponentFinder e confronta le esecuzioni con e senza pack(). Il lavoro è concluso quando la causa è stata identificata e il test non fallisce più in modo intermittente nel trovare amendmentReasonLabel.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This is probably more suited to a mailing list / forum, but the mail list comment appeared to point me here.
I have a unit test which tests a dialog. I am using cacio-tta to enable it to run headless. This seems to run reliably in Windows and much of the time in Linux ... but maybe half of the time in linux the component lookup fails. When it fails, the component hierarchy is empty.
The failure looks as follows (I am running under junit4 with the CacioTestRunner)
org.assertj.swing.exception.ComponentLookupException: Unable to find component using matcher org.assertj.swing.core.NameMatcher[name='amendmentReasonLabel', type=javax.swing.JLabel, requireShowing=true].
Component hierarchy:
com.ccm.backtest.fund.AdhocTradeEntryDlg[name='dialog1', title='Amend Trade', enabled=true, modal=true, visible=true, showing=true]
at org.assertj.swing.core.BasicComponentFinder.componentNotFound(BasicComponentFinder.java:290)
at org.assertj.swing.core.BasicComponentFinder.find(BasicComponentFinder.java:275)
at org.assertj.swing.core.BasicComponentFinder.find(BasicComponentFinder.java:268)
at org.assertj.swing.core.BasicComponentFinder.findByName(BasicComponentFinder.java:203)
at org.assertj.swing.fixture.AbstractContainerFixture.findByName(AbstractContainerFixture.java:622)
at org.assertj.swing.fixture.AbstractContainerFixture.label(AbstractContainerFixture.java:291)
at com.ccm.backtest.fund.AdhocTradeEntryDlgTest.testAmendETFuture(AdhocTradeEntryDlgTest.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
The relevant test code that is failing is...
@Test
public void testAmendETFuture()
{
MockAssetFactory assetFactory = new MockAssetFactory();
Date today = java.sql.Date.valueOf("2015-01-02");
ETFuture future = new ETFuture(today, assetFactory.get("FTH16"), 2, Side.SELL, 1.234, today);
future.setBrokerageFee(2.34, assetFactory.get("CAD"));
future.setClearingFee(5.67, assetFactory.get("EUR"));
setupDialog("book", future, assetFactory, AdhocTradeEntryDlg.Operation.AMEND);
dialogFixture.label("amendmentReasonLabel").requireVisible();
where the setupDialog() code looks like:
private void setupDialog(String book, Transaction trade, IAssetFactory assetFactory, AdhocTradeEntryDlg.Operation operation)
{
dialog = GuiActionRunner.execute(new GuiQuery<AdhocTradeEntryDlg>()
{
protected AdhocTradeEntryDlg executeInEDT()
{
AdhocTradeEntryDlg dlg = new AdhocTradeEntryDlg(book, trade, assetFactory, operation);
dlg.pack();
return dlg;
}
});
// IMPORTANT: note the call to 'robot()'
// we must use the Robot from AssertJSwingJUnitTestCase
dialogFixture = new DialogFixture(robot(), dialog);
dialogFixture.show(new Dimension(800, 800));
}
I added the pack() call which makes the issue appear less often ... and so I am guessing there is a synchronisation issue at play here. The other interesting thing is that there are 4 almost identical tests in this test case - they all call setupDialog (it's not in onSetUp because there is more than one flavor as I require different tests to call different constructors for the object).
What would be a good way to debug this?
Ian
- Lingua principale
- Java
- Stelle
- 121
- Fork
- 52
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di assertj/assertj-swing
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
assertj/assertj-swing#279 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
assertj/assertj-swing#278 · 1 commento ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
assertj/assertj-swing#276 · 1 commento ·
-
Update unit test to avoid deprecated `ExpectedException.none()` by using `Assert.assertThrows()`Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
assertj/assertj-swing#275 ·
-
how to test when headless?Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
assertj/assertj-swing#277 · 1 commento ·
Tutte le issue di assertj/assertj-swing
Issue simili
-
CalendarEventAttendance/get returns eventAttendanceStatus while the doc says attendanceStatusForse già presa @chibenwa l’ha presa oggi. Apertabug claude
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
linagora/tmail-backend#2697 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
apache/skywalking#14120 ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Case-insensitive search suggestions miss items when the JVM default locale is TurkishForse già presa @thswlsqls l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[Feature] 关于启动游戏进度条显示的优化Apertaenhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
HMCL-dev/HMCL#6943 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
NameAllocator generates colliding identifiers with ignorable charactersForse già presa @PHJ2000 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
I maintainer di solito rispondono entro 1 giorno