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

Add tests for the presenter of elwin interface #37210

Merged
merged 7 commits into from Apr 29, 2024
Merged

Conversation

adriazalvarez
Copy link
Contributor

Description of work

This PR follows after refactoring the presenter of the elwin interface and making it non qt-dependent (#36537). Now test are added for most public members of the class.
To make it possible to test by mocking the models and the data model, I had to add a new overloaded constructor to the elwin presenter which is only called from the test. All Data Manipulation presenter classes share the same structure, so maybe we can think of adding an issue in the future for homogenizing the presenters and constructing them by passing directly unique pointers to the model, as it is done on most other presenter of mantid MVP interfaces.

Summary of work

Fixes #34928

Further detail of work

To test:

  • Test passes in CI
  • Code review

** does not need release notes**


Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@adriazalvarez adriazalvarez added Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS Team: Spectroscopy Issue and pull requests managed by the Spectroscopy subteam at ISIS labels Apr 24, 2024
@adriazalvarez adriazalvarez added this to the Release 6.10 milestone Apr 24, 2024
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've only had a very quick look, and it looks great! The only think I would say is that it would be better for the MockElwinModel to inherit from an interface class rather than the ElwinModel. Was there a reason you did it this way?

@adriazalvarez
Copy link
Contributor Author

Thanks for taking a look. Initialize I implemented the interface on the ElwinModel but then I though it may be not necessary as its only use is for the mock. If you think is better practice I can change it.

@robertapplin
Copy link
Contributor

Thanks for taking a look. Initialize I implemented the interface on the ElwinModel but then I though it may be not necessary as its only use is for the mock. If you think is better practice I can change it.

I think it probably would be best practise to use an interface class. That way it would be more consistent with how things are done for the presenters and views

@robertapplin robertapplin self-assigned this Apr 26, 2024
Copy link
Contributor

@robertapplin robertapplin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Adds a test for the Elwin presenter, and mocks out all dependencies for the presenter to make sure we are only testing the presenter - great job!

@SilkeSchomann SilkeSchomann merged commit 0bd2ff9 into main Apr 29, 2024
9 checks passed
@SilkeSchomann SilkeSchomann deleted the elwin_presenter_Test branch April 29, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indirect/Inelastic Issues and pull requests related to indirect or inelastic ISIS Team: Spectroscopy Issue and pull requests managed by the Spectroscopy subteam at ISIS
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

Write tests for elwin presenter
3 participants