@@ -27,8 +27,8 @@ public class JUnitTestRunner implements TestListener, IJUnitTestRunner {
27
27
private final ITestObjectFactory m_objectFactory ;
28
28
private final ITestResultNotifier m_parentRunner ;
29
29
30
- private Map <Test , TestRunInfo > m_tests = new WeakHashMap <>();
31
- private List <ITestNGMethod > m_methods = Lists .newArrayList ();
30
+ private final Map <Test , TestRunInfo > m_tests = new WeakHashMap <>();
31
+ private final List <ITestNGMethod > m_methods = Lists .newArrayList ();
32
32
private Collection <IInvokedMethodListener > m_invokedMethodListeners = Lists .newArrayList ();
33
33
34
34
public JUnitTestRunner (ITestObjectFactory objectFactory , ITestResultNotifier tr ) {
@@ -102,9 +102,14 @@ private org.testng.internal.TestResult recordResults(Test test, TestRunInfo tri)
102
102
JUnitTestClass tc = new JUnit3TestClass (test );
103
103
JUnitTestMethod tm = new JUnit3TestMethod (m_objectFactory , tc , test );
104
104
105
+ ITestContext ctx = null ;
106
+ if (m_parentRunner instanceof ITestContext ) {
107
+ ctx = (ITestContext ) m_parentRunner ;
108
+ }
109
+
105
110
org .testng .internal .TestResult tr =
106
111
org .testng .internal .TestResult .newEndTimeAwareTestResult (
107
- tm , null , tri .m_failure , tri .m_start );
112
+ tm , ctx , tri .m_failure , tri .m_start );
108
113
109
114
if (tri .isFailure ()) {
110
115
tr .setStatus (ITestResult .FAILURE );
0 commit comments