profile
viewpoint
Krishnan Mahadevan krmahadevan @testng-team Bangalore http://rationaleemotions.com/ Yet another "lost soul", in pursuit of being accepted as a "developer"..!

cbeust/testng 1528

TestNG testing framework

krmahadevan/di 3

Examples of how Dependency Injection Containers can be done via different frameworks

krmahadevan/go-design-patterns 1

This repository is intended to just collate my learnings on working with design patterns in golang.

krmahadevan/selenium-1 1

Selenium/Webdriver client for Go

krmahadevan/action-maven-publish 0

📦 GitHub Action for automatically publishing Maven packages

krmahadevan/allure-bamboo 0

Allure plugin for Atlassian Bamboo

krmahadevan/benchmarking 0

A Hello world sort of project to learn JMH

krmahadevan/ggr 0

A lightweight load balancer used to create big Selenium clusters

fork krmahadevan/action-maven-publish

📦 GitHub Action for automatically publishing Maven packages

fork in an hour

push eventRationaleEmotions/JMeter-InfluxDB-Writer

Krishnan Mahadevan

commit sha 371b0eb8ed984b250904e3f78957004db8bdbd73

Next snapshot version

view details

push time in an hour

startedsamuelmeuli/action-maven-publish

started time in 2 hours

push eventRationaleEmotions/JMeter-InfluxDB-Writer

Krishnan Mahadevan

commit sha 0ab34e7ec0d7ae00745969ff14e83b3339a6cb21

Release new version under different group id * Migrated over to Maven * Adding a JVM flag to disable the listener JVM argument : -Djmeter.influxdb.disable * Use GitHub workflows

view details

push time in 2 hours

push eventRationaleEmotions/JMeter-InfluxDB-Writer

Krishnan Mahadevan

commit sha 599d1506aabcb5dc015fa1cf24d011b99628cd53

Release new version under different group id * Migrated over to Maven * Adding a JVM flag to disable the listener JVM argument : -Djmeter.influxdb.disable * Use GitHub workflows

view details

push time in 2 hours

pull request commentcbeust/testng

Warn users when using static configuration methods

@juherr - this PR is to add the warnings as discussed in https://github.com/cbeust/testng/issues/2294#issuecomment-688160294

krmahadevan

comment created time in 15 hours

PR opened cbeust/testng

Warn users when using static configuration methods

Fixes # .

Did you remember to?

  • [ ] Add test case(s)
  • [ ] Update CHANGES.txt

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the TestNG-dev before you spend time working on it.

+9 -0

0 comment

1 changed file

pr created time in 15 hours

create barnchkrmahadevan/testng

branch : static_config_warnings

created branch time in 15 hours

issue commentcbeust/testng

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

@cardonator - I have tried this on JDK11 (with TestNG 7.3.0) and I still am not able to reproduce the NPE that you are experiencing.

krmahadevan@hades:~/githome/demo(master)$ mvn --version
Apache Maven 3.6.3
Maven home: /usr/share/maven
Java version: 11.0.4, vendor: Oracle Corporation, runtime: /home/krmahadevan/jdk-11.0.4
Default locale: en_IN, platform encoding: UTF-8
OS name: "linux", version: "5.4.0-47-generic", arch: "amd64", family: "unix"
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ demo-integration ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
Starting EndpointsTest...
Begin testGetHeartbeat...
End testGetHeartbeat
Finished EndpointsTest in 868 ms
FAILED: testGetHeartbeat
javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused (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: Connection refused (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:591)
	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:1248)
	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:1587)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1515)
	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


===============================================
    Demo Integration Tests
    Tests run: 1, Failures: 1, Skips: 0
===============================================

