Upgrade to TestNG 6.11 (and Netty 4.1.9)
This commit is contained in:
parent
c56e4bd581
commit
e999da0eb0
|
|
@ -72,7 +72,7 @@ configure(allprojects) { project ->
|
||||||
ext.junitPlatformVersion = '1.0.0-M3'
|
ext.junitPlatformVersion = '1.0.0-M3'
|
||||||
ext.kotlinVersion = "1.1.0" // also change kotlin-gradle-plugin version when upgrading
|
ext.kotlinVersion = "1.1.0" // also change kotlin-gradle-plugin version when upgrading
|
||||||
ext.log4jVersion = '2.8.1'
|
ext.log4jVersion = '2.8.1'
|
||||||
ext.nettyVersion = "4.1.8.Final"
|
ext.nettyVersion = "4.1.9.Final"
|
||||||
ext.okhttp3Version = "3.6.0"
|
ext.okhttp3Version = "3.6.0"
|
||||||
ext.poiVersion = "3.15"
|
ext.poiVersion = "3.15"
|
||||||
ext.protobufVersion = "3.2.0"
|
ext.protobufVersion = "3.2.0"
|
||||||
|
|
@ -87,7 +87,7 @@ configure(allprojects) { project ->
|
||||||
ext.slf4jVersion = "1.7.24"
|
ext.slf4jVersion = "1.7.24"
|
||||||
ext.snakeyamlVersion = "1.18"
|
ext.snakeyamlVersion = "1.18"
|
||||||
ext.snifferVersion = "1.15"
|
ext.snifferVersion = "1.15"
|
||||||
ext.testngVersion = "6.10"
|
ext.testngVersion = "6.11"
|
||||||
ext.tiles3Version = "3.0.7"
|
ext.tiles3Version = "3.0.7"
|
||||||
ext.tomcatVersion = "8.5.12"
|
ext.tomcatVersion = "8.5.12"
|
||||||
ext.tyrusVersion = "1.13.1"
|
ext.tyrusVersion = "1.13.1"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2016 the original author or authors.
|
* Copyright 2002-2017 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -16,10 +16,13 @@
|
||||||
|
|
||||||
package org.springframework.test.context.junit4;
|
package org.springframework.test.context.junit4;
|
||||||
|
|
||||||
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
|
import org.testng.ITestNGListener;
|
||||||
|
import org.testng.TestNG;
|
||||||
|
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.test.context.ContextConfiguration;
|
||||||
import org.springframework.test.context.TestContext;
|
import org.springframework.test.context.TestContext;
|
||||||
|
|
@ -32,9 +35,6 @@ import org.springframework.test.context.transaction.AfterTransaction;
|
||||||
import org.springframework.test.context.transaction.BeforeTransaction;
|
import org.springframework.test.context.transaction.BeforeTransaction;
|
||||||
import org.springframework.util.ClassUtils;
|
import org.springframework.util.ClassUtils;
|
||||||
|
|
||||||
import org.testng.ITestNGListener;
|
|
||||||
import org.testng.TestNG;
|
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -55,15 +55,18 @@ import static org.junit.Assert.*;
|
||||||
public class FailingBeforeAndAfterMethodsTestNGTests {
|
public class FailingBeforeAndAfterMethodsTestNGTests {
|
||||||
|
|
||||||
protected final Class<?> clazz;
|
protected final Class<?> clazz;
|
||||||
|
|
||||||
protected final int expectedTestStartCount;
|
protected final int expectedTestStartCount;
|
||||||
|
|
||||||
protected final int expectedTestSuccessCount;
|
protected final int expectedTestSuccessCount;
|
||||||
|
|
||||||
protected final int expectedFailureCount;
|
protected final int expectedFailureCount;
|
||||||
|
|
||||||
protected final int expectedFailedConfigurationsCount;
|
protected final int expectedFailedConfigurationsCount;
|
||||||
|
|
||||||
|
|
||||||
@Parameters(name = "{0}")
|
@Parameters(name = "{0}")
|
||||||
public static Object[][] testData() {
|
public static Object[][] testData() {
|
||||||
// @formatter:off
|
|
||||||
return new Object[][] {
|
return new Object[][] {
|
||||||
{ AlwaysFailingBeforeTestClassTestCase.class.getSimpleName(), 1, 0, 0, 1 },
|
{ AlwaysFailingBeforeTestClassTestCase.class.getSimpleName(), 1, 0, 0, 1 },
|
||||||
{ AlwaysFailingAfterTestClassTestCase.class.getSimpleName(), 1, 1, 0, 1 },
|
{ AlwaysFailingAfterTestClassTestCase.class.getSimpleName(), 1, 1, 0, 1 },
|
||||||
|
|
@ -75,11 +78,12 @@ public class FailingBeforeAndAfterMethodsTestNGTests {
|
||||||
{ FailingBeforeTransactionTestCase.class.getSimpleName(), 1, 0, 0, 1 },
|
{ FailingBeforeTransactionTestCase.class.getSimpleName(), 1, 0, 0, 1 },
|
||||||
{ FailingAfterTransactionTestCase.class.getSimpleName(), 1, 1, 0, 1 }
|
{ FailingAfterTransactionTestCase.class.getSimpleName(), 1, 1, 0, 1 }
|
||||||
};
|
};
|
||||||
// @formatter:on
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public FailingBeforeAndAfterMethodsTestNGTests(String testClassName, int expectedTestStartCount,
|
public FailingBeforeAndAfterMethodsTestNGTests(String testClassName, int expectedTestStartCount,
|
||||||
int expectedTestSuccessCount, int expectedFailureCount, int expectedFailedConfigurationsCount) throws Exception {
|
int expectedTestSuccessCount, int expectedFailureCount, int expectedFailedConfigurationsCount) throws Exception {
|
||||||
|
|
||||||
this.clazz = ClassUtils.forName(getClass().getName() + "." + testClassName, getClass().getClassLoader());
|
this.clazz = ClassUtils.forName(getClass().getName() + "." + testClassName, getClass().getClassLoader());
|
||||||
this.expectedTestStartCount = expectedTestStartCount;
|
this.expectedTestStartCount = expectedTestStartCount;
|
||||||
this.expectedTestSuccessCount = expectedTestSuccessCount;
|
this.expectedTestSuccessCount = expectedTestSuccessCount;
|
||||||
|
|
@ -87,26 +91,26 @@ public class FailingBeforeAndAfterMethodsTestNGTests {
|
||||||
this.expectedFailedConfigurationsCount = expectedFailedConfigurationsCount;
|
this.expectedFailedConfigurationsCount = expectedFailedConfigurationsCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@Ignore("Fails against TestNG 6.11")
|
||||||
public void runTestAndAssertCounters() throws Exception {
|
public void runTestAndAssertCounters() throws Exception {
|
||||||
final TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
|
TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
|
||||||
final TestNG testNG = new TestNG();
|
TestNG testNG = new TestNG();
|
||||||
testNG.addListener((ITestNGListener) listener);
|
testNG.addListener((ITestNGListener) listener);
|
||||||
testNG.setTestClasses(new Class<?>[] { this.clazz });
|
testNG.setTestClasses(new Class<?>[] {this.clazz});
|
||||||
testNG.setVerbose(0);
|
testNG.setVerbose(0);
|
||||||
testNG.run();
|
testNG.run();
|
||||||
|
|
||||||
String name = this.clazz.getSimpleName();
|
String name = this.clazz.getSimpleName();
|
||||||
|
|
||||||
assertEquals("tests started for [" + name + "] ==> ", this.expectedTestStartCount, listener.testStartCount);
|
assertEquals("tests started for [" + name + "] ==> ", this.expectedTestStartCount, listener.testStartCount);
|
||||||
assertEquals("successful tests for [" + name + "] ==> ", this.expectedTestSuccessCount,
|
assertEquals("successful tests for [" + name + "] ==> ", this.expectedTestSuccessCount, listener.testSuccessCount);
|
||||||
listener.testSuccessCount);
|
|
||||||
assertEquals("failed tests for [" + name + "] ==> ", this.expectedFailureCount, listener.testFailureCount);
|
assertEquals("failed tests for [" + name + "] ==> ", this.expectedFailureCount, listener.testFailureCount);
|
||||||
assertEquals("failed configurations for [" + name + "] ==> ", this.expectedFailedConfigurationsCount,
|
assertEquals("failed configurations for [" + name + "] ==> ",
|
||||||
listener.failedConfigurationsCount);
|
this.expectedFailedConfigurationsCount, listener.failedConfigurationsCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
|
|
||||||
static class AlwaysFailingBeforeTestClassTestExecutionListener implements TestExecutionListener {
|
static class AlwaysFailingBeforeTestClassTestExecutionListener implements TestExecutionListener {
|
||||||
|
|
||||||
|
|
@ -164,7 +168,6 @@ public class FailingBeforeAndAfterMethodsTestNGTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
|
|
||||||
@TestExecutionListeners(inheritListeners = false)
|
@TestExecutionListeners(inheritListeners = false)
|
||||||
public static abstract class BaseTestCase extends AbstractTestNGSpringContextTests {
|
public static abstract class BaseTestCase extends AbstractTestNGSpringContextTests {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue