Skip to content

Issue2366 Expected behavior of annotated methods on an @Test(groups="mygroup") annotated class

Bruce Wen edited this page Sep 26, 2020 · 7 revisions

This wiki page is to explain Issue2366

  • Test Classes
package com.example.demo.integration.suite;                                                                                                                                                                                                                 
  
  import com.example.demo.integration.util.DemoClient;
  import org.testng.Assert;
  import org.testng.ITestResult;
  import org.testng.annotations.*;
  
  import javax.ws.rs.core.Response;
  import java.lang.reflect.Method;
  
  @Test(groups = "acceptance")
  public class EndpointsTest {
      private final long startTime = System.currentTimeMillis();
      private DemoClient demoClient = new DemoClient();
  
      @BeforeClass
      public void setupOrgMatching() {
          System.out.printf("Starting %s...\n", this.getClass().getSimpleName());
      }
  
      @BeforeMethod(alwaysRun = true)
      public void beforeMethod(Method method) {
          System.out.println("Begin " + method.getName() + "...");
      }   
  
      @AfterMethod(alwaysRun = true)
      public void afterMethod(ITestResult result) {
          System.out.println(result);
          System.out.println(result.getMethod);
          System.out.println("End " + result.getMethod().getMethodName());
      }
  
      @AfterClass(alwaysRun = true)
      public void cleanup() {
          System.out.printf("Finished %s in %s ms\n", this.getClass().getSimpleName(), (System.currentTimeMillis() - startTime));
      }   
  
      @Test
      public void testGetHeartbeat() {
          Response response = demoClient.heartbeat();
  
          Assert.assertEquals(response.getStatus(), 204);
      }
  
      @Test(groups = "fragile")
      public void testGetHeartbeatSkipped() {
          System.out.print("Executed a test that should be skipped");
      }   
  }

  package com.example.demo.integration.suite;
  
  import com.example.demo.integration.util.DemoClient;
  import org.testng.Assert;
  import org.testng.annotations.Test;
  
  import javax.ws.rs.core.Response;
  
  public class EndpointsErrorTest {
      private DemoClient demoClient = new DemoClient();
  
      @Test
      public void testGetHeartbeat() {
          Response response = demoClient.heartbeatPost();
  
          Assert.assertEquals(response.getStatus(), 405);
      }                                                                                                                                                                                                                                                       
  }
  • Test Suite
  <!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
  <suite name="Demo Integration Test Suite" verbose="1">
  
      <test name="Demo Integration Tests" parallel="methods" thread-count="4">                                                                                                                                                                                
          <groups>
              <run>
                  
                  <exclude name="fragile"/>
                  <exclude name="load"/>
  
                  
                  <include name="acceptance"/>
              </run>
          </groups>
  
          <classes>
              <class name="com.example.demo.integration.suite.EndpointsTest"/>
              <class name="com.example.demo.integration.suite.EndpointsErrorTest"/>
          </classes>
      </test>
  </suite>
  • Java version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment 18.9 (build 11.0.8+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10, mixed mode, sharing)
  • Test Result - TestNG 7.3.0