[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.424 s <<< FAILURE! - in TestSuite
[ERROR] testGetHeartbeat(com.example.demo.integration.suite.EndpointsTest)  Time elapsed: 0.763 s  <<< FAILURE!
javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused (Connection refused)
	at com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat(EndpointsTest.java:38)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat(EndpointsTest.java:38)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   EndpointsTest.testGetHeartbeat:38 » Processing java.net.ConnectException: Conn...
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.393 s
[INFO] Finished at: 2020-09-19T20:14:17+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project demo-integration: There are test failures.
[ERROR]
[ERROR] Please refer to /home/krmahadevan/githome/demo/demo-integration/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
krmahadevan@hades:~/githome/demo(master)$
cardonator

comment created time in a day

pull request commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

@juherr - I identified the review points and fixed them as well. Please take a look and add your comments if there are any.

kobebryant2007

comment created time in a day

PullRequestReviewEvent

pull request commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

@kobebryant2007 - I went ahead and applied the changes that I called out as part of the code review.

kobebryant2007

comment created time in a day

push eventkobebryant2007/testng

Krishnan Mahadevan

commit sha 50dca394cb5fa025857bf1e9f6d027c5fbf04d2a

Fixing Review comments * Wrapped up all the thread affinity tests into one single test class and referred to it in the suite file * Fixed review comments that were identified

view details

push time in a day

push eventkobebryant2007/testng

Krishnan Mahadevan

commit sha e80ae3299850191cfe3cb8280c2346d2dda31943

Fixing Review comments * Wrapped up all the thread affinity tests into one single test class and referred to it in the suite file * Fixed review comments that were identified

view details

push time in a day

Pull request review commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

 private static boolean hasInstance(       ITestNGMethod baseClassMethod, ITestNGMethod derivedClassMethod) {     Object baseInstance = baseClassMethod.getInstance();     Object derivedInstance = derivedClassMethod.getInstance();-    return derivedInstance != null || baseInstance != null;+    boolean result = derivedInstance != null || baseInstance != null;+    boolean params = null != baseClassMethod.getFactoryMethodParamsInfo() && null != derivedClassMethod.getFactoryMethodParamsInfo().getParameters();+    if (result && params && System.getProperty("testng.thread.affinity", "false").equals("true")) {+      return baseClassMethod.getFactoryMethodParamsInfo().getParameters()[0] == derivedClassMethod.getFactoryMethodParamsInfo().getParameters()[0];

Shouldn't we be doing an equality check rather than checking a reference equality ?

kobebryant2007

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

Pull request review commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

 private static boolean hasInstance(       ITestNGMethod baseClassMethod, ITestNGMethod derivedClassMethod) {     Object baseInstance = baseClassMethod.getInstance();     Object derivedInstance = derivedClassMethod.getInstance();-    return derivedInstance != null || baseInstance != null;+    boolean result = derivedInstance != null || baseInstance != null;+    boolean params = null != baseClassMethod.getFactoryMethodParamsInfo() && null != derivedClassMethod.getFactoryMethodParamsInfo().getParameters();+    if (result && params && System.getProperty("testng.thread.affinity", "false").equals("true")) {+      return baseClassMethod.getFactoryMethodParamsInfo().getParameters()[0] == derivedClassMethod.getFactoryMethodParamsInfo().getParameters()[0];+    }+    return result;   }    private static boolean isSameInstance(       ITestNGMethod baseClassMethod, ITestNGMethod derivedClassMethod) {     Object baseInstance = baseClassMethod.getInstance();     Object derivedInstance = derivedClassMethod.getInstance();+    boolean result = derivedInstance != null && baseInstance != null;+    if (result && null != baseClassMethod.getFactoryMethodParamsInfo() && System.getProperty("testng.thread.affinity", "false").equals("true")) {+      return baseInstance.getClass().isAssignableFrom(derivedInstance.getClass()) && baseClassMethod.getFactoryMethodParamsInfo().getParameters()[0] == derivedClassMethod.getFactoryMethodParamsInfo().getParameters()[0];

Shouldn't we be doing an equality check rather than checking a reference equality ?

kobebryant2007

comment created time in 2 days

Pull request review commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

+<?xml version="1.0" encoding="UTF-8"?>

This suite file is not being referred to in the main src/test/resources/testng.xml file

kobebryant2007

comment created time in 2 days

PullRequestReviewEvent

Pull request review commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

+package test.testng2321;++import org.testng.Assert;+import org.testng.annotations.AfterSuite;+import org.testng.annotations.BeforeSuite;+import org.testng.annotations.DataProvider;+import org.testng.annotations.Factory;+import org.testng.annotations.Test;++public class TestMultipleInstance {

Instead of having this as a separate class, can you please have this moved into test.thread.parallelization.issue1773.IssueTest as a test method ? This test class can be invoked by test method in this class and checked for exit status.

kobebryant2007

comment created time in 2 days

Pull request review commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

 private static boolean hasInstance(       ITestNGMethod baseClassMethod, ITestNGMethod derivedClassMethod) {     Object baseInstance = baseClassMethod.getInstance();     Object derivedInstance = derivedClassMethod.getInstance();-    return derivedInstance != null || baseInstance != null;+    boolean result = derivedInstance != null || baseInstance != null;+    boolean params = null != baseClassMethod.getFactoryMethodParamsInfo() && null != derivedClassMethod.getFactoryMethodParamsInfo().getParameters();+    if (result && params && System.getProperty("testng.thread.affinity", "false").equals("true")) {+      return baseClassMethod.getFactoryMethodParamsInfo().getParameters()[0] == derivedClassMethod.getFactoryMethodParamsInfo().getParameters()[0];+    }+    return result;   }    private static boolean isSameInstance(       ITestNGMethod baseClassMethod, ITestNGMethod derivedClassMethod) {     Object baseInstance = baseClassMethod.getInstance();     Object derivedInstance = derivedClassMethod.getInstance();+    boolean result = derivedInstance != null && baseInstance != null;+    if (result && null != baseClassMethod.getFactoryMethodParamsInfo() && System.getProperty("testng.thread.affinity", "false").equals("true")) {

Please use org.testng.internal.RuntimeBehavior#enforceThreadAffinity instead of querying the JVM argument

kobebryant2007

comment created time in 2 days

Pull request review commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

 private static boolean hasInstance(       ITestNGMethod baseClassMethod, ITestNGMethod derivedClassMethod) {     Object baseInstance = baseClassMethod.getInstance();     Object derivedInstance = derivedClassMethod.getInstance();-    return derivedInstance != null || baseInstance != null;+    boolean result = derivedInstance != null || baseInstance != null;+    boolean params = null != baseClassMethod.getFactoryMethodParamsInfo() && null != derivedClassMethod.getFactoryMethodParamsInfo().getParameters();+    if (result && params && System.getProperty("testng.thread.affinity", "false").equals("true")) {

Please use org.testng.internal.RuntimeBehavior#enforceThreadAffinity instead of querying the JVM argument

kobebryant2007

comment created time in 2 days

PullRequestReviewEvent
PullRequestReviewEvent

startedsfakrudeen78/JMeter-InfluxDB-Writer

started time in 3 days

issue commentcbeust/testng

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

@cardonator - Before concluding on the role of JDK11, can you please try once at your side with JDK8 and post back your results ? When I get some time over the weekend, I will try to simulate this issue with JDK11 to see what may be causing this.

cardonator

comment created time in 4 days

issue commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

@kobebryant2007 - Great. Why not raise this as a PR itself (since you have done all the hard work of figuring out all of this stuff) ?

ajmera25

comment created time in 4 days

issue commentcbeust/testng

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

@cardonator - I noticed that your pom says need JDK11. TestNG is not officially yet certified to be compliant with JDK11.

I have JDK8. So I altered the pom file to use JDK8 and also to use TestNG 7.3.0 and here's the output when I ran from command line

So can you try again with JDK8 and post back your results ?

Also if you are running with JDK11, please add verbose=2 in your suite file and see if you can find additional log messages that can hint at the problem.

$ mvn test -Pintegration -pl demo-integration
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.example.demo:demo-integration >------------------
[INFO] Building demo-integration 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ demo-integration ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/user/temp/demo/demo-integration/src/main/resources
[INFO] skip non existing resourceDirectory /Users/user/temp/demo/demo-integration/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ demo-integration ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ demo-integration ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ demo-integration ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M3:test (default-test) @ demo-integration ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
...
... TestNG 7.3.0 by Cédric Beust (cedric@beust.com)
...

Starting EndpointsTest...
Begin testGetHeartbeat...
End testGetHeartbeat
Finished EndpointsTest in 560 ms
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.886 s <<< FAILURE! - in TestSuite
[ERROR] testGetHeartbeat(com.example.demo.integration.suite.EndpointsTest)  Time elapsed: 0.474 s  <<< FAILURE!
javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused (Connection refused)
	at com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat(EndpointsTest.java:38)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at com.example.demo.integration.suite.EndpointsTest.testGetHeartbeat(EndpointsTest.java:38)

[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR]   EndpointsTest.testGetHeartbeat:38 » Processing java.net.ConnectException: Conn...
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.056 s
[INFO] Finished at: 2020-09-16T13:48:10+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project demo-integration: There are test failures.
[ERROR]
cardonator

comment created time in 4 days

issue commentcbeust/testng

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

Here's a much more simpler example that can be used to reproduce the problem.

import java.lang.reflect.Method;
import org.testng.ITestResult;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

@Test(groups = "acceptance")
public class SampleTestCase {

  @BeforeClass
  public void setupOrgMatching() {
    System.err.println("Running @BeforeClass");
  }

  @BeforeMethod(alwaysRun = true)
  public void beforeMethod(Method method) {
    System.err.println("Running @BeforeMethod for " + method.getName());
  }

  @AfterMethod(alwaysRun = true)
  public void afterMethod(ITestResult result) {
    System.err.println("Running @AfterMethod for " + result.getMethod().getQualifiedName());
  }

  @AfterClass(alwaysRun = true)
  public void cleanup() {
    System.err.println("Running @AfterClass");
  }

  @Test
  public void testGetHeartbeat() {
    System.err.println("Running test method testGetHeartbeat()");
  }

  @Test(groups = "fragile")
  public void testGetHeartbeatSkipped() {
    System.err.println("Running test method testGetHeartbeatSkipped()");
  }
}

Suite xml file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="2366_suite" verbose="2">
  <test name="2366_test">
    <groups>
      <run>
        <include name="acceptance"/>
      </run>
    </groups>
    <classes>
      <class name="com.rationaleemotions.github.issue2366.SampleTestCase"/>
    </classes>
  </test>
</suite>

Output

...
... TestNG 7.3.0 by Cédric Beust (cedric@beust.com)
...


Running @BeforeClass
Running @BeforeMethod for testGetHeartbeat
Running test method testGetHeartbeat()
Running @AfterMethod for com.rationaleemotions.github.issue2366.SampleTestCase.testGetHeartbeat
Running @BeforeMethod for testGetHeartbeatSkipped
Running test method testGetHeartbeatSkipped()
Running @AfterMethod for com.rationaleemotions.github.issue2366.SampleTestCase.testGetHeartbeatSkipped


Running @AfterClass

PASSED: testGetHeartbeat
PASSED: testGetHeartbeatSkipped

===============================================
    2366_test
    Tests run: 2, Failures: 0, Skips: 0
===============================================


===============================================
2366_suite
Total tests run: 2, Passes: 2, Failures: 0, Skips: 0
===============================================


Process finished with exit code 0

Analysis

The configuration method is ending up inheriting the groups defined at the class level defined @Test annotation because inheritGroups attribute in @BeforeClass is by default true.

Quoting the java docs

  /**
   * If true, this Configuration method will belong to groups specified in the @Test
   * annotation on the class (if any).
   *
   * @return the value (default true)
   */

I think TestNG is working as designed here in terms of the published behavior.

@cardonator - In your case, you might want to explicitly set @BeforeClass(inheritGroups=false) and try again.

Let me know if that explains the problem and if this can be closed out.

cardonator

comment created time in 5 days

issue commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

@kobebryant2007 - Sure. Please do post back the findings.

ajmera25

comment created time in 10 days

issue commentcbeust/testng

-Dtestng.thread.affinity=true do not work when running multiple instance of test in parallel

@kobebryant2007 - Yep.. I am aware of some issues with this feature. This is another such issue. I am guessing that this feature cannot be applied on a wide scale and perhaps may end up being confined to very specific use cases alone.

This was an experimental feature to begin with. Let me see what can be done on this when I get some time.

ajmera25

comment created time in 10 days

delete branch krmahadevan/testng

delete branch : fix_2363

delete time in 12 days

push eventcbeust/testng

Krishnan Mahadevan

commit sha 64fd9f952a73b8a5e5a7e2bc2e6aeced040cc280

Fixing JS error Closes #2363

view details

Krishnan Mahadevan

commit sha 08c831389a3cd7ba0a4b709ef1d521cb37663e10

Formatting the JS code

view details

push time in 12 days

PR merged cbeust/testng

Fix 2363

Fixes #2363 .

Closes #2363

Did you remember to?

  • [ ] Add test case(s)
  • [X] Update CHANGES.txt

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the TestNG-dev before you spend time working on it.

+68 -68

0 comment

2 changed files

krmahadevan

pr closed time in 12 days

issue closedcbeust/testng

JS error when switching theme

TestNG Version

7.3.0

Expected behavior

Click on the Switch Retro Theme is supposed to change theme.

Actual behavior

But there is JS error: testng-reports2.js:13 Uncaught SyntaxError: Unexpected token 'else'

  else if(cookieValue[1]==='Switch Retro Theme'|| localStorage.getItem('Theme')==='Switch Retro Theme'){
     else if(cookieValue[1]==='Switch Ultra Theme'|| localStorage.getItem('Theme')==='Switch Ultra Theme'){

closed time in 12 days

konikvranik

push eventkrmahadevan/testng

Krishnan Mahadevan

commit sha dbb697f503c3cd2e007609a23864c6c32a40f10c

Streamline honoring of “singleThreaded” attribute Closes #2361

view details

Krishnan Mahadevan

commit sha 632be80859d4929917fc87301326120f07d512b8

Fixing JS error Closes #2363

view details

Krishnan Mahadevan

commit sha 796eed034970ed7355917e3c4548b8e6a158e8af

Formatting the JS code

view details

push time in 12 days

delete branch krmahadevan/testng

delete branch : fix_2361

delete time in 12 days

push eventcbeust/testng

Krishnan Mahadevan

commit sha dbb697f503c3cd2e007609a23864c6c32a40f10c

Streamline honoring of “singleThreaded” attribute Closes #2361

view details

push time in 12 days

PR merged cbeust/testng

Streamline honoring of “singleThreaded” attribute

Closes #2361 Closes #144

Fixes #2361
Fixes #144

Did you remember to?

  • [X] Add test case(s)
  • [X] Update CHANGES.txt

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the TestNG-dev before you spend time working on it.

+126 -6

2 comments

8 changed files

krmahadevan

pr closed time in 12 days

issue closedcbeust/testng

No way to enforce @Test(singleThreaded = true) when test defined in base class

TestNG Version

6.10, 7.3.0

Expected behavior

Methods executed serially

Actual behavior

Tests executed parallel

Is the issue reproductible on runner?

  • [ ] Shell
  • [ ] Maven
  • [ ] Gradle
  • [ ] Ant
  • [ ] Eclipse
  • [x] IntelliJ
  • [ ] NetBeans

Test case sample

@Test(singleThreaded = true)
public abstract class BaseTestClass
{
    private final AtomicInteger currentTests = new AtomicInteger();

    protected void test()
    {
        int currentTests = this.currentTests.incrementAndGet();
        try {
            assertEquals(currentTests, 1);
            MILLISECONDS.sleep(10);
        }
        catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        finally {
            this.currentTests.decrementAndGet();
        }
    }

    @Test
    public void test1()
    {
        test();
    }

    @Test
    public void test2()
    {
        test();
    }

    @Test
    public void test3()
    {
        test();
    }

    @Test
    public void test4()
    {
        test();
    }
}
@Test(singleThreaded = true)
public class TestClass
        extends BaseTestClass
{
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="A Suite" parallel="methods" thread-count="4">
    <test name="A test" parallel="methods" thread-count="4">
        <packages>
            <package name="findepi.test.ng" />
        </packages>
    </test>
</suite>

closed time in 12 days

findepi

issue closedcbeust/testng

@Test(singleThreaded = true) from (abstract) parent class should apply to all childs

I've got @Test(singleThreaded = true) on abstract class and i expect it to be applied to the child class(es) so that each child class can be run in parallel but only with one thread each.

Also when i add @Test(singleThreaded = true) to the child class it don't work either. But when i change testng.xml from

<suite name="Suite" preserve-order="false" parallel="tests">
    <test name="Test" preserve-order="false" parallel="classes">
        <packages>
            <package name="my.package" />
        </packages>
    </test>
</suite>

to

<suite name="Suite" preserve-order="false" parallel="tests">
    <test name="Test" preserve-order="false" parallel="false">
        <packages>
            <package name="my.package" />
        </packages>
    </test>
</suite>

tests pass! Also it's clear from logs (with thread name logging enabled) that test methods from one class are actually run in parallel.

closed time in 12 days

ash2k

PR opened cbeust/testng

Reviewers
Fix 2363

Fixes #2363 .

Closes #2363

Did you remember to?

  • [ ] Add test case(s)
  • [X] Update CHANGES.txt

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the TestNG-dev before you spend time working on it.

+68 -68

0 comment

2 changed files

pr created time in 12 days

create barnchkrmahadevan/testng

branch : fix_2363

created branch time in 12 days

pull request commentcbeust/testng

Streamline honoring of “singleThreaded” attribute

@juherr - I have fixed all the review comments. Can you please take another look ?

krmahadevan

comment created time in 12 days

push eventkrmahadevan/testng

Krishnan Mahadevan

commit sha 42f120ad1ee87fc020d75d48784ede15c439e39e

Streamline honoring of “singleThreaded” attribute Closes #2361

view details

push time in 12 days

issue commentcbeust/testng

tests results html content per test tag in testng xml not as expected after upgrading to testng 7.1.0

@hnestorova - The latest released version of TestNG is 7.3.0. Please retry using that and post back your results

hnestorova

comment created time in 12 days

Pull request review commentcbeust/testng

Streamline honoring of “singleThreaded” attribute

         params = getParameters(im);         prevClass = c;       }-      if (sequentialClasses.contains(c)) {+      if (sequentialClasses.contains(c) || isSame(sequentialClasses, c)) {

sequentialClasses.contains(c) is needed. I moved it into the new method.

krmahadevan

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentcbeust/testng

Streamline honoring of “singleThreaded” attribute

     return result;   } +  private static boolean isSame(Set<Class<?>> sequentialClasses, Class<?> c) {

I renamed the method to shouldRunSequentially() and moved the contains logic into it.

krmahadevan

comment created time in 12 days

PullRequestReviewEvent

Pull request review commentcbeust/testng

Streamline honoring of “singleThreaded” attribute

+package test.thread.issue2361;++import org.testng.annotations.Test;++@Test(singleThreaded = true)+public class ChildClassExample extends BaseTestClassExample {

Fixed

krmahadevan

comment created time in 12 days

PullRequestReviewEvent

pull request commentcbeust/testng

Support DTD redirects when parsing xml files

@KoichiSenada are you sure you are looking at jdk8 javadocs ? Not sure I quite understand what are you hinting at ? If the interface constructs aren't adhered to then compilation would fail no?

Please note that TestNG is officially certified with JDK8. So pls make sure that you are ruling that out.

krmahadevan

comment created time in 12 days

PR opened cbeust/testng

Reviewers
Streamline honoring of “singleThreaded” attribute

Closes #2361

Fixes #2361 .

Did you remember to?

  • [X] Add test case(s)
  • [X] Update CHANGES.txt

We encourage pull requests that:

  • Add new features to TestNG (or)
  • Fix bugs in TestNG

If your pull request involves fixing SonarQube issues then we would suggest that you please discuss this with the TestNG-dev before you spend time working on it.

+83 -1

0 comment

6 changed files

pr created time in 13 days

create barnchkrmahadevan/testng

branch : fix_2361

created branch time in 13 days

issue commentcbeust/testng

No way to enforce @Test(singleThreaded = true) when test defined in base class

Ok.. Hold on.. I think am reading the problem incorrectly

findepi

comment created time in 13 days

issue commentcbeust/testng

No way to enforce @Test(singleThreaded = true) when test defined in base class

@findepi - I am not able to reproduce this at my side. Why don't you attach a maven sample project that I can execute from the command line to reproduce the problem ?

findepi

comment created time in 13 days

IssuesEvent

issue commentcbeust/testng

FAIL "disables loading DTD from unsecured Urls" is reported when XML file need load local files

@gvasanka - If you right click on a TestNG suite xml file that has the https and if you are on TestNG 7.3.0 you will not see this error on IntelliJ.

The only way in which this will come up is when you are right clicking on a individual class and then trying to run it as a TestNG test (In this case IntelliJ ends up creating an on the fly suite xml file, which doesn't have the https in it and hence this error). To fix this permanently only for IntelliJ, you can go ahead and add -Dtestng.dtd.http=true in the default configuration

image

I had sometime back filed a bug in IntelliJ to fix this discrepancy as well https://youtrack.jetbrains.com/issue/IDEA-234765

xirs

comment created time in 13 days

issue closedcbeust/testng

No way to enforce @Test(singleThreaded = true) when test defined in base class

TestNG Version

6.10

Expected behavior

Methods executed serially

Actual behavior

Tests executed parallel

Is the issue reproductible on runner?

  • [ ] Shell
  • [x] Maven
  • [ ] Gradle
  • [ ] Ant
  • [ ] Eclipse
  • [x] IntelliJ
  • [ ] NetBeans

Test case sample

@Test(singleThreaded = true)
public abstract class BaseTestClass
{
    private final AtomicInteger currentTests = new AtomicInteger();

    protected void test()
    {
        int currentTests = this.currentTests.incrementAndGet();
        try {
            assertEquals(currentTests, 1);
            MILLISECONDS.sleep(10);
        }
        catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        finally {
            this.currentTests.decrementAndGet();
        }
    }

    @Test
    public void test1()
    {
        test();
    }

    @Test
    public void test2()
    {
        test();
    }

    @Test
    public void test3()
    {
        test();
    }

    @Test
    public void test4()
    {
        test();
    }
}
@Test(singleThreaded = true)
public class TestClass
        extends BaseTestClass
{
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="A Suite" parallel="methods" thread-count="4">
    <test name="A test" parallel="methods" thread-count="4">
        <packages>
            <package name="findepi.test.ng" />
        </packages>
    </test>
</suite>

closed time in 13 days

findepi

issue commentcbeust/testng

No way to enforce @Test(singleThreaded = true) when test defined in base class

I just now tried this using TestNG 7.3.0 and this works fine without having to add a dummy test method in the child class. Closing this issue. Please comment if you are still facing this as a problem and we can investigate further.

findepi

comment created time in 13 days

issue commentcbeust/testng

No way to enforce @Test(singleThreaded = true) when test defined in base class

@findepi - 6.1 is a really a very old version of TestNG. Can you please try again using 7.3.0 (latest released version of TestNG and post back your experience ?

findepi

comment created time in 13 days

issue commentcbeust/testng

FAIL "disables loading DTD from unsecured Urls" is reported when XML file need load local files

@gvasanka make sure you are on 7.3.0 and add https to your dtd url in suite file. That should suffice.

xirs

comment created time in 13 days

issue commentcbeust/testng

NullPointerException with instance @BeforeClass

@juherr - So the PR for this issue should basically detect static configurations and start logging warning messages against them on the console so that the user is warned. That should suffice right ? I will go ahead and raise a PR for that shortly.

vladimirk

comment created time in 13 days

issue commentcbeust/testng

Exception in IClassListener.onBeforeClass() causes ignore tests instead of fail.

@juherr - Here's my point of view on this.

Listeners are never part of a test per se. They are basically callbacks that TestNG provides to let a user deal with events as and when they occur. Configuration methods on the other hand are part of the test, because they perform some sort of a setup that is needed by the Test.

So failures in configurations should affect the tests and TestNG should handle them to translate them into the next set of actions to be done on the test (Skip the test for e.g.,)

Listeners on the other hand are callbacks. They shouldn't be throwing exceptions in the first place. So why should TestNG handle them and have their exceptions affect the outcome of the tests?

We can either gobble all exceptions and just warn the user (which kind of makes it impossible for the user to put a recovery mechanism on their side, or we can explicitly document that listeners if they throw exceptions will abort the tests.

Its similar to our reporting listener (IReporter implementation) throwing an exception and that causing the tests to fail (right now it doesn't happen coz the listener gets invoked later). But I hope that analog explains my point.

Summarising: TestNG is working as designed here. Listeners are not expected to throw exceptions. They either deal with the exceptions or TestNG aborts execution.

@cbeust - Your thoughts ?

mechanik0s

comment created time in 14 days

issue commentcbeust/testng

NullPointerException with instance @BeforeClass

@juherr @cbeust - So what is the consensus on this? Does this need to be fixed (If yes, what is the nature of the fix?) ? If not, can we close this off ?

vladimirk

comment created time in 14 days

issue commentcbeust/testng

Exception in IClassListener.onBeforeClass() causes ignore tests instead of fail.

@juherr - How do you suggest that we handle this? Currently TestNG doesn't handle any exceptions from any listeners. So the onus is on the listeners to ensure that they dont throw any exceptions. In this case, the listener throws an exception and so further execution gets halted since we dont move forward. I am in for closing this issue with resolution as working as designed

mechanik0s

comment created time in 14 days

issue closedcbeust/testng

@BeforeXXX and @AfterXXX Do Not Execute In Expected Order

TestNG Version

7.1.0

Expected behavior

@BeforeXXX and @AfterXXX annotated methods should be executed in correct order (i.e. same order they were executed in version 6.14.3).

beforeTest beforeClass beforeMethod testMethod1 afterMethod beforeMethod testMethod2 afterMethod beforeMethod testMethod3 afterMethod afterClass afterTest

Actual behavior

@BeforeXXX and @AfterXXX annotated methods are not executed in correct order. See sample below and attachment with working example of both 6.14.3 working correctly and 7.1.0 working incorrectly.

beforeTest beforeClass afterClass afterMethod afterTest beforeClass beforeMethod beforeTest beforeMethod testMethod1 afterMethod beforeMethod testMethod2 afterMethod beforeMethod testMethod3 afterMethod afterTest afterClass afterMethod beforeTest beforeClass beforeMethod afterClass afterTest

Is the issue reproductible on runner?

  • [ X] Shell
  • [ ] Maven
  • [ ] Gradle
  • [ ] Ant
  • [ ] Eclipse
  • [ ] IntelliJ
  • [ ] NetBeans

Test case sample

@Test(groups = "group1")
public class Test1 {
    @BeforeClass
    public void beforeClass() {
        System.out.println("beforeClass");
    }

    @BeforeTest
    public void beforeTest() {
        System.out.println("beforeTest");
    }

    @BeforeMethod
    public void beforeMethod() {
        System.out.println("beforeMethod");
    }

    public void testMethod1() {
        System.out.println("testMethod1");
    }

    public void testMethod2() {
        System.out.println("testMethod2");
    }

    public void testMethod3() {
        System.out.println("testMethod3");
    }

    @AfterMethod
    public void afterMethod() {
        System.out.println("afterMethod");
    }

    @AfterTest
    public void afterTest() {
        System.out.println("afterTest");
    }

    @AfterClass
    public void afterClass() {
        System.out.println("afterClass");
    }
}
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1">
    <test name="Test1">
        <groups>
            <run>
                <include name="group1"/>
            </run>
        </groups>
        <classes>
            <class name="com.test.Test1"/>
        </classes>
    </test>
</suite>

testTestNgBeforeAfter.zip

closed time in 15 days

staley-robert

issue commentcbeust/testng

@BeforeXXX and @AfterXXX Do Not Execute In Expected Order

This issue is fixed in TestNG 7.3.0 which was recently released.

package com.rationaleemotions.github.issue2330;

import java.lang.reflect.Method;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

@Test(groups = "group1")
public class SampleTestClass {
  @BeforeClass
  public void beforeClass() {
    System.out.println("beforeClass");
  }

  @BeforeTest
  public void beforeTest() {
    System.out.println("beforeTest");
  }

  @BeforeMethod
  public void beforeMethod(Method method) {
    System.out.println("beforeMethod ---> " + method.getName());
  }

  public void testMethod1() {
    System.out.println("testMethod1");
  }

  public void testMethod2() {
    System.out.println("testMethod2");
  }

  public void testMethod3() {
    System.out.println("testMethod3");
  }

  @AfterMethod
  public void afterMethod(Method method) {
    System.out.println("afterMethod ---> " + method.getName());
  }

  @AfterTest
  public void afterTest() {
    System.out.println("afterTest");
  }

  @AfterClass
  public void afterClass() {
    System.out.println("afterClass");
  }
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="2330_suite" verbose="2">
  <test name="2330_test" verbose="2">
    <groups>
      <run>
        <include name="group1"/>
      </run>
    </groups>
    <classes>
      <class name="com.rationaleemotions.github.issue2330.SampleTestClass"/>
    </classes>
  </test>
</suite>

Here's the execution output from 7.3.0

...
... TestNG 7.3.0 by Cédric Beust (cedric@beust.com)
...

beforeTest
beforeClass
beforeMethod ---> testMethod1
testMethod1
afterMethod ---> testMethod1
beforeMethod ---> testMethod2
testMethod2
afterMethod ---> testMethod2
beforeMethod ---> testMethod3
testMethod3
afterMethod ---> testMethod3
afterClass
afterTest

PASSED: testMethod1
PASSED: testMethod2
PASSED: testMethod3

===============================================
    2330_test
    Tests run: 3, Failures: 0, Skips: 0
===============================================


===============================================
2330_suite
Total tests run: 3, Passes: 3, Failures: 0, Skips: 0
===============================================

Process finished with exit code 0
staley-robert

comment created time in 15 days

issue closedcbeust/testng

Skipping of all further tests and before-method configs if one @BeforeMethod failed

TestNG Version: 7.1.0

Expected behavior

If one @BeforeMethod failed then skip only test it is applied for. Next time this configuration method will run and make an attempt to make config for the next test method.

Actual behavior

If @BeforeMethod fails then all the methods after it will be skipped.

Is the issue reproductible on runner?

  • [ ] Shell
  • [X] Maven
  • [X] Gradle
  • [ ] Ant
  • [ ] Eclipse
  • [X] IntelliJ
  • [ ] NetBeans

Test case sample

public class TestClass {

    @BeforeMethod
    public void beforeMethod(Method method) {
        if (method.getName().endsWith("test1")) {
            throw new RuntimeException("fail imitation");
        }
    }

    @Test
    public void test1() {
    }

    @Test
    public void test2() { // this method will be skipped as well as execution of beforemethod for it
    }
}

closed time in 15 days

Maksym-Skrypchenko

issue commentcbeust/testng

Skipping of all further tests and before-method configs if one @BeforeMethod failed

@Maksym-Skrypchenko - TestNG is working as designed.

When you run a Test from within IDE, TestNG resorts to the configuration failure policy of skip (This is the default value that gets set, when the IDE creates an on the fly suite xml file).

If you would like TestNG to continue running configurations, then you should create a suite xml file and then explicitly set the configuration failure policy to continue

Below is an example of one such suite file.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="336_Suite-MySuite-InVM" parallel="false" configfailurepolicy="continue">
    <test name="336_test_1">
        <classes>
            <class name="com.rationaleemotions.github.issue2345.TestClass"/>
        </classes>
    </test>
</suite>

Closing this issue with resolution as question answered

Maksym-Skrypchenko

comment created time in 15 days

issue commentcbeust/testng

Groovy 3 Unit Test Class: TestNGException at Parameters.java:437

@juherr - we dont have any tests breaking as part of our build. I think the problem comes only when we move to groovy 3.

ctzen

comment created time in 16 days

issue commentcbeust/testng

FAIL "disables loading DTD from unsecured Urls" is reported when XML file need load local files

@Satyabrata4957 JVM arguments should begin with -D. Please set the JVM argument properly

xirs

comment created time in 17 days

issue commentcbeust/testng

Groovy 3 Unit Test Class: TestNGException at Parameters.java:437

@ctzen - You kind of explained the problem in a very clear way. Thank you so much. Now I understand the issue.

@juherr @cbeust - What are your thoughts on how to go about fixing this?

ctzen

comment created time in 18 days

issue commentcbeust/testng

Cannot inject @Test annotated Method [main] with [class [Ljava.lang.String;].

@umeshkarkar - Please use the Google forums (https://groups.google.com/forum/#!pendingmsg/testng-users) or stackoverflow to seek help on user issues for TestNG. WE would like to confine the issues page to tracking actual TestNG bugs or new features.

So I would suggest that you post on either of these two forums with a simple full fledged example that can be used to reproduce the problem and someone in the forum should be able to help you out. Dont forget to use the latest released version of TestNG viz., 7.3.0

ben-manes

comment created time in 18 days

issue commentcbeust/testng

TestNG 7.3.0 breaks AssertJ assumeThat

@C-Otto - Can we close this issue since its now taken care of at AssertJ side ?

C-Otto

comment created time in 18 days

issue commentcbeust/testng

Groovy 3 Unit Test Class: TestNGException at Parameters.java:437

@ctzen - Can you please help me understand what is expected from TestNG in this case ? I am not that familiar with Groovy.

ctzen

comment created time in 18 days

issue commentcbeust/testng

Cannot inject @Test annotated Method [main] with [class [Ljava.lang.String;].

@umeshkarkar the exception clearly gives you a link that you can consider referring to understand how to get past the problem.

You have a test method that is accepting a string parameter but you have neither used a data provider nor used the @Parameter annotation.

TestNG is working fine.

ben-manes

comment created time in 18 days

issue commentcbeust/testng

TestNG 7.3.0 breaks AssertJ assumeThat

@juherr @cbeust - The link https://github.com/ota4j-team/opentest4j#projects-already-contacted says TestNG has been contacted regarding this. Are you folks aware of this ?

I don't recall seeing any mail on this on the TestNG dev users list.

@scordio - Maybe you can create a PR (so the technical work related to moving towards this would be done), but we need to get a confirmation from @cbeust on what the plans are for this.

@juherr - WDYT ?

C-Otto

comment created time in 25 days

issue commentcbeust/testng

TestNG 7.3.0 breaks AssertJ assumeThat

@scordio - I am not sure if TestNG would be going through with a release soon. We just got 7.3.0 released.

@cbeust @juherr - Your thoughts ?

C-Otto

comment created time in 25 days

push eventcbeust/testng

Slawomir Jaranowski

commit sha 1c6cd894a550a64f231c29b288b41d280345263c

Exposed only needed dependencies Additional dependencies will be exposed as gradle feature or maven optional. fix: #2357

view details

push time in 25 days

PR merged cbeust/testng

Reviewers
Exposed only needed dependencies

Additional dependencies will be exposed as gradle feature or maven optional.

Fixes #2357

Did you remember to?

  • [ ] Add test case(s)
  • [x] Update CHANGES.txt

We encourage pull requests that:

  • Fix bugs in TestNG
+39 -5

4 comments

2 changed files

slawekjaranowski

pr closed time in 25 days

issue closedcbeust/testng

TestNG 7.3.0 transitive dependencies

TestNG Version

7.3.0

Expected behavior

Minimum count of transitive dependency, only ones that are needed to run simply tests.

Actual behavior

[INFO] +- org.testng:testng:jar:7.3.0:test
[INFO] |  +- com.beust:jcommander:jar:1.78:test
[INFO] |  +- org.apache.ant:ant:jar:1.10.3:test
[INFO] |  |  \- org.apache.ant:ant-launcher:jar:1.10.3:test
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- com.google.inject:guice:jar:no_aop:4.2.2:test
[INFO] |  |  +- javax.inject:javax.inject:jar:1:test
[INFO] |  |  +- aopalliance:aopalliance:jar:1.0:test
[INFO] |  |  \- com.google.guava:guava:jar:25.1-android:test
[INFO] |  |     +- com.google.code.findbugs:jsr305:jar:3.0.2:test
[INFO] |  |     +- org.checkerframework:checker-compat-qual:jar:2.0.0:test
[INFO] |  |     +- com.google.errorprone:error_prone_annotations:jar:2.1.3:test
[INFO] |  |     +- com.google.j2objc:j2objc-annotations:jar:1.1:test
[INFO] |  |     \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:test
[INFO] |  \- org.yaml:snakeyaml:jar:1.21:test

For version 7.1.0 we had:

[INFO] +- org.testng:testng:jar:7.1.0:test
[INFO] |  +- com.beust:jcommander:jar:1.72:test
[INFO] |  +- com.google.inject:guice:jar:no_aop:4.1.0:test
[INFO] |  |  +- javax.inject:javax.inject:jar:1:test
[INFO] |  |  +- aopalliance:aopalliance:jar:1.0:test
[INFO] |  |  \- com.google.guava:guava:jar:19.0:test
[INFO] |  \- org.yaml:snakeyaml:jar:1.21:test

Currently for running simply tests we need:

[INFO] +- org.testng:testng:jar:7.3.0:test
[INFO] |  \- com.beust:jcommander:jar:1.78:test

All additional dependency should be optional, at page https://testng.org/doc/documentation-main.html#yaml we can read:

TestNG by default does not bring in the YAML related library into your classpath ...

so currents behavior is in oposite to documentation.

Propagating too many dependencies may cause some problem in software using TestNG like: #2352

closed time in 25 days

slawekjaranowski

issue commentcbeust/testng

Testng @BeforeGroups is running in parallel with testcases in the group

@DAWadehra2020 - Yes please. Literal form is not going to help because we wouldn't be able to translate it to an exact class that can simulate the problem.

So please skin your classes (remove everything except for core java apis) and include the sample here.

Also please retry using 7.3.0 before that. We cannot fix a bug in 6.14.3.

DAWadehra2020

comment created time in a month

issue commentcbeust/testng

Testng @BeforeGroups is running in parallel with testcases in the group

@DAWadehra2020

I don't know what made you think that i looking for suggestion.

For the simple reason that your bug report is missing the basic essentials (A simple standalone example that can be used to reproduce the problem). So I had to conveniently assume that you were looking for help and by mistake ended up logging it here rather than posting it as a question in the forums.

So please try the following and if the problem persists, attach a simple standalone example that we can use to reproduce the issue.

  1. The latest released version of TestNG is 7.3.0 (You are using 6.14.3). So upgrade and try again.
  2. If the problem persists, attach a sample. We can get this re-opened.

But without a sample, there's no point in opening/re-opening the defect. Its not going to get the attention it warrants.

Does that add clarity ?

DAWadehra2020

comment created time in a month

pull request commentcbeust/testng

Exposed only needed dependencies

@slawekjaranowski - We seem to be having tests failing. Can you please quickly take a look ?

slawekjaranowski

comment created time in a month

issue commentcbeust/testng

Default Method @Test Inheritance and Mixin Pattern

@slawekjaranowski - I quickly wrote up a sample that looks like below and it works with TestNG 7.3.0.

public interface MySampleInterface {

  default void helloWorld() {
    System.err.println("Hello World");
  }
}
import org.testng.annotations.Test;

@Test
public class MyTest implements MySampleInterface {

  public void byeWorld() {
    System.err.println("Bye World");
  }

}

When I run this, I see TestNG execute both the tests methods.

@juherr - Is this good enough to close this issue out ?

tjni

comment created time in a month

issue closedcbeust/testng

Testng @BeforeGroups runs in parallel with testcase in the group

I have 2 test classes TC1 & TC2, which extends to GroupClass. Group class contains the @BeforeGroups beforgrp method. my suite xml has these classes with following suite settings parallel="methods" thread-count="5"

now when I run the suite. 4 test methods from class TC1 & TC2 runs along with beforgrp method simultaneously.

but ideally Test case execution should have started after the execution beforgrp method.

TestNg version used is 6.14.3

closed time in a month

DAWadehra2020

issue commentcbeust/testng

Testng @BeforeGroups runs in parallel with testcase in the group

@DAWadehra2020 - There's nothing in this issue that suggests that there's some problem with TestNG. It looks like you are trying to get an answer to your question.

Please use the TestNG google forums for asking questions. We would like to restrict the issue tracker for actual defects/enhancements and not for answering queries.

Post your queries here: https://groups.google.com/g/testng-users

DAWadehra2020

comment created time in a month

issue commentcbeust/testng

Default Method @Test Inheritance and Mixin Pattern

@slawekjaranowski - Sure. Can you help share what would your expectations be from TestNG as part of getting this issue addressed? I am not sure if we still know what should be the outcome of this. Perhaps you could share some examples etc., that will make the requirement a bit more clearer.

tjni

comment created time in a month

issue commentcbeust/testng

StringIndexOutOfBoundsException in findClassesInPackage - Surefire/Maven - JDK 11 fails, JDK 8 succeeds.

@Randgalt - I don't have a definitive timeline that I can share with you. But TestNG needs to keep in account backward compatibility when we do such upgrades. The upgrade from JDK7 to JDK8 being the Default JDK itself took a lot of time (because a lot of our users still use older JDKs and upgrading TestNG to a newer JDK essentially means that we cause problems for them).

@cbeust @juherr please weigh in.

john-snell

comment created time in a month

issue commentcbeust/testng

There was an error in the forked process

@chitrapriya-cloud - The problem lies in your suite file

Please fix the error

[ERROR] org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 13; Attribute "class-name" is required and must be specified for element type "listener".
maxymshg

comment created time in a month

issue commentcbeust/testng

throwing SkipException sets iTestResult status to Failure instead of Skip

@klubi - Do you have a sample that you can share so that we can investigate on this ?

xlenz

comment created time in a month

issue commentcbeust/testng

throwing SkipException sets iTestResult status to Failure instead of Skip

@klubi - Are you seeing this not working in 7.3.0 ? This version has been released.

xlenz

comment created time in a month

issue closedcbeust/testng

Unit test loads spring resources

TestNG Version

Note: only the latest version is supported

At present, unit test is the collection mode of @ springboottest and TestNG. However, every time a unit test is started, it will have to load resources (various configuration files, initialize spring containers, and establish various connections), which is very time-consuming.

Question:

1: Do you have a solution to support unit testing that can reuse the last resource? Or give us some advice

2: Do you know that other enterprises have solved such problems?

To achieve this goal, our idea is:

Start the container first, and then request to start the service when executing MVN test. This can solve the problem of multiple loading of resources. However, this approach is actually equivalent to the interface request server, which is different from the TestNG implementation. There are many changes to be made, and it should be compatible with the previous TestNG rollback and other functions, so I don't know whether this design idea is feasible?

closed time in a month

wjx1990323

issue commentcbeust/testng

Unit test loads spring resources

Closing this issue since no further action is needed from TestNG side.

wjx1990323

comment created time in a month

startedsfakrudeen/AllureToAzure

started time in a month

issue closedcbeust/testng

TestNG 7.3.0 Causes build failure "TestNG by default disables loading DTD from unsecured Urls"

TestNG Version

7.3.0 Working fine on 7.1.0

Expected behavior

Using mvn clean install, build is successful

Actual behavior

Build failure TestNG by default disables loading DTD from unsecured Urls. If you need to explicitly load the DTD from a http url, please do so by using the JVM argument [-Dtestng.dtd.http=true]

Is the issue reproductible on runner?

  • [ ] Shell
  • [x] Maven
  • [ ] Gradle
  • [ ] Ant
  • [ ] Eclipse
  • [ ] IntelliJ
  • [ ] NetBeans

Test case sample

<dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
			<version>7.3.0</version>
		</dependency>

Changing it back to 7.1.0 fixes the problem

My suites:

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Sanity Runner">
	<groups>
		<run>
			<include name="sanity" />
			<exclude name="not-finished" />
			<exclude name="real-device" />
			<exclude name="qa-env" />
		</run>
	</groups>
	<suite-files>
		<suite-file path="module-suites/authentication-suite.xml"></suite-file>
	</suite-files>
</suite>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Authentication Suite" >
	<test name="Sign In Tests" >
		<classes>
			<class name="SignInTests" />
		</classes>
	</test>
</suite>

closed time in a month

QAthulhu

issue commentcbeust/testng

TestNG 7.3.0 Causes build failure "TestNG by default disables loading DTD from unsecured Urls"

@QAthulhu - There's nothing that can be done.

You need to follow one of the recommendations.

  1. Either change "http://testng.org/testng-1.0.dtd" to "https://testng.org/testng-1.0.dtd"in your suite file (or)
  2. Use the JVM argument -Dtestng.dtd.http=true when running your tests.

This behavior will not be reverted back.

QAthulhu

comment created time in a month

more