Comments (6)
Related to #2372
from testng.
@hieuhth - What version of TestNG are you working with ?
I tried using 7.8.0
and I am not able to reproduce the issue. Please try using the latest version and post back your findings
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
...
... TestNG 7.8.0 by Cédric Beust ([email protected])
...
Run FirstTest3 Mon Sep 25 16:58:38 IST 2023
Run FirstTest2 Mon Sep 25 16:58:38 IST 2023
Run FirstTest1 Mon Sep 25 16:58:38 IST 2023
Run SecondTest2 Mon Sep 25 16:58:43 IST 2023
Run SecondTest1 Mon Sep 25 16:58:43 IST 2023
Run SecondTest3 Mon Sep 25 16:58:43 IST 2023
===============================================
Test Suite
Total tests run: 6, Passes: 6, Failures: 0, Skips: 0
===============================================
from testng.
@krmahadevan I use testng 7.8.0.
I have just rechecked, I set JAVA_TOOL_OPTIONS -Dtestng.thread.affinity=true (to resolve a other issue in my project).
If I remove this config, issue will not occur.
How to use this config without issue which I posted?
from testng.
Great. Then i guess we can close this issue @hieuhth ?
from testng.
@krmahadevan I don't think so.
testng.thread.affinity : resort to running dependent methods on the same thread as the upstream method
-> I think we should only resort methods of same class when run parallel by classes, and depend is used.
from testng.
testng.thread.affinity : resort to running dependent methods on the same thread as the upstream method
A couple of things about this feature
- This is an experimental feature.
- This works ONLY when you have EXACTLY 1 upstream method.
-> I think we should only resort methods of same class when run parallel by classes, and depend is used.
I don't think that's possible. It can be done in a limited fashion when you use the above mentioned JVM argument, but this cannot be used as a generalised strategy. I say this because upstream can always be more than 1 method and so its not going to be possible to figure out on which thread to run a dependent method, when it has more than 1 upstream dependencies.
I would suggest that you relook at your tests. Having a thread affinity in tests kind of sounds like a code smell. I am guessing you are resorting to this because you are having some sort of a dependency on a thread local variable. I would suggest that you re-look at your approach and either resort to building customisations that would ensure that the same thread local variable gets copied over to the dependent thread (or) you remove that dependency completely from your test.
The plain vanilla execution of dependsOngroups and parallel running works fine without any issues. The experimental thread affinity feature was never guaranteed to work for all use cases. It was meant to work ONLY for a specific use case, wherein you have a method that depends on exactly 1 upstream. Also the side effects of this behaviour when coupled with other hard ordering features (such as dependsOnGroups) is NOT documented.
from testng.
Related Issues (20)
- How to enable generateTestResultAttributes programatically using Java ? HOT 1
- Should not we use the lock everywhere suiteResult is used? HOT 1
- Associate a unique id with every test class object instantiated by TestNG
- Discrepancy with combination of (Shared Thread pool and Method Interceptor) HOT 1
- IInvokedMethodListener Iinvoked method does not return correct instance during @BeforeMethod, @AfterMethod and @AfterClass
- Please document project's PGP artifact signing keys HOT 2
- Why is my test case not retried but ignored after execution failure? HOT 5
- Possible to merge PR 3067 in 7.9.0 HOT 2
- Super class annotated with ITestNGListenerFactory makes derived test class throw TestNGException on execution HOT 1
- Test cases are being skipped when running in parallel a factory class containing dependent methods HOT 11
- Update from testng 7.9.0 to 7.10.0 break maven build with junit5 HOT 11
- Replacement API for `IClass.getInstanceHashCodes()` and `IClass.getInstances(boolean)` HOT 19
- How come TestNG listeners are global? HOT 3
- Failing while building testng version 7.7.1 using ./gradlew build HOT 3
- ListenerComparator doesn't work HOT 4
- ITestNGListenerFactory is broken and never invoked HOT 3
- can not set custom test method name when using data provider HOT 12
- Update JCommander to 1.83
- [Feature Request] allow multiple groups with AND condition HOT 2
- How to rerun skipped test cases using TestNG? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from testng.