<?xml version="1.0" encoding="UTF-8"?>
<testng-results ignored="2" total="3" passed="0" failed="1" skipped="0">
  <reporter-output>
  </reporter-output>
  <suite started-at="2020-09-26T23:36:53 CEST" name="Demo Integration Test Suite" finished-at="2020-09-26T23:36:56 CEST" duration-ms="2492">
    <groups>
      <group name="acceptance">
        <method signature="EndpointsTest.testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" name="testGetHeartbeat" class="com.example.demo.integration.suite.EndpointsTest"/>
      </group> 
    </groups>
    <test started-at="2020-09-26T23:36:53 CEST" name="Demo Integration Tests" finished-at="2020-09-26T23:36:56 CEST" duration-ms="2492">
      <class name="com.example.demo.integration.suite.EndpointsTest">
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:54 CEST" name="setupOrgMatching" finished-at="2020-09-26T23:36:54 CEST" duration-ms="11" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:54 CEST" name="beforeMethod" finished-at="2020-09-26T23:36:54 CEST" duration-ms="29" status="PASS">
          <params>
            <param index="0">
              <value>
                <![CDATA[public void com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat()]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method signature="testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:54 CEST" name="testGetHeartbeat" finished-at="2020-09-26T23:36:56 CEST" duration-ms="2363" status="FAIL">
          <exception class="javax.ws.rs.ProcessingException">
            <message>
              <![CDATA[java.net.ConnectException: Förbindelsen förvägrad (Connection refused)]]>
            </message>
            <full-stacktrace>
              <![CDATA[javax.ws.rs.ProcessingException: java.net.ConnectException: Förbindelsen förvägrad (Connection refused)
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:261)
at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:296)
at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:623)
at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:621)
at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:404)
at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:300)
at com.example.demo.integration.util.DemoClient.get(DemoClient.java:53)
at com.example.demo.integration.util.DemoClient.heartbeat(DemoClient.java:73)
at com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat(EndpointsTest.java:38)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:132)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:599)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:174)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:822)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:147)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Förbindelsen förvägrad (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:367)
at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:259)
... 27 more
]]>
            </full-stacktrace>
          </exception> 
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:56 CEST" name="afterMethod" finished-at="2020-09-26T23:36:56 CEST" duration-ms="8" status="PASS">
          <params>
            <param index="0">
              <value>
                <![CDATA[[TestResult name=testGetHeartbeat status=FAILURE method=EndpointsTest.testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775] output={null}]]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:56 CEST" name="cleanup" finished-at="2020-09-26T23:36:56 CEST" duration-ms="1" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
      </class> 
    </test> 
  </suite> 
</testng-results>
  • Test Result - TestNG 7.1.0 and 7.0.0
<?xml version="1.0" encoding="UTF-8"?>
<testng-results ignored="2" total="3" passed="0" failed="0" skipped="1">
  <reporter-output>
  </reporter-output>
  <suite started-at="2020-09-26T22:12:44 CEST" name="Demo Integration Test Suite" finished-at="2020-09-26T22:12:44 CEST" duration-ms="172">
    <groups>
      <group name="acceptance">
        <method signature="EndpointsTest.testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" name="testGetHeartbeat" class="com.example.demo.integration.suite.EndpointsTest"/>
      </group> 
    </groups>
    <test started-at="2020-09-26T22:12:44 CEST" name="Demo Integration Tests" finished-at="2020-09-26T22:12:44 CEST" duration-ms="172">
      <class name="com.example.demo.integration.suite.EndpointsTest">
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="setupOrgMatching" finished-at="2020-09-26T22:12:44 CEST" duration-ms="17" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="afterMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="2" status="FAIL">
          <params>
            <param index="0">
              <value is-null="true"/>
            </param>
          </params>
          <exception class="java.lang.NullPointerException">
            <full-stacktrace>
              <![CDATA[java.lang.NullPointerException
at com.example.demo.integration.suite.EndpointsTest.afterMethod(EndpointsTest.java:28)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
at org.testng.internal.ConfigInvoker.invokeBeforeGroupsConfigurations(ConfigInvoker.java:142)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:518)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
]]>
            </full-stacktrace>
          </exception> 
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="beforeMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="0" status="FAIL">
          <params>
            <param index="0">
              <value is-null="true"/>
            </param>
          </params>
          <exception class="java.lang.NullPointerException">
            <full-stacktrace>
              <![CDATA[java.lang.NullPointerException
at com.example.demo.integration.suite.EndpointsTest.beforeMethod(EndpointsTest.java:23)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
at org.testng.internal.ConfigInvoker.invokeBeforeGroupsConfigurations(ConfigInvoker.java:142)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:518)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
]]>
            </full-stacktrace>
          </exception> 
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="cleanup" finished-at="2020-09-26T22:12:44 CEST" duration-ms="2" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="beforeMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="26" status="PASS">
          <params>
            <param index="0">
              <value>
                <![CDATA[public void com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat()]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="setupOrgMatching" finished-at="1970-01-01T01:00:00 CET" duration-ms="-1601151164117" status="SKIP">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method signature="testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="testGetHeartbeat" finished-at="2020-09-26T22:12:44 CEST" duration-ms="0" status="SKIP">
          <exception class="java.lang.NullPointerException">
            <full-stacktrace>
              <![CDATA[java.lang.NullPointerException
at com.example.demo.integration.suite.EndpointsTest.afterMethod(EndpointsTest.java:28)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
at org.testng.internal.ConfigInvoker.invokeBeforeGroupsConfigurations(ConfigInvoker.java:142)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:518)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
]]>
            </full-stacktrace>
          </exception> 
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="afterMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="18" status="PASS">
          <params>
            <param index="0">
              <value>
                <![CDATA[[TestResult name={null} status=CREATED method=EndpointsTest.testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c] output={null}]]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="beforeMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="1" status="FAIL">
          <params>
            <param index="0">
              <value is-null="true"/>
            </param>
          </params>
          <exception class="java.lang.NullPointerException">
            <full-stacktrace>
              <![CDATA[java.lang.NullPointerException
at com.example.demo.integration.suite.EndpointsTest.beforeMethod(EndpointsTest.java:23)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
at org.testng.internal.ConfigInvoker.invokeAfterGroupsConfigurations(ConfigInvoker.java:205)
at org.testng.internal.TestInvoker.runAfterGroupsConfigurations(TestInvoker.java:680)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:543)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
]]>
            </full-stacktrace>
          </exception> 
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="cleanup" finished-at="2020-09-26T22:12:44 CEST" duration-ms="3" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="setupOrgMatching" finished-at="1970-01-01T01:00:00 CET" duration-ms="-1601151164174" status="SKIP">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="afterMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="0" status="FAIL">
          <params>
            <param index="0">
              <value is-null="true"/>
            </param>
          </params>
          <exception class="java.lang.NullPointerException">
            <full-stacktrace>
              <![CDATA[java.lang.NullPointerException
at com.example.demo.integration.suite.EndpointsTest.afterMethod(EndpointsTest.java:28)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:63)
at org.testng.internal.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:348)
at org.testng.internal.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:302)
at org.testng.internal.ConfigInvoker.invokeAfterGroupsConfigurations(ConfigInvoker.java:205)
at org.testng.internal.TestInvoker.runAfterGroupsConfigurations(TestInvoker.java:680)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:543)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
]]>
            </full-stacktrace>
          </exception> 
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="cleanup" finished-at="2020-09-26T22:12:44 CEST" duration-ms="4" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
      </class> 
    </test> 
  </suite> 
