Skip to content
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

Fix GUI tests #5781

Merged
merged 9 commits into from
Jan 8, 2020
Merged

Fix GUI tests #5781

merged 9 commits into from
Jan 8, 2020

Conversation

koppor
Copy link
Member

@koppor koppor commented Dec 22, 2019

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
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.

@koppor
Copy link
Member Author

koppor commented Dec 26, 2019 via email

@tobiasdiez
Copy link
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
Copy link
Member Author

koppor commented Jan 1, 2020

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
@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