Skip to content

Fix GUI tests#5781

Merged
tobiasdiez merged 9 commits into
masterfrom
fix-gui-tests
Jan 8, 2020
Merged

Fix GUI tests#5781
tobiasdiez merged 9 commits into
masterfrom
fix-gui-tests

Conversation

@koppor

@koppor koppor commented Dec 22, 2019

Copy link
Copy Markdown
Member

Fixes #5602, refs #2768.

Wanted to know why our GUI tests are broken. The reason seems to be that we don't pass the preferences objects directly around, but use Globals.prefs at more places. Currently, the issue is in MainTable.java:

        importHandler = new ImportHandler(
                frame.getDialogService(), database, externalFileTypes,
                Globals.prefs.getFilePreferences(),
                Globals.prefs.getImportFormatPreferences(),
                Globals.prefs.getUpdateFieldPreferences(),
                Globals.getFileUpdateMonitor(),
                undoManager,
                Globals.stateManager);

I would propose to convert the constructor of MainTable (and BasePanel) to a builder pattern (because we have more than three arguments) and add passing of these preferences.

Alternatively, we can mock Globals.prefs.GetFilePreferences() etc. This is also OK for me as I accept global objects. However, we had a long discussion that we should get rid off Globals.

Is #1579 the right issue, where we discussed Globals.prefs? I think, the comment at #1593 (comment) summarizes the discussion.

@tobiasdiez

Copy link
Copy Markdown
Member

+1 for extracting Globals.prefs and mocking the relevant data. I don't think a builder pattern is necessary as the relevant classes are rarely initialized and all arguments need to be present anyway.

Comment thread src/main/java/org/jabref/gui/BasePanel.java Outdated
@koppor

koppor commented Dec 26, 2019 via email

Copy link
Copy Markdown
Member Author

@tobiasdiez

Copy link
Copy Markdown
Member

I think GUI tests would be nice to have. It's a good idea to let students extend the code coverage in a forthcoming project (similarly to what we did with the fetcher test suite). However, we should provide a few basic tests that serve as an orientation. With MVVM there shouldn't be any need for UI tests in the traditional sense (TestFX or Jubala or whatever) as one can simply write unit tests for the view model classes. Moreover, the current GUI tests don't add much value in my opinion.

For me it would be fine to remove all GUI tests that we have currently.

@koppor

koppor commented Jan 1, 2020

Copy link
Copy Markdown
Member Author

The whole "mess" is only for the BasePanelTest - to fix the other tests was easy. I removed all the "improvements" and made only cosmetic changes.

@koppor koppor changed the title [WIP] Fix GUI tests Fix GUI tests Jan 2, 2020
@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jan 2, 2020
Comment thread src/test/java/org/jabref/gui/entryeditor/SourceTabTest.java Outdated
@tobiasdiez tobiasdiez merged commit db13dc0 into master Jan 8, 2020
@tobiasdiez tobiasdiez deleted the fix-gui-tests branch January 8, 2020 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gui tests are broken

2 participants