Skip to content

Commit

Permalink
Add another test task ":embulkTest"
Browse files Browse the repository at this point in the history
  • Loading branch information
dmikurube committed Sep 10, 2024
1 parent f45a1dd commit 4c6846e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
32 changes: 32 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,28 @@ version = "0.1.0-SNAPSHOT"
configurations {
compileClasspath.resolutionStrategy.activateDependencyLocking()
runtimeClasspath.resolutionStrategy.activateDependencyLocking()

embulkTestImplementation.extendsFrom testImplementation
embulkTestRuntime.extendsFrom testRuntime
}

sourceSets {
embulkTest {
java {
srcDir file("src/embulkTest/java")
}
resources.srcDir file("src/embulkTest/resources")
}
}

dependencies {
testImplementation "org.junit.jupiter:junit-jupiter-api:5.11.0"

testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.0"

embulkTestImplementation "org.junit.jupiter:junit-jupiter-api:5.11.0"

embulkTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.11.0"
}

// A safer and strict alternative to: "dependencies" (and "dependencies --write-locks")
Expand Down Expand Up @@ -48,3 +64,19 @@ test {
outputs.upToDateWhen { false }
}
}

task embulkTest(type: Test) {
classpath = sourceSets.embulkTest.runtimeClasspath
testClassesDirs = sourceSets.embulkTest.output.classesDirs

useJUnitPlatform()
testLogging {
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
showCauses = true
showExceptions = true
showStackTraces = true
showStandardStreams = true
outputs.upToDateWhen { false }
}
}
12 changes: 12 additions & 0 deletions src/embulkTest/java/org/embulk/junit5/example/TestExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.embulk.junit5.example;

import static org.junit.jupiter.api.Assertions.assertEquals;

import org.junit.jupiter.api.Test;

public class TestExample {
@Test
public void testExample() {
assertEquals(0, 1 - 1);
}
}

0 comments on commit 4c6846e

Please sign in to comment.