Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assure thread affinity #1783

Merged

Conversation

krmahadevan
Copy link
Member

Closes #89, #1050, #1066, #1173, #1185

This PR aims at assuring that methods that fall
under the below two use cases, all run on the
same thread when classes are being run in parallel:

  • @test methods in a class are ordered by priority
  • @test methods have a single dependency on
    another method using “dependsOnMethods” attribute.

The thread affinity feature is supposed to be
“experimental” and it can be turned on via the
JVM argument : -Dtestng.thread.affinity=true

This feature is turned off by default just to
ensure that we don’t have any users experiencing
un-usual behavior.

Fixes #89, #1050, #1066, #1173, #1185

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.

@krmahadevan krmahadevan requested review from cbeust and juherr May 14, 2018 15:17
@krmahadevan
Copy link
Member Author

krmahadevan commented May 14, 2018

@juherr @cbeust - I have tried to implement the approach that I called out #1773 (comment)

@krmahadevan
Copy link
Member Author

@juherr @cbeust - Any idea why Travis CI build doesn't show up on this PR ?

Copy link
Member

@juherr juherr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if all tests pass

@@ -22,4 +22,20 @@
* @return the priority of this task.
*/
int getPriority();

default long getCurrentThreadId() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we don't need default method here because it is located into the internal package

@juherr
Copy link
Member

juherr commented May 14, 2018

No idea why Travis is not working for this specific PR.

@krmahadevan
Copy link
Member Author

Here's the build results for this branch from my fork : https://travis-ci.org/krmahadevan/testng/builds/378773133

Closes testng-team#89, testng-team#1050, testng-team#1066, testng-team#1173, testng-team#1185

This PR aims at assuring that methods that fall
under the below two use cases, all run on the 
same thread when classes are being run in parallel:

* @test methods in a class are ordered by priority
* @test methods have a single dependency on 
another method using “dependsOnMethods” attribute.

The thread affinity feature is supposed to be 
“experimental” and it can be turned on via the
JVM argument : -Dtestng.thread.affinity=true

This feature is turned off by default just to 
ensure that we don’t have any users experiencing
un-usual behavior.
@dr29bart
Copy link
Contributor

The PR worth a minor release at least

@krmahadevan
Copy link
Member Author

@dr29bart - Can you please quickly check if the fix works using TestNG 7.0.0-SNAPSHOT ?
Please remember to use the JVM argument -Dtestng.thread.affinity=true

@ryudice
Copy link

ryudice commented May 19, 2018

hi, Is there someway I can test this without having to compile testng myself and without waiting for a new release? Like a development maven feed

@krmahadevan
Copy link
Member Author

@cbeust - Snapshots aren't being updated to maven snapshot repository. Can you please help take a look ? https://oss.sonatype.org/content/repositories/snapshots/org/testng/testng/7.0.0-SNAPSHOT/

@juherr juherr mentioned this pull request May 28, 2018
dlatsuga added a commit to dlatsuga/project-olymp that referenced this pull request Jul 14, 2018
@robinbobin25
Copy link

Hello! Is there any chance it will be released soon?
Thanks

@juherr
Copy link
Member

juherr commented Aug 29, 2018

@robinbobin25 Not planned yet but you can follow #1862

@balrajHostAnalytics
Copy link

@krmahadevan is -Dtestng.thread.affinity=true fix also covers testng "timeout" with single thread.

@krmahadevan
Copy link
Member Author

krmahadevan commented Nov 15, 2018 via email

@jacksonwen001
Copy link

jacksonwen001 commented Dec 22, 2021

Hi all, Any updates? Does it works? 7.0.0 version?

@krmahadevan
Copy link
Member Author

@jacksonwen001 - What updates are you expecting? The latest released version of TestNG is 7.4.0. Can you please be explicit in terms of what is NOT working (if you are having a problem with this feature) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants