assertj-swing
assertj-swing copied to clipboard
Assertj-Swing: GuiActionRunner - numRetries/waitBetweenRetries
Hi, unfortunately i miss following feature. I have the problem that some actions creating a new GUI form/element runs a lot of time (SwingWorker, DynamicTreeNode(s)). So i implemented following workaround, which works fine.
Example public static void execute(@Nonnull GuiTask task) { if (!executeInEDT) { executeInCurrentThread(task); return; } for (int i = 0; i < # ConfigAssertJ.numRetries - 1; i++) { run(task); if (task.catchedException() == null) { break; } // Error -> retry System.out.println("Retry " + task); try { Thread.sleep(ConfigAssertJ.waitBetweenRetries); } catch (Exception e) { // TODO: handle exception } } rethrowCaughtExceptionIn(task); }
Hi @andyhayder
Thanks for the suggestion. It seems like you would rather need a retry/wait of the checking rather than retrying to execute the task again and again!?
Which GuiTask do you use? Your own or one of the framework?
What I don't like about this approach is that the task is executed multiple times which could be wrong in some cases. I would prefer to enhance the checking / timeout to be configurable.
Please let me know what you use it for and I think we can work out a good solution..
Hallo Christian, dies war ein schneller Hack. Ich hab keinen eigenen GuiTask. Ich fand die lib ganz gut, bin aber gleich in ein Problem in einer meiner ersten Samples gelaufen. Ich fand meine Lösung scharmant, da sie an ganz zentraler Stelle ansetzte. Ich hab einen jtree und wollte eine Node selektieren. Meine node ist eine sogenannte dynamische treenode. Das heißt, die node kennt nach der Initialisierung seine Kinder nicht. Wenn der User auf die node expand klickt, dann startet ein Swingworker , liest Daten von DB, und erzeugt dann die Kinder Knoten. Erst danach kann ich also den echten treepath selektieren. Kann also dauern ... Ich bekam aber den Fehler, der treepath wäre nicht selektierbar. Erstmal bin ich erfreut, dass ihr euch gemeldet habt. Ich denke, ihr werdet eine Lösung in meinem Sinne finden. Ihr habt die bessere Erfahrung. Ich bin noch nicht so stark im Thema, finde es aber selbst für wichtig, solche Themen anzusprechen. Bin selber Entwickler und freue mich über jegliches Feedback. Das Ausgangsproblem ist aber immer das Gleiche. Durch die Nebenläufigkeit ist der Zugriff auf bestimmte Komponenten nicht immer zeitnah möglich.
Am 16.05.2017 09:02 schrieb "Christian Rösch" [email protected]:
Hi @andyhayder https://github.com/andyhayder
Thanks for the suggestion. It seems like you would rather need a retry/wait of the checking rather than retrying to execute the task again and again!?
Which GuiTask do you use? Your own or one of the framework?
What I don't like about this approach is that the task is executed multiple times which could be wrong in some cases. I would prefer to enhance the checking / timeout to be configurable.
Please let me know what you use it for and I think we can work out a good solution..
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joel-costigliola/assertj-swing/issues/204#issuecomment-301693957, or mute the thread https://github.com/notifications/unsubscribe-auth/AbURU910jN7IT-HI9r9UUMyIDD0_DSNDks5r6UohgaJpZM4NY56F .
Hallo Christian, wenn das Projekt noch lebt, hab ich gleich noch einen Verbesserungsvorschlag. Gesucht wird eine Komponente über die Richtungsangabe, relativ zur Ausgangskomponente. Beispiel: in einem Komponentengrid könnte ich sagen, gib mir das erste jtextfield gleich rechts neben meinem jlabel. Vorteil: ich muss dem jtextfield keinen Namen geben, bin aber sehr flexibel. Oft wird ja links ein jlabel gesetzt, rechts daneben eine inputkomponente. Dies hat dann den Vorteil beim mõglichen Refactoring, dass der Test weiterhin funktioniert. Bin sehr auf deine Reaktion gespannt. MfG Andy Entschuldige die Rechtschreibung. Aber auf dem Handy und der nervigen Textersetzung ... Am 16.05.2017 22:49 schrieb "Andy Hayder" [email protected]:
Hallo Christian, dies war ein schneller Hack. Ich hab keinen eigenen GuiTask. Ich fand die lib ganz gut, bin aber gleich in ein Problem in einer meiner ersten Samples gelaufen. Ich fand meine Lösung scharmant, da sie an ganz zentraler Stelle ansetzte. Ich hab einen jtree und wollte eine Node selektieren. Meine node ist eine sogenannte dynamische treenode. Das heißt, die node kennt nach der Initialisierung seine Kinder nicht. Wenn der User auf die node expand klickt, dann startet ein Swingworker , liest Daten von DB, und erzeugt dann die Kinder Knoten. Erst danach kann ich also den echten treepath selektieren. Kann also dauern ... Ich bekam aber den Fehler, der treepath wäre nicht selektierbar. Erstmal bin ich erfreut, dass ihr euch gemeldet habt. Ich denke, ihr werdet eine Lösung in meinem Sinne finden. Ihr habt die bessere Erfahrung. Ich bin noch nicht so stark im Thema, finde es aber selbst für wichtig, solche Themen anzusprechen. Bin selber Entwickler und freue mich über jegliches Feedback. Das Ausgangsproblem ist aber immer das Gleiche. Durch die Nebenläufigkeit ist der Zugriff auf bestimmte Komponenten nicht immer zeitnah möglich.
Am 16.05.2017 09:02 schrieb "Christian Rösch" [email protected]:
Hi @andyhayder https://github.com/andyhayder
Thanks for the suggestion. It seems like you would rather need a retry/wait of the checking rather than retrying to execute the task again and again!?
Which GuiTask do you use? Your own or one of the framework?
What I don't like about this approach is that the task is executed multiple times which could be wrong in some cases. I would prefer to enhance the checking / timeout to be configurable.
Please let me know what you use it for and I think we can work out a good solution..
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joel-costigliola/assertj-swing/issues/204#issuecomment-301693957, or mute the thread https://github.com/notifications/unsubscribe-auth/AbURU910jN7IT-HI9r9UUMyIDD0_DSNDks5r6UohgaJpZM4NY56F .
Hello Andy,
as this mail/answer is online available I'm writing in English.
Okay I see. For the tree issue, could you provide a basic sample exactly how you implemented the tree and a test that fails but you would expect it to succeed? Then I can develop a good solution that works for you.
Yes, the project is not dead :) But the development speed is really slow. I suggest you open a ticket for that relative component addressing.. but I guess if you don't provide a basic PR, it will take some years until one implements it.
Best regards, Christian
I will do my best. Am 17.05.2017 13:32 schrieb "Christian Rösch" [email protected]:
Hello Andy,
as this mail/answer is online available I'm writing in English.
Okay I see. For the tree issue, could you provide a basic sample exactly how you implemented the tree and a test that fails but you would expect it to succeed? Then I can develop a good solution that works for you.
Yes, the project is not dead :) But the development speed is really slow. I suggest you open a ticket for that relative component addressing.. but I guess if you don't provide a basic PR, it will take some years until one implements it.
Best regards, Christian
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joel-costigliola/assertj-swing/issues/204#issuecomment-302063069, or mute the thread https://github.com/notifications/unsubscribe-auth/AbURU1OPtqcJJwe6bty3afazWqYxq1R9ks5r6trogaJpZM4NY56F .
Hello Christian, you can call the standard demo TestTree.java which open a tree with a node named dynamo. Expanding the node show's a 'Waiting' node. After 15 sec it's changed to the real final node 'Time'. On the other side you have the assertj test 'AutomatedTest'.java which show, how it crashes. These is independant from GUIActionRunner. /Andy PS: Perhaps the change in GUIActionRunner was to much, because i also developed a retry in openNode(). No matter. It show's a general problem with SwingWorker and long running tasks.
2017-05-17 20:56 GMT+02:00 Andy Hayder [email protected]:
I will do my best. Am 17.05.2017 13:32 schrieb "Christian Rösch" [email protected]:
Hello Andy,
as this mail/answer is online available I'm writing in English.
Okay I see. For the tree issue, could you provide a basic sample exactly how you implemented the tree and a test that fails but you would expect it to succeed? Then I can develop a good solution that works for you.
Yes, the project is not dead :) But the development speed is really slow. I suggest you open a ticket for that relative component addressing.. but I guess if you don't provide a basic PR, it will take some years until one implements it.
Best regards, Christian
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joel-costigliola/assertj-swing/issues/204#issuecomment-302063069, or mute the thread https://github.com/notifications/unsubscribe-auth/AbURU1OPtqcJJwe6bty3afazWqYxq1R9ks5r6trogaJpZM4NY56F .
Hi Andy,
thx. But which TestTree.java
and AutomatedTest
are you talking about?
Obviously not org.assertj.swing.test.swing.TestTree
!?
Please provide the source here so that it's easy to understand the specific test case.
- Christian
The last Mail i send had a Attachment with a complete Sample Project. Regards
Am 12.07.2017 13:32 schrieb "Christian Rösch" [email protected]:
Hi Andy,
thx. But which TestTree.java and AutomatedTest are you talking about?
Obviously not org.assertj.swing.test.swing.TestTree!?
Please provide the source here so that it's easy to understand the specific test case.
- Christian
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joel-costigliola/assertj-swing/issues/204#issuecomment-314742256, or mute the thread https://github.com/notifications/unsubscribe-auth/AbURUzs5ofBZYCM8FI3FnTcpRDDqMMIhks5sNK7OgaJpZM4NY56F .
I think attachments get lost when replying to github issues. Can you attach it manually or provide a link? Thx!
Am 09.08.2017 3:04 nachm. schrieb "Christian Rösch" < [email protected]>:
I think attachments get lost when replying to github issues. Can you attach it manually or provide a link? Thx!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/joel-costigliola/assertj-swing/issues/204#issuecomment-321249150, or mute the thread https://github.com/notifications/unsubscribe-auth/AbURU0XsSqBtYDzdX-CzO1W7DL9-2_Xnks5sWa5ygaJpZM4NY56F .