</testng-results>
  • Test Result - TestNG 6.8.8
<?xml version="1.0" encoding="UTF-8"?>
<testng-results total="1" passed="0" failed="1" skipped="0">
  <reporter-output>
  </reporter-output>
  <suite started-at="2020-09-26T21:03:31Z" name="Demo Integration Test Suite" finished-at="2020-09-26T21:03:33Z" duration-ms="1763">
    <groups>
      <group name="acceptance">
        <method signature="EndpointsTest.testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" name="testGetHeartbeat" class="com.example.demo.integration.suite.EndpointsTest"/>
      </group> 
    </groups>
    <test started-at="2020-09-26T21:03:31Z" name="Demo Integration Tests" finished-at="2020-09-26T21:03:33Z" duration-ms="1763">
      <class name="com.example.demo.integration.suite.EndpointsTest">
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:31Z" name="setupOrgMatching" finished-at="2020-09-26T23:03:31Z" duration-ms="51" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:31Z" name="beforeMethod" finished-at="2020-09-26T23:03:31Z" duration-ms="32" status="PASS">
          <params>
            <param index="0">
              <value>
                <![CDATA[public void com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat()]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method signature="testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:31Z" name="testGetHeartbeat" finished-at="2020-09-26T23:03:33Z" duration-ms="1634" status="FAIL">
          <exception class="javax.ws.rs.ProcessingException">
            <message>
              <![CDATA[java.net.ConnectException: Förbindelsen förvägrad (Connection refused)]]>
            </message>
            <full-stacktrace>
              <![CDATA[javax.ws.rs.ProcessingException: java.net.ConnectException: Förbindelsen förvägrad (Connection refused)
	at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:261)
	at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:296)
	at org.glassfish.jersey.client.JerseyInvocation.lambda$invoke$1(JerseyInvocation.java:623)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:205)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:390)
	at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:621)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:404)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.get(JerseyInvocation.java:300)
	at com.example.demo.integration.util.DemoClient.get(DemoClient.java:53)
	at com.example.demo.integration.util.DemoClient.heartbeat(DemoClient.java:73)
	at com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat(EndpointsTest.java:38)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.net.ConnectException: Förbindelsen förvägrad (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
	at java.base/java.net.Socket.connect(Socket.java:609)
	at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:474)
	at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:569)
	at java.base/sun.net.www.http.HttpClient.<init>(HttpClient.java:242)
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:341)
	at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:362)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1253)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1015)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
	at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
	at org.glassfish.jersey.client.internal.HttpUrlConnector._apply(HttpUrlConnector.java:367)
	at org.glassfish.jersey.client.internal.HttpUrlConnector.apply(HttpUrlConnector.java:259)
	... 25 more
]]>
            </full-stacktrace>
          </exception> 
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:33Z" name="afterMethod" finished-at="2020-09-26T23:03:33Z" duration-ms="3" status="PASS">
          <params>
            <param index="0">
              <value>
                <![CDATA[[TestResult name=testGetHeartbeat status=FAILURE method=EndpointsTest.testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b] output={null}]]]>
              </value>
            </param>
          </params>
          <reporter-output>
          </reporter-output>
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:33Z" name="cleanup" finished-at="2020-09-26T23:03:33Z" duration-ms="4" status="PASS">
          <reporter-output>
          </reporter-output>
        </test-method> 
      </class> 
    </test> 
  </suite> 
