-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Gui testing #507
Gui testing #507
Conversation
Wow, if that works, then it's terrific! |
It does work already. :) The failing build is a sign that the remaining two null pointer exceptions need to be fixed. |
Nice work 👍 |
As already said today: 👍 Two things:
|
Aren't there any test frameworks that run in headless mode? |
I have not found any library that is still maintained and support this. |
b5ad6f8
to
bed386f
Compare
There are some indications in the documentation that this might be possible with assertJ Swing: |
b63c079
to
337051b
Compare
@matthiasgeiger hm, can't find any of these indications. |
http://joel-costigliola.github.io/assertj/swing/api/org/assertj/swing/core/ComponentLookupScope.html#ALL - if a UI component can be found without being shown it can be tested without being shown? |
No. If you test without the robot, then you have a headless mode. But I think you cannot test meaningful unit tests without the robot. |
For the record: Screenscraping UI test framework: http://www.sikulix.com/ |
I'm not sure if I like these kind of tests or not. Additionally, these kind of tests are rather fragile since they fail in case of trivial changes (like renaming the corresponding button). Personally, I would wait with GUI tests until after the migration to JavaFX and until the GUI is relatively stable. For the moment, there are enough untested logic classes which should be covered first. |
The thing is: with these tests we can easily spot some major issues which are hard to detect without the tests, e.g., that Swing classes are accessed outside the EDT thread or that exceptions occur upon clicking some buttons. And with only the 80 lines of code, five issues have been unearthed. Hence, the effort/benefit ratio is actually quite good. |
337051b
to
3785fdb
Compare
3785fdb
to
57ed95b
Compare
I really want to get this through. We could add a gradle build switch disabling the GUI testing. I want to have this in ensure that (when possible) the answer of a FAQ is backed by a test case. This will improve the documentation very much. |
2cef1fe
to
9d3c842
Compare
Looks good to go! The Mime-test seems to be failing every now and then... |
Integration tests are now separated from the normal unit tests and have to be called manually.
a1b70ac
to
8a7974a
Compare
The thing is, locally, they work. On the CI server, it somehow fails cause of timeouts as some windows may open not quick enough. I tried to increase the timeouts I could increase, but it did not solve the problem. I am leaning towards closing this PR, and just live with the fact that we cannot test our GUI. What is the opinion of the other @JabRef/developers ? |
So, the tests are now working on travis and on circleci. The original problems were coding errors in one of the tests (which is still not working properly, but is ignored now). As for getting the tests to work within IntelliJ, I am really at a loss. Why does the IDE receive no test events when executing the test class? Any hints @simonharrer Once we get that working there are still a few hurdles to jump. We need to find a proper syntax to test newly opened dialog windows. After that, there are practically hundreds of test we could write. |
We can test a lot with this at the moment already. I vote to merge this in and work on that when bugs arrive. |
👍 for merge if these GUI tests are not taken into account for the general test coverage metric. |
It would be nice, if they would increase the calculated coverage ;-) This does not yet work, however I'll merge this in! |
In my opinion ui testing is a pretty good thing. On the other hand @tobiasdiez also has a point. When we are changing from swing to javafx, all the effort will be for nothing. So I thought about two options that we have, if we want to do ui testing anyway (and I do). The first would be to use sikulix and screenscraping to do the tests independent from the ui-framework. The second solution is to try writing test interfaces that represent the use-case-flow without doing anything to the ui and in parallel write assertJ tests that use the interfaces. When converting the ui to javafx we could then still use the interfaces and only need to change the ui controlling framework. When we finished writing the assertJ test for #988 , @bruehldev and I will have a look at sikulix and determine how much effort it is to write tests with it, so we can estimate what solution is best suited for the conversion. Any opinions on my suggestions? |
@Braunch Completely agree with you. We should not focus on creating so much gui tests. |
I also wouldn't worry too much about GUI tests. For JavaFX the databinding mechanism makes it relatively easy to test the ui without actually running the application (this more or less corresponds to the test interfaces you are speaking about). |
Adds the ability to do GUI tests automatically.
With just 80 lines of testing code, I was able to raise the code coverage by 15%. And I detected two NullPointerExceptions (still to be fixed) plus three places where Swing classes were interacted with outside of the EDT.
This change allows to model bug reports as test cases on a GUI level.
What has been done