Skip to content

Commit

Permalink
Try using testNg using junit engine (#5404)
Browse files Browse the repository at this point in the history
Motivation:

junit-team/testng-engine#87 has been resolved which means that we don't need special handling for testNg

Modifications:

- Removed special logic for testNg
- Added junit's `testng-engine` globally

Result:

- Cleaner gradle script

<!--
Visit this URL to learn more about how to write a pull request description:
https://armeria.dev/community/developer-guide#how-to-write-pull-request-description
-->
  • Loading branch information
jrhee17 authored Jan 29, 2024
1 parent d2afcd9 commit 67869a5
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 69 deletions.
30 changes: 1 addition & 29 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ dependencies {
}

// TestNG
testImplementation libs.testng
testRuntimeOnly libs.junit.testng.engine

// JUnit Pioneer
testImplementation libs.junit.pioneer
Expand Down Expand Up @@ -203,34 +203,6 @@ testing.suites {
}
tasks.check.dependsOn testing.suites.testStreaming

// Run the test cases based on reactive-streams-tck only with non-flaky mode
if (rootProject.findProperty('flakyTests') != 'true') {
testing.suites {
testNg(JvmTestSuite) {
useTestNG()

targets.configureEach {
testTask.configure {

project.ext.configureCommonTestSettings(it)
include '/com/linecorp/armeria/**/common/**'
dependsOn tasks.copyShadedTestClasses
scanForTestClasses = false
testClassesDirs = tasks.shadedTest.testClassesDirs
classpath = testClassesDirs
doFirst {
classpath += project.files(configurations.shadedJarTestRuntime.resolve())
}
}
}
dependencies {
runtimeOnly libs.junit.testng.engine
}
}
}
tasks.check.dependsOn testing.suites.testNg
}

if (tasks.findByName('trimShadedJar')) {
tasks.trimShadedJar.configure {
// Keep all classes under com.linecorp.armeria, except the internal ones.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testng.util.Strings;

import com.google.common.base.Strings;

import com.linecorp.armeria.client.logging.LoggingClient;
import com.linecorp.armeria.common.Flags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
import org.junit.jupiter.api.extension.RegisterExtension;
import org.reactivestreams.Subscriber;
import org.reactivestreams.Subscription;
import org.testng.util.Strings;

import com.google.common.base.Strings;

import com.linecorp.armeria.client.ResponseTimeoutException;
import com.linecorp.armeria.client.WebClient;
Expand Down
8 changes: 1 addition & 7 deletions dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ spring6 = "6.1.3"
spring-boot2 = "2.7.18"
spring-boot3 = "3.2.2"
testcontainers = "1.19.1"
testng = "7.5.1"
thrift09 = { strictly = "0.9.3-1" }
thrift012 = { strictly = "0.12.0" }
thrift013 = { strictly = "0.13.0" }
Expand Down Expand Up @@ -752,7 +751,7 @@ version.ref = "junit-pioneer"

[libraries.junit-testng-engine]
module = "org.junit.support:testng-engine"
version = "1.0.4"
version = "1.0.5"

[libraries.jwt]
module = "com.auth0:java-jwt"
Expand Down Expand Up @@ -1249,11 +1248,6 @@ module = "org.testcontainers:consul"
[libraries.testcontainers-junit-jupiter]
module = "org.testcontainers:junit-jupiter"

# jdk 11 is required from testng version 7.6
[libraries.testng]
module = "org.testng:testng"
version.ref = "testng"

[libraries.thrift09]
module = "org.apache.thrift:libthrift"
version.ref = "thrift09"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import reactor.core.publisher.Flux;

@Test
@Ignore
public class HttpDeframerTckTest extends PublisherVerification<DeframedMessage> {

private static final TransportStatusListener noopListener = (status, metadata) -> {};
Expand Down
31 changes: 0 additions & 31 deletions kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,3 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
}
}

testing {
suites {
@Suppress("UNUSED_VARIABLE")
val testNg by registering(JvmTestSuite::class) {
useTestNG()

targets {
all {
testTask.configure {
group = "Verification"
description = "Runs the TestNG unit tests"
dependsOn(tasks.copyShadedTestClasses)
val shadedTestTask = tasks.shadedTest.get()
testClassesDirs = shadedTestTask.testClassesDirs
classpath = shadedTestTask.testClassesDirs
doFirst {
classpath += project.files(configurations.shadedJarTestRuntime.get().resolve())
}
}
}
}

dependencies {
runtimeOnly(libs.junit.testng.engine)
}
}
}
}

tasks.check { dependsOn(testing.suites.named("testNg")) }

0 comments on commit 67869a5

Please sign in to comment.