</testng-results>
  • Configuration methods executed differently:
<version> 7.3.0</version>
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:54 CEST" name="setupOrgMatching" finished-at="2020-09-26T23:36:54 CEST" duration-ms="11" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:54 CEST" name="beforeMethod" finished-at="2020-09-26T23:36:54 CEST" duration-ms="29" status="PASS">
        </test-method> 
        <test-method signature="testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:54 CEST" name="testGetHeartbeat" finished-at="2020-09-26T23:36:56 CEST" duration-ms="2363" status="FAIL">
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:56 CEST" name="afterMethod" finished-at="2020-09-26T23:36:56 CEST" duration-ms="8" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@f0f2775]" started-at="2020-09-26T23:36:56 CEST" name="cleanup" finished-at="2020-09-26T23:36:56 CEST" duration-ms="1" status="PASS">
        </test-method> 


<version> 7.1.0</version>
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="setupOrgMatching" finished-at="2020-09-26T22:12:44 CEST" duration-ms="17" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="afterMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="2" status="FAIL">
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="beforeMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="0" status="FAIL">
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="cleanup" finished-at="2020-09-26T22:12:44 CEST" duration-ms="2" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="beforeMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="26" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="setupOrgMatching" finished-at="1970-01-01T01:00:00 CET" duration-ms="-1601151164117" status="SKIP">
        </test-method> 
        <test-method signature="testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="testGetHeartbeat" finished-at="2020-09-26T22:12:44 CEST" duration-ms="0" status="SKIP">
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="afterMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="18" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="beforeMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="1" status="FAIL">
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="cleanup" finished-at="2020-09-26T22:12:44 CEST" duration-ms="3" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="setupOrgMatching" finished-at="1970-01-01T01:00:00 CET" duration-ms="-1601151164174" status="SKIP">
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="afterMethod" finished-at="2020-09-26T22:12:44 CEST" duration-ms="0" status="FAIL">
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@6e38921c]" started-at="2020-09-26T22:12:44 CEST" name="cleanup" finished-at="2020-09-26T22:12:44 CEST" duration-ms="4" status="PASS">
        </test-method> 
<version> 6.8.8 </version>
        <test-method is-config="true" signature="setupOrgMatching()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:31Z" name="setupOrgMatching" finished-at="2020-09-26T23:03:31Z" duration-ms="51" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="beforeMethod(java.lang.reflect.Method)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:31Z" name="beforeMethod" finished-at="2020-09-26T23:03:31Z" duration-ms="32" status="PASS">
        </test-method> 
        <test-method signature="testGetHeartbeat()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:31Z" name="testGetHeartbeat" finished-at="2020-09-26T23:03:33Z" duration-ms="1634" status="FAIL">
        </test-method> 
        <test-method is-config="true" signature="afterMethod(org.testng.ITestResult)[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:33Z" name="afterMethod" finished-at="2020-09-26T23:03:33Z" duration-ms="3" status="PASS">
        </test-method> 
        <test-method is-config="true" signature="cleanup()[pri:0, instance:com.example.demo.integration.suite.EndpointsTest@19d481b]" started-at="2020-09-26T23:03:33Z" name="cleanup" finished-at="2020-09-26T23:03:33Z" duration-ms="4" status="PASS">
        </test-method>