-
Notifications
You must be signed in to change notification settings - Fork 1k
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
NPE is thrown when running with Thread affinity #2110
Comments
Closes testng-team#2110 When there is just one test class and user does the following: 1. Enables thread affinity 2. Chooses to run with parallel=“classes” TestNG is throwing a NPE. Fixed the problem.
Closes testng-team#2110 When there is just one test class and user does the following: 1. Enables thread affinity 2. Chooses to run with parallel=“classes” TestNG is throwing a NPE. Fixed the problem.
Closes #2110 When there is just one test class and user does the following: 1. Enables thread affinity 2. Chooses to run with parallel=“classes” TestNG is throwing a NPE. Fixed the problem.
@krmahadevan Hi, By the way huge respect for doing that. You guys are doing incredible job and both thumbs up. Thanks. |
@mstancl - It would take sometime before the next beta version gets published.
No worries. It was fun fixing this bug :) Learnt some new stuff. |
Hi krmahadevan, I tried to compile the GraphThreadPoolExecutor class from this commit da1fa33 It indeed does not throw the NPE anymore but its not working correctly. I noticed that, when i tried to run xml like this : <suite name="tests" >
<test name="testNG tests" thread-count="50" parallel="classes" >
<classes>
<class name="TestClass2"/>
<class name="TestClass1"/>
</classes>
</test>
</suite> with TestClass1 : public class TestClass1 {
@Test
public void test1() {
System.out.println("TestClass1 - test1. Thread " + Thread.currentThread().getId());
}
@Test
public void test2() {
System.out.println("TestClass1 - test2. Thread " + Thread.currentThread().getId());
}
} and TestClass2 : public class TestClass2 {
@Test()
public void test3() {
System.out.println("TestClass2 - test3. Thread " + Thread.currentThread().getId());
}
@Test(dependsOnMethods = {"test3"})
public void test4() {
System.out.println("TestClass2 - test4. Thread " + Thread.currentThread().getId());
}
@Test(dependsOnMethods = "test4")
public void test5() {
System.out.println("TestClass2 - test5. Thread " + Thread.currentThread().getId());
}
} the output looks like this, which is incorrect :
I noticed it works fine when i run it like this <classes>
<class name="TestClass1"/>
<class name="TestClass2"/>
</classes> instead of <classes>
<class name="TestClass2"/>
<class name="TestClass1"/>
</classes> Is it possible that the numeric order breaks it ? Thank you very much for your answer, Martin |
@mstancl - Were you using the thread affinity enforcing JVM argument ? |
yes i was.
|
@mstancl - I am for now going to be reopening this issue. But I don't know when I will be able to get to this to find out what is going on. |
@krmahadevan thanks. Appreciate this. |
I was able to make a workaround for myself. The XML's have to be provided from A-Z order <test name="Login" >
<classes>
<class name="AnnotationAtest"/>
<class name="AnnotationBtest"/>
<class name="AnnotationCtest"/>
</classes>
</test> or it won't work (threads will be scrambled) if you create the XML programmatically you have to sort the XML the other way around (from Z-A, dont know why) and then it also works. Tried it few times and was able to reproduce the issue when it was not sorted but it was working fine when it was sorted. Cheers, EDIT : If you try to run 2 classes where the 1st has no dependencies while the 2nd has, it works. |
@mstancl - I'm facing the same issue now. Did you figure out any workaround? |
This is now closed via #2368 |
TestNG Version
7.0.0-beta7
Expected behavior
No NPE's should be thrown
Actual behavior
NPE is thrown
Is the issue reproductible on runner?
Test case sample
Issue has been created from this comment
The text was updated successfully, but these errors were encountered: