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

Refactoring existing unit tests #7687

Merged
merged 12 commits into from
May 6, 2021
Merged

Refactoring existing unit tests #7687

merged 12 commits into from
May 6, 2021

Conversation

BShaq
Copy link
Contributor

@BShaq BShaq commented May 2, 2021

This pull request contributes to issue #6207, which is to add more unit tests or improve existing ones.

Tests refactored:

MinifyNameListFormatterTest
StringLengthComparatorTest
CapitalizeFormatterTest
AuthorsTest
RemoveBracketsAddCommaTests
DOICheckTest
FileLinkTest
FirstPageTest
RemoveTildeTest

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not created an issue at https://github.com/JabRef/user-documentation/issues or, even better, submitted a pull request to the documentation repository.

BShaq added 5 commits May 1, 2021 23:42
Transformed StringLengthComparatorTest & MinifyNameListFormatterTest to parameterized tests, since they've got multiple assertions within one unit test included (Test Smell: Assertion Roulette)
There exists unit tests in these test classes that have multiple assertions (Test smell: Assertion Roulette). I therefore have refactored those unit tests, either by incorporating them into existing parameterized tests or by creating new parameterized tests.
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

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

Nice to see work on using paramterized tests.

Please do that everywhere.

General comment: It would be nice to have one pull request per test class. Otherwise, reviewing gets hard, because there are soooo many lines changed.

(I also updated #6207. I hope not to annoy people when always wringint things NOT to do)

@koppor koppor added the status: changes required Pull requests that are not yet complete label May 2, 2021
@BShaq
Copy link
Contributor Author

BShaq commented May 3, 2021

Nice to see work on using paramterized tests.

Please do that everywhere.

General comment: It would be nice to have one pull request per test class. Otherwise, reviewing gets hard, because there are soooo many lines changed.

(I also updated #6207. I hope not to annoy people when always wringint things NOT to do)

Hi @koppor
I understand that it might become tedious to review all the changes..
But would it also help if, for example, there is one commit for every class that is changed? In this case you'd also have a better overview over the changed code in a class.
I'm asking this question since I've already started working on a new branch (similar to this one, but with fewer classes involved).
Nevertheless, I will start applying this comment for each new upcoming branch.

@koppor
Copy link
Member

koppor commented May 3, 2021

But would it also help if, for example, there is one commit for every class that is changed? In this case you'd also have a better overview over the changed code in a class.

Looking at our mass of pull requests, I decided to have "global" reviewing strategy/workflow for our core developers. Deciding on a case-bases makes it difficult to handle the mass of open pull requests.

Furthermore, if at class A there is a comment, but class B can go as is, the changes of class B won't go into main, because it is stalled by the unrelated class A.

I'm asking this question since I've already started working on a new branch (similar to this one, but with fewer classes involved).

You could use the git cherry-pick magic. Maybe also the git checkout master && git checkout -b new-branch && git checkout your-working-branch && git reset new-branch magic and then commiting line-wise with git gui.

Nevertheless, I will start applying this comment for each new upcoming branch.

@koppor koppor removed the status: changes required Pull requests that are not yet complete label May 3, 2021
@@ -10,151 +10,134 @@

public class AuthorsTest {
Copy link
Member

Choose a reason for hiding this comment

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

Please convert the whole class to paramterized tests

@koppor
Copy link
Member

koppor commented May 6, 2021

I will merge and wait for parameterized AuthorsTest in a follow-up pr

@koppor koppor merged commit efb4848 into JabRef:main May 6, 2021
Siedlerchr added a commit that referenced this pull request May 15, 2021
* upstream/main: (71 commits)
  [Bot] Update CSL styles (#7735)
  Fix for issue 6966: open all files of multiple entries (#7709)
  Add simple unit tests (#7696)
  Add simple unit tests (#7543)
  Update check-outdated-dependencies.yml
  Added preset for new entry keybindings and reintroduced defaults (#7705)
  Select the entry which has smaller dictonary order when merge (#7708)
  Update CHANGELOG.md
  fix: make more fields, fomatters, ids and languages sorted by alphabetical order (#7717)
  Bump libreoffice from 7.1.2 to 7.1.3 (#7721)
  Bump unoloader from 7.1.2 to 7.1.3 (#7724)
  Bump org.beryx.jlink from 2.23.7 to 2.23.8 (#7723)
  Bump org.openjfx.javafxplugin from 0.0.9 to 0.0.10 (#7725)
  fix: make fields sorted by lexicographical order (#7711)
  Fix tests
  Refactoring existing unit tests (#7687)
  Refactoring and addition of unit tests (#7581)
  Refactor simple Unit Tests (#7571)
  Add simple unit tests (#7544)
  add and extend unit tests (#7685)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants