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