Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Added frontend/configtool related unit testing and refactoring improvements #651

Merged
merged 1 commit into from
Dec 29, 2014

Conversation

SRomansky
Copy link
Contributor

This pull requests aims to address the outstanding TODOs inside of the frontend configtool related classes

Related #484

@dideler dideler added this to the 2014 Fall - UCOSP milestone Nov 16, 2014
@@ -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):
Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good.

@SRomansky
Copy link
Contributor Author

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, self.config_tool.confirm_reset() or even using a mouse button click will seg fault the application.

@zxiiro
Copy link
Member

zxiiro commented Nov 20, 2014

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:
#631 (diff)

@SRomansky
Copy link
Contributor Author

Yeah, @zxiiro

        confirm = QMessageBox.question(self,
                                       self.confirmResetDefaultsTitleString,
                                       self.confirmResetDefaultsQuestionString,
                                       QMessageBox.Reset | QMessageBox.Cancel,
                                       QMessageBox.Cancel)

Is created to confirm that a user did mean to reset their configuration.
I think this is the same as what you noted here - #631 (comment)

@SRomansky
Copy link
Contributor Author

I have put in a fixme.

SRomansky pushed a commit to SRomansky/freeseer that referenced this pull request Dec 4, 2014
- 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
@SRomansky SRomansky force-pushed the 484-configtool-test-and-refactor branch 2 times, most recently from d5d1eb6 to c3bc23c Compare December 4, 2014 04:39
SRomansky pushed a commit to SRomansky/freeseer that referenced this pull request Dec 4, 2014
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):
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split up.

@SRomansky SRomansky force-pushed the 484-configtool-test-and-refactor branch from c3bc23c to f427956 Compare December 27, 2014 08:03
SRomansky pushed a commit to SRomansky/freeseer that referenced this pull request Dec 27, 2014
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)
Copy link
Member

Choose a reason for hiding this comment

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

Prefer assertFalse

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@dideler
Copy link
Member

dideler commented Dec 28, 2014

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
@SRomansky SRomansky force-pushed the 484-configtool-test-and-refactor branch from 9b30aa4 to 3bce4bf Compare December 28, 2014 20:19
@SRomansky
Copy link
Contributor Author

@dideler, should be good to go.

@dideler dideler merged commit 3bce4bf into Freeseer:master Dec 29, 2014
@dideler
Copy link
Member

dideler commented Dec 29, 2014

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.

@zxiiro
Copy link
Member

zxiiro commented Dec 29, 2014

Thanks for working on this during the holidays. Have a great New Years.

@SRomansky SRomansky deleted the 484-configtool-test-and-refactor branch December 29, 2014 01:19
@SRomansky
Copy link
Contributor Author

Have a good holiday too @dideler, @zxiiro

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants