-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Convert remaining tests to junit 5 #5394
Conversation
Let's see if that works
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.
LGTM
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.
A few comments...
@MethodSource("getTestingDatabaseSystems") | ||
public void testMetaDataChangedEventListener(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws Exception { | ||
|
||
bibDatabase = new BibDatabase(); |
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.
The first three lines are shared between all tests, thus please extract them to the setup
method.
public void setUp() throws SQLException, DatabaseNotSupportedException, InvalidDBMSConnectionPropertiesException { | ||
this.dbmsConnection = TestConnector.getTestDBMSConnection(dbmsType); | ||
@MethodSource("getTestingDatabaseSystems") | ||
public void setUp(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMSProcessor dbmsProcessor) throws SQLException, DatabaseNotSupportedException, InvalidDBMSConnectionPropertiesException { |
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.
Does this really works, i.e. did you tested that all test methods are invoked correctly? According to the documentation the before/aftereach
handlers don't get their parameterized resolved.
Since a test class may contain regular tests as well as parameterized tests with different parameter lists, values from argument sources are not resolved for lifecycle methods (e.g. @beforeeach) and test class constructors.
But this is in a slightly different context. If this method works, then it should also be used in DBMSSynchronizerTest
.
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.
Well I will see if I can test it locally, but otherwise Travis is green and so I thought it's working
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.
Without double chcking (but trying to understand the implications of Tobias' explanation), I would bet that the test use only one database system and not all avaiable.
@Siedlerchr Please double check that the comments at #4260 (comment) are resolved. |
The database tests are the only remaining. I checked it by removing the junit4 dependency. ArchUnit was converted a long time ago. |
* upstream/master: (40 commits) Add test for regular expression pattern Snap GitHub ci (#5379) Bump src/main/resources/csl-locales from `e89e6b0` to `9785a6e` Bump src/main/resources/csl-styles from `36ac1f6` to `6169061` Bump mariadb-java-client from 2.4.4 to 2.5.0 Bump mockito-core from 3.0.0 to 3.1.0 Bump slf4j-api from 2.0.0-alpha0 to 2.0.0-alpha1 (#5403) Remove unnecessary code Fix JabFox integration Update CHANGELOG.md Add hacktoberfest shields.io badge Update CHANGELOG.md Fix various copy to clipboard issues (#5340) Fix 5359: Writing of Editor field is duplicated (#5392) Fix exception when merging entries Reenable prevcycle (#5385) Update deployment.yml revert 3fbe0a2 use submodules to fetch CSL styles properly add missing ',' ...
Ah for fucks sake, it should have been a clear warning that all tests were green before.. |
Any hope to get this in? At least the fix that the db and fetcher tests are invoked is important. |
I will try to create a woraround for it, e.g. I had the idea of "manually" calling the setup method and the clear method. |
# By Tobias Diez (11) and others # Via GitHub (30) and others * upstream/master: (70 commits) Use Platform.runLater Fixes #5485 Bump com.github.ben-manes.versions from 0.26.0 to 0.27.0 Bump src/main/resources/csl-styles from `68a697b` to `c3fd4bd` Bump byte-buddy-parent from 1.10.1 to 1.10.2 Bump mariadb-java-client from 2.5.0 to 2.5.1 Bump classgraph from 4.8.48 to 4.8.52 Bump org.beryx.jlink from 2.16.0 to 2.16.2 Updated CHANGELOG.md Open entry editor by default on start-up Amend the reference to JabRefReferences initialization (#5487) Fix for issue 5463 (#5481) Rename index.md to README.md Fix not on fx thread error for custom entry types Refactor to sorted set (#5477) Removed a duplicate name (closes #5476) Remove unnecessary sort (#5470) lint CONTRIBUTING.md (#5473) Mark OOSTyle as invalid if no defaultStyle (#5471) Fix highlight problem in entry preview ... # Conflicts: # build.gradle
There are still a lot of failing tests, I guess most is related to the EntryChangedEvent stuff. |
call clear in setup to ensure empty tables and no leftovers from failures
For local testing it's sufficient to install mysql or postgres 10. |
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.
No idea where the problem lies...sorry.
@@ -148,6 +156,8 @@ void testUpdateNewerEntry(DBMSType dbmsType, DBMSConnection dbmsConnection, DBMS | |||
bibEntry.setField(StandardField.YEAR, "1993"); | |||
|
|||
assertThrows(OfflineLockException.class, () -> dbmsProcessor.updateEntry(bibEntry)); | |||
|
|||
clear(dbmsConnection); |
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.
Is it important that clear
is always invoked? I think, if a assert
method fails, then an exception is thrown and thus clear
is never called. Either move it before assert
or use try finally
.
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.
That's why I addtionally call clear now as first method in setup :-D
src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/logic/shared/DBMSSynchronizerTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jabref/logic/shared/SynchronizationTestSimulator.java
Outdated
Show resolved
Hide resolved
Any update on this one? |
Did not yet find time to debug it in detail to find out where exactly the entry gets duplicated |
* upstream/master: (116 commits) New translations JabRef_en.properties (French) (#5564) Select newly added jstyle in table to prevent exception (#5556) Make entry editor DND behave as specified in settings (#5554) Disabled Windows directory picker temporarily Disabled Windows directory picker temporarily Adding wix script to support jpackage update Making importing a single file easier (Issue #5508) (#5513) Fix #5551 - Don't remove unwanted characters before first author is selected (#5558) Update JabRef_it.properties New translations JabRef_en.properties (Vietnamese) New translations JabRef_en.properties (Dutch) New translations JabRef_en.properties (French) New translations JabRef_en.properties (German) New translations JabRef_en.properties (Greek) New translations JabRef_en.properties (Indonesian) New translations JabRef_en.properties (Italian) New translations JabRef_en.properties (Japanese) New translations JabRef_en.properties (Danish) New translations JabRef_en.properties (Norwegian) New translations JabRef_en.properties (Polish) ...
In order to move forward, I've added the database tests to the list of failed tests. Follow-up issue: #5602 |
assertEquals(expectedEntry.getField(StandardField.AUTHOR), actualEntries.get(0).getField(StandardField.AUTHOR)); | ||
assertEquals("The nano processor1", actualEntries.get(0).getField(StandardField.TITLE).get()); | ||
//somehow the field stable is not filled | ||
assertEquals(Collections.singletonList(expectedEntry), actualEntries); |
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.
This is wrong. The test explicitly checks for a changed title! Please revert!
expectedEntry.setField(StandardField.AUTHOR, "Brad L and Gilson"); | ||
expectedEntry.setField(StandardField.TITLE, "The micro multiplexer", EntriesEventSource.SHARED); | ||
|
||
List<BibEntry> actualEntries = dbmsProcessor.getSharedEntries(); | ||
assertEquals(1, actualEntries.size()); | ||
assertEquals(expectedEntry.getField(StandardField.AUTHOR), actualEntries.get(0).getField(StandardField.AUTHOR)); | ||
assertEquals("The nano processor1", actualEntries.get(0).getField(StandardField.TITLE).get()); |
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.
See here that the title is different @tobiasdiez
} | ||
|
||
testLogging { | ||
// set options for log level LIFECYCLE | ||
events "failed" | ||
events = ["FAILED", "STANDARD_OUT", "STANDARD_ERROR"] |
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.
@koppor just change this lines.
Im only on mobile for the next days without access to a PC 💻
Remove junit4
The database test were the last remaining tests running on junit4