-
Notifications
You must be signed in to change notification settings - Fork 107
Added frontend/configtool related unit testing and refactoring improvements #651
Added frontend/configtool related unit testing and refactoring improvements #651
Conversation
@@ -79,6 +79,23 @@ def tearDown(self): | |||
def test_default_widget(self): | |||
self.assertTrue(self.config_tool.currentWidget == self.config_tool.generalWidget) | |||
|
|||
def check_combobox_corner_cases(self, comboBox): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this method is testing Qt code, not Freeseer code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I realized this shortly after refactoring it. I am thinking of a test that will cover the dropdown menu implementations. However, what I have come up with so far seems a little rigid. For instance, checking that 'English' and 'Deutsch' are inside the language ComboBox could be a test (but if we remove those values a dev would have to update the test.)
However, the checkbox tests (I think) are using hard coded values for checks. Perhaps it is fine to do this here since the entries in the drop down menus do not change as much?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we remove those values a dev would have to update the test
That's normal. If they don't update the test, the build will rightly break. That will either tell us there's unexpected behaviour or someone forgot to update the tests.
Perhaps it is fine to do this here since the entries in the drop down menus do not change as much?
Sorry, I don't follow. Fine to do what where?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't follow. Fine to do what where?
Sorry, perhaps it is fine to use hardcoded values to check if our values exist in the drop down menus since the names in the drop down menus will change infrequently.
I just looked at the code again. That is what the code is already doing... Therefore, I will refactor it to make it more clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good.
I am not really sure why, but trying to test the reset button on the config tool's general settings tab causes a seg fault. For instance, |
Does the config tool confirm button open a popup window? If so the segfault is probably caused by the same issue as in this discussion: |
Yeah, @zxiiro
Is created to confirm that a user did mean to reset their configuration. |
I have put in a fixme. |
- Remove test methods that only check function return types - Create resources folder for common test data like test rss feeds - Fix database.py query bugs - Add database folder for database related tests - Refactor common database fixtures into the database conftest file - Refactor comments in database.py - Refactor queries in database.py to have better style and sanitization - Add comments and examples of the presentation time stamps - Remove unused functions from database.py - Add httpretty mock tests for database.py - Add a database schema upgrade test - Add tests that check multiple scenarios of each method in database.py - Replace string % operators with calls to format for nonlog string formatting - Remove several try/finally statements and replaced them with 'with's - Fix an exception logging statement which referred to an out of scope value - Add failure and presentation equality and inequality comparison functions - Add example of parameterized test with fixtures - Fix relative path bug from linux convention to multi-platform in test_rss_feedparser.py - Add fixtures based on summer camp 2010 and 2011 stored data - Add rough copy of new schema Related Freeseer#484 Related Freeseer#651 Related Freeseer#667 Related Freeseer#670
d5d1eb6
to
c3bc23c
Compare
Added tests which simulate user interacting with the configtool interface. - Added dropdown menu user input simulating tests - Added tree widget user input simulating simulating test - Add a FIXME comment for the configuration reset button Fix Freeseer#651
|
||
def test_general_settings(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's too much being tested under this method. Try splitting it into multiple tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split up.
c3bc23c
to
f427956
Compare
Added tests which simulate user interacting with the configtool interface. - Added dropdown menu user input simulating tests - Added tree widget user input simulating simulating test - Add a FIXME comment for the configuration reset button Fix Freeseer#651
# Test disabled checkbox | ||
self.config_tool.currentWidget.autoHideCheckBox.setChecked(False) | ||
self.assertEquals(self.config_tool.currentWidget.autoHideCheckBox.checkState(), QtCore.Qt.Unchecked) | ||
self.assertEquals(self.config_tool.config.auto_hide, False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer assertFalse
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Thanks @wigglier. If you squash your commits then this will be ready to merge. |
Added tests which simulate user interacting with the configtool interface. - Added dropdown menu user input simulating tests - Added tree widget user input simulating simulating test - Add a FIXME comment for the configuration reset button Related Freeseer#484 Fix Freeseer#651
9b30aa4
to
3bce4bf
Compare
@dideler, should be good to go. |
Thanks for the tests, Stephen. If you're interested in continuing work on Freeseer, just let us know and we can add you as a committer. |
Thanks for working on this during the holidays. Have a great New Years. |
This pull requests aims to address the outstanding TODOs inside of the frontend configtool related classes
Related #484