Skip to content

Commit

Permalink
Remove TestNG tests running for Java 5
Browse files Browse the repository at this point in the history
Compiling these with Java 9 is not supported - so I removed the targetCompatibility setting
from the Sample and removed the Test having 1.5 targetCompatibility from TestNGIntegrationTest
Java 5 support has been dropped in Gradle 3.0 and we have sufficient test coverage for TestNG
without these tests.

+review REVIEW-6057
  • Loading branch information
wolfs committed Jun 14, 2016
1 parent 58eceed commit 45cd0a7
Show file tree
Hide file tree
Showing 24 changed files with 18 additions and 213 deletions.
17 changes: 14 additions & 3 deletions gradle/java9.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ task java9IntegTest(type: Test) {
"MavenConversionIntegrationTest",


"SampleTestNGIntegrationTest",
"TestNGIntegrationTest",

// Jetty version does not work on Java 9
"JettyIntegrationSpec",
"SamplesWebQuickstartIntegrationTest",
Expand Down Expand Up @@ -181,8 +178,22 @@ task java9IntegTest(type: Test) {
*/
"BuildDashboardPluginIntegrationTest",

/*
Jacoco 0.7.7.201606060606 seems to work for Java 9. The test needs to
be fixed since the HTML report is a little bit different
*/
"JacocoPluginIntegrationTest",

/*
Caused by: java.lang.IllegalAccessException: class org.mozilla.javascript.MemberBox cannot access class sun.net.www.protocol.http.HttpURLConnection (in module java.base) because module java.base does not export sun.net.www.protocol.http to unnamed module @2afcc5b3
at jdk.internal.reflect.Reflection.throwIllegalAccessException(java.base@9-ea/Reflection.java:405)
at jdk.internal.reflect.Reflection.throwIllegalAccessException(java.base@9-ea/Reflection.java:396)
at jdk.internal.reflect.Reflection.ensureMemberAccess(java.base@9-ea/Reflection.java:98)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
for "can evaluate content"
*/
"EnvJsPluginIntegrationTest",

"GradleRunnerSamplesEndUserIntegrationTest",
"MultiRequestWorkerProcessIntegrationTest",
"SingleRequestWorkerProcessIntegrationTest",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
apply plugin: 'java'

sourceCompatibility=1.5

repositories {
mavenCentral()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public class SampleTestNGIntegrationTest extends AbstractIntegrationTest {
result.testClass('org.gradle.testng.UserImplTest').assertTestPassed('testOkFirstName')
}

@Test @UsesSample('testing/testng/java-jdk15-passing')
public void javaJdk15Passing() {
@Test @UsesSample('testing/testng/java-passing')
public void javaPassing() {
executer.inDirectory(sample.dir).withTasks('clean', 'test').run()

def result = new TestNGExecutionResult(sample.dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package org.gradle.testing.testng

import org.gradle.integtests.fixtures.AbstractIntegrationTest
import org.gradle.integtests.fixtures.DefaultTestExecutionResult
import org.gradle.integtests.fixtures.TestNGExecutionResult
import org.gradle.integtests.fixtures.TestResources
import org.gradle.integtests.fixtures.executer.ExecutionResult
import org.junit.Before
Expand All @@ -26,7 +25,8 @@ import org.junit.Test
import spock.lang.Issue

import static org.gradle.util.Matchers.containsLine
import static org.hamcrest.Matchers.*
import static org.hamcrest.Matchers.containsString
import static org.hamcrest.Matchers.not

class TestNGIntegrationTest extends AbstractIntegrationTest {

Expand Down Expand Up @@ -66,47 +66,6 @@ class TestNGIntegrationTest extends AbstractIntegrationTest {
assert containsLine(result.getOutput(), "FINISH [Test method unknownError(SomeTest)] [unknownError] [AppException]");
}

@Test
void groovyJdk15Failing() {
executer.withTasks("test").runWithFailure().assertTestsFailed()

def result = new DefaultTestExecutionResult(testDirectory)
result.assertTestClassesExecuted('org.gradle.BadTest')
result.testClass('org.gradle.BadTest').assertTestFailed('failingTest', equalTo('java.lang.IllegalArgumentException: broken'))
}

@Test
void groovyJdk15Passing() {
executer.withTasks("test").run()

def result = new DefaultTestExecutionResult(testDirectory)
result.assertTestClassesExecuted('org.gradle.OkTest')
result.testClass('org.gradle.OkTest').assertTestPassed('passingTest')
}

@Issue("GRADLE-1822")
@Test
void javaJdk15Failing() {
doJavaJdk15Failing("5.14.10")
doJavaJdk15Failing("6.3.1")
}

private void doJavaJdk15Failing(String testNGVersion) {
executer.withTasks("test").withArguments("-PtestNGVersion=$testNGVersion").runWithFailure().assertTestsFailed()

def result = new DefaultTestExecutionResult(testDirectory)
result.assertTestClassesExecuted('org.gradle.BadTest', 'org.gradle.TestWithBrokenSetup', 'org.gradle.BrokenAfterSuite', 'org.gradle.TestWithBrokenMethodDependency')
result.testClass('org.gradle.BadTest').assertTestFailed('failingTest', equalTo('java.lang.IllegalArgumentException: broken'))
result.testClass('org.gradle.TestWithBrokenMethodDependency').assertTestFailed('broken', equalTo('java.lang.RuntimeException: broken'))
result.testClass('org.gradle.TestWithBrokenMethodDependency').assertTestsSkipped('okTest')

def ngResult = new TestNGExecutionResult(testDirectory)
ngResult.testClass('org.gradle.TestWithBrokenSetup').assertConfigMethodFailed('setup')
ngResult.testClass('org.gradle.BrokenAfterSuite').assertConfigMethodFailed('cleanup')
ngResult.testClass('org.gradle.TestWithBrokenMethodDependency').assertTestFailed('broken', equalTo('broken'))
ngResult.testClass('org.gradle.TestWithBrokenMethodDependency').assertTestSkipped('okTest')
}

@Issue("GRADLE-1532")
@Test
void supportsThreadPoolSize() {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 45cd0a7

Please sign in to comment.