-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsure of how to find JOptionPanes #237
Comments
Thanks for your question, please open a separate issue for the illegal access - then it's easier to get the overview of the issues ;-) Regarding Also have a look at the example code SimpleCopyApplication_UseBaseTest.java it should give you an understanding of how to use AssertJ Swing. Does this answer your question? |
I saw this, but the issue lied in the fact that one test would execute and work fine for the first screen - however, when I would run the second test, which would check the second screen, it would fail since the program would terminate (due to the end of the test), and restart, causing the test to fail since the first screen is not at all close to the second screen. Does that highlight my situation @croesch ? |
So you have like several pages and want to test each page separately but your test setup starts the application at page 1 and stops the application after test? So your second test does not start in the correct state of the application? I would suggest the following:
|
@croesch, How do I make it so the JOptionPaneFinder will find the correct JOptionPane? Can I make it so it finds one with a specific name, or a specific message? Otherwise, wouldn't it only find the first one? Let me re-explain: Now, I have another test. This test is checking the second window that shows up. This has a completely different title, completely different type of JOptionPane, and appears after I click the OK button on the JOptionPane that shows up as the first window. How can I test this second windows properties? And, would the same logic apply for testing the third, fourth, fifth, sixth, and n-th windows? |
Tests get a lot worse (in terms of stability) if you make a chain of them. So if the test of the second window would rely on the first window to show up and pass properly you would make both tests fail if window one has a problem. In general I would suggest making a change to your application: Allow to start window two programmatically and start only this window for your test. Do so for all windows and keep the test short, simple and stable. Please read the JavaDoc to see the usage and how to find JOptionPanes by name, type, text or whatever you can imagine. It's possible - but I'm not going to write the code here, because it's well documented. |
Hi,
I'm unsure of how to set up a project built in JOptionPane - I have used reflective elements before, however, the issue lies in the fact that the program I'm testing requires certain actions to take place between frames (for example, hit the OK button on a JOptionPane before doing the next test). I know this is generally a broad question, but how would I go about doing this? Also, on a different note, I'm currently getting this error
upon running of a test, and I'm unsure of what this means. My test simply runs the main code via
application(ApplicationName.class).start();
and then runs the tests accordingly.
Any help would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: