TestNG 7.0 - Released !

3,608 views
Skip to first unread message

Krishnan Mahadevan

unread,
Aug 19, 2019, 10:38:42 PM8/19/19
to testng...@googlegroups.com

Hello everyone!

We are pleased to announce the availability of TestNG 7.0!

This new major version introduces a few breaking changes with the previous versions, the most important one being that JDK 8 is now a requirement to run TestNG.

TestNG 7 is available for download on Maven Central and JCenter.

 

Special thanks go to Julien Herr for continuing with all the hard work on TestNG, and of course, to all the other contributors who made this release possible.

Here is a more detailed list of the new features and most important fixes follows:

  • Minimum JDK requirement is now JDK8.

TestNG has now moved over to using JDK8 as its minimum JDK needs.

  • Guarantee thread affinity for soft ordering via preserve-order attribute in suite xml file (or) via dependsOnMethods attribute in @Test annotation.

When you enforce ordering of tests either via preserve-order or via dependsOnMethods, you can now have TestNG to adhere to using the same thread by setting the JVM argument -Dtestng.thread.affinity=true

  • Ability to quickly count @Test method that were retried.

TestNG default reports now explicitly call out test methods that were retried.

  • Support graphical visualisation of test dependencies in real-time.

TestNG now lets you leverage graphical visualisation tools such as Graphviz for building visualisation that represent test execution in real-time by letting you wire in implementations of the TestNG listener org.testng.IExecutionVisualiser

  • What caused my test method to skip ?

TestNG now adds contextual information into what configuration method (or) an upstream test failure resulted in the current test method being skipped by querying iTestResult.getSkipCausedBy() [ here iTestResult is of type org.testng.ITestResult and represents the execution result of either a config method or a test method ]

  • Access the data provider method’s information from a @Test method which is data driven.

TestNG now lets you get access to a data provider method that is referenced via the dataProvider (or) dataProviderClass attributes of the @Test method via iTestResult.getMethod().getDataProviderMethod()[ here iTestResult is of type org.testng.ITestResult and represents the execution result of a data driven test method ]

  • Support reading data provider information from Class level @Testannotation

You can now define a data provider at the class level @Test and also add specifics of a test method by specifying a @Test at method level and TestNG will merge both and run your test as a data driven test.

  • Support injection of Customized ThreadPoolExecutor implementation into TestNG

If at all you have a use case wherein you would like to work with a customized threadpool executor which TestNG should use, you can now do it by implementing the interface org.testng.thread.IExecutorFactory and then plugging it into TestNG via one of the below mechanisms:

·         If using the TestNG API, then the implementation should be hooked into TestNG via

§  tng.setExecutorFactory() (or)

§  tng.setExecutorFactoryClass()

·         If using a build tool, for e.g., Maven, then pass in a classname via the property

       <property>

          <name>threadpoolfactoryclass</name>

          <value>fully.qualified.class.name.goes.here</value>

        </property>

·         If using the TestNG CLI, then the fully qualified class name that implements the IExecutorFactory interface can be passed via -threadpoolfactoryclass

  • More efficient test ordering 

TestNG now employs more efficient algorithms to deal with test ordering before execution so that your tests run faster and there are no hanging of JVM when working with a decently large test set.

  • Support native injection in factory methods.

TestNG now natively injects instance of org.testng.ITestContext (or) org.testng.xml.XmlTest into your Factory method so that you can get access to the current <test> context.

  • Be notified on tests that fail due to timeouts.

TestNG now lets you be notified when a test fails due to time-out via a new method onTestFailedWithTimeout() within the listener interface org.testng.ITestListener

  • Implement only what you want to customize when building TestNG listeners.

When implementing a TestNG listener by implementing the corresponding interfaces, you now no longer need to add empty implementations to all other methods in the same interface which you dont want to tweak. You can now instead just implement only your customization. For e.g.,

public class MyListener implements ITestListener {

 

    @Override

    public void onTestSuccess(ITestResult result) {

        System.out.println("Test passed");

    }

}

  • Load DTDs only from secure end-points.

TestNG now by default will ONLY load dtd definition in your suite xml from a secure end-point (if the DTD is not found locally). If you use a http end-point, you will see TestNG throwing an error. You can disable this behavior by setting the JVM argument: -Dtestng.dtd.http=true

  • And we have squashed a lot of bugs.

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.com/

Giorgio Vespucci

unread,
Aug 20, 2019, 8:16:52 AM8/20/19
to testng...@googlegroups.com
Hi Krishnan
I cannot find any evidence of this on https://testng.org.
I'd like to have some links to share with my developers' community.
Thank you very much.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/46EE21EA-FC16-4019-B0F9-71676E4B19E6%40gmail.com.


--

Cédric Beust ♔

unread,
Aug 20, 2019, 1:02:19 PM8/20/19
to testng...@googlegroups.com
Hi Giorgio,

I just updated the version number on https://testng.org.

-- 
Cédric



Sivakumar Devakumar

unread,
Dec 2, 2019, 6:37:52 AM12/2/19
to testng-users
I am not able to access TestNG site or any of Mr.Beust's website. 


On Tuesday, August 20, 2019 at 1:02:19 PM UTC-4, Cédric Beust ♔ wrote:
Hi Giorgio,

I just updated the version number on https://testng.org.

-- 
Cédric



On Tue, Aug 20, 2019 at 5:16 AM Giorgio Vespucci <giorgio...@gmail.com> wrote:
Hi Krishnan
I cannot find any evidence of this on https://testng.org.
I'd like to have some links to share with my developers' community.
Thank you very much.

To unsubscribe from this group and stop receiving emails from it, send an email to testng...@googlegroups.com.


--

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng...@googlegroups.com.

Darius Cooper

unread,
May 26, 2021, 3:20:29 PM5/26/21
to testng-users

 >> TestNG 7.0! ...  a few breaking changes ... the most important one being that JDK 8 ...

Other than JDK8, what are the top few gotchas to look out for, in terms of breaking changes in 7.x ?

We have about 60 microservices, all using TestNg   6.11, and all on JDK8. Never migrated before because we don;t know if we need the new features. But, we would like to be on the latest major version, all the same.

Is there a page somewhere that would indicate other breaking changes? If not... if anyone knows any that are top-of-mind, that will be useful too.

thanks

- Darius

Vladimir Sitnikov

unread,
May 27, 2021, 12:31:57 PM5/27/21
to testng-users
I updated 5.14 -> 6.8.8 -> 7.0.0 -> 7.3.0 recently, and my key surprise was that @Listener above the class was triggered for all the classes in the suite rather than for a specific class. I am not sure if the behavior was always like that, but I noticed it during 7.0 -> 7.3 upgrade.

All the rest was smooth, so there was nothing to update and my tests just worked.

⇜Krishnan Mahadevan⇝

unread,
May 28, 2021, 1:59:16 AM5/28/21
to testng-users
AFAIK, there's no concept of listeners specific to test classes. Irrespective of how a listener gets wired in, its always global (atleast thats how i remember it to work)

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribblings @ https://rationaleemotions.com/


On Thu, May 27, 2021 at 10:02 PM Vladimir Sitnikov <sitnikov...@gmail.com> wrote:
I updated 5.14 -> 6.8.8 -> 7.0.0 -> 7.3.0 recently, and my key surprise was that @Listener above the class was triggered for all the classes in the suite rather than for a specific class. I am not sure if the behavior was always like that, but I noticed it during 7.0 -> 7.3 upgrade.

All the rest was smooth, so there was nothing to update and my tests just worked.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/22ba2126-b6b2-4d4e-a51f-db2a67d4300fn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages