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

Convert remaining tests to junit 5 #5394

Merged
merged 28 commits into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ac526de
[WIP] Convert remaining tests to junit 5
Siedlerchr Oct 5, 2019
9f8ad5a
remove junit 4
Siedlerchr Oct 5, 2019
b13e470
Merge remote-tracking branch 'upstream/master' into convertRemainingTest
Siedlerchr Oct 9, 2019
1374d20
temporaily add system.out.prinltn to test if all are run
Siedlerchr Oct 9, 2019
9a4a52a
fix gradle not executing tests correclty
Siedlerchr Oct 9, 2019
48c545c
fix gradle syntax error
Siedlerchr Oct 9, 2019
09b131b
add more logging
Siedlerchr Oct 9, 2019
c284667
fix psql driver name and url
Siedlerchr Oct 9, 2019
2041c5b
Merge remote-tracking branch 'upstream/master' into convertRemainingTest
Siedlerchr Oct 24, 2019
0717211
Manually call setup and clear in each test
Siedlerchr Oct 24, 2019
ac192c0
fix typo and call clear
Siedlerchr Oct 24, 2019
a324878
fix unmodifable error
Siedlerchr Oct 24, 2019
05398b0
fix field map error
Siedlerchr Oct 24, 2019
98f0a7c
fix id
Siedlerchr Oct 24, 2019
6a2760c
Merge remote-tracking branch 'upstream/master' into convertRemainingTest
Siedlerchr Oct 25, 2019
96d65e9
SetID does not store value as internal id field
Siedlerchr Oct 25, 2019
b1ff631
add some comments for further debugging hints
Siedlerchr Oct 25, 2019
0d380fd
fix copy paste error
Siedlerchr Oct 25, 2019
3778214
Merge remote-tracking branch 'upstream/master' into convertRemainingTest
Siedlerchr Nov 5, 2019
e475748
Merge branch 'master' into convertRemainingTest
tobiasdiez Nov 11, 2019
06d9ec1
Cleanup code
tobiasdiez Nov 11, 2019
ae96327
Don't allow codecov to fail
tobiasdiez Nov 11, 2019
dfb7a18
Temporarily allow failure of database tests
tobiasdiez Nov 11, 2019
7152a3b
Readd database test to codecov
tobiasdiez Nov 11, 2019
7bbd564
Try to ignore failures the other way
tobiasdiez Nov 11, 2019
b627365
Or maybe this way?
tobiasdiez Nov 11, 2019
8a82ef9
Yet another try
tobiasdiez Nov 11, 2019
68e51e1
Well...maybe now
tobiasdiez Nov 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ matrix:
fast_finish: true
allow_failures:
- env: TEST_SUITE=fetcherTest
- env: TEST_SUITE=databaseTest
- env: TEST_SUITE=guiTest
- env: TEST_SUITE=codecov
- env: DEPENDENCY_UPDATES=check

# JavaFX localization tests need a running X environment
Expand Down
54 changes: 43 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ dependencies {


testCompile 'io.github.classgraph:classgraph:4.8.53'
testCompile 'junit:junit:4.12'
testImplementation 'org.junit.jupiter:junit-jupiter:5.5.2'
testRuntimeOnly 'org.junit.vintage:junit-vintage-engine:5.5.2'
testCompile 'org.junit.platform:junit-platform-launcher:1.5.2'
Expand Down Expand Up @@ -441,31 +440,49 @@ localization.script = 'scripts/syncLang.py'
// Test tasks
test {
useJUnitPlatform {
excludeTags 'DatabaseTest', 'FetcherTest', 'GUITest', 'org.jabref.testutils.category.FetcherTest', 'org.jabref.testutils.category.GUITest'
excludeTags 'DatabaseTest', 'FetcherTest', 'GUITest'
}

testLogging {
// set options for log level LIFECYCLE
events "failed"
events = ["FAILED", "STANDARD_OUT", "STANDARD_ERROR"]
Copy link
Member Author

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 💻

exceptionFormat "full"
}
}

task databaseTest(type: Test) {
useJUnit {
includeCategories 'org.jabref.testutils.category.DatabaseTest'
useJUnitPlatform {
includeTags 'DatabaseTest'
}

testLogging {
// set options for log level LIFECYCLE
events = ["FAILED", "STANDARD_OUT", "STANDARD_ERROR"]
exceptionFormat "full"
}
}

task fetcherTest(type: Test) {
useJUnit {
includeCategories 'org.jabref.testutils.category.FetcherTest'
useJUnitPlatform {
includeTags 'FetcherTest'
}

testLogging {
// set options for log level LIFECYCLE
events = ["FAILED", "STANDARD_OUT", "STANDARD_ERROR"]
exceptionFormat "full"
}
}

task guiTest(type: Test) {
useJUnit {
includeCategories 'org.jabref.testutils.category.GUITest'
useJUnitPlatform {
includeTags 'GUITest'
}

testLogging {
// set options for log level LIFECYCLE
events = ["FAILED", "STANDARD_OUT", "STANDARD_ERROR"]
exceptionFormat "full"
}
}

Expand All @@ -480,9 +497,24 @@ tasks.withType(Test) {
reports.html.destination = file("${reporting.baseDir}/${name}")
}

task jacocoMergePrep() {
doFirst {
// Ignore failures of tests
tasks.withType(Test) {
ignoreFailures = true
}
}
}
test.mustRunAfter jacocoMergePrep
databaseTest.mustRunAfter jacocoMergePrep
fetcherTest.mustRunAfter jacocoMergePrep

task jacocoMerge(type: JacocoMerge) {
executionData file("$buildDir/jacoco/test.exec"), file("$buildDir/jacoco/databaseTest.exec"), file("$buildDir/jacoco/fetcherTest.exec")
dependsOn test, databaseTest, fetcherTest
executionData files(
"$buildDir/jacoco/test.exec",
"$buildDir/jacoco/databaseTest.exec",
"$buildDir/jacoco/fetcherTest.exec").filter { it.exists() }
dependsOn jacocoMergePrep, test, databaseTest, fetcherTest
}

jacocoTestReport {
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/logic/shared/DBMSConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class DBMSConnection implements DatabaseConnection {
private final DBMSConnectionProperties properties;

public DBMSConnection(DBMSConnectionProperties connectionProperties) throws SQLException, InvalidDBMSConnectionPropertiesException {

if (!connectionProperties.isValid()) {
throw new InvalidDBMSConnectionPropertiesException();
}
Expand All @@ -34,7 +33,6 @@ public DBMSConnection(DBMSConnectionProperties connectionProperties) throws SQLE
// we use the side effect of getAvailableDBMSTypes() - it loads all available drivers
DBMSConnection.getAvailableDBMSTypes();
this.connection = DriverManager.getConnection(connectionProperties.getUrl(), connectionProperties.asProperties());

} catch (SQLException e) {
// Some systems like PostgreSQL retrieves 0 to every exception.
// Therefore a stable error determination is not possible.
Expand Down
4 changes: 0 additions & 4 deletions src/test/java/module-info.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
--add-modules
// Make junit4 module visible (only required for last remaining parameterized tests)
junit

--add-modules
// Add junit5 module dependency
org.junit.jupiter.api
Expand Down
Loading