-
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
Make listener finished method work with reverse insertion order #2627
Conversation
testng-core/src/main/java/org/testng/internal/invokers/BaseInvoker.java
Outdated
Show resolved
Hide resolved
testng-core/src/main/java/org/testng/internal/invokers/TestInvoker.java
Outdated
Show resolved
Hide resolved
testng-core/src/main/java/org/testng/junit/JUnitTestRunner.java
Outdated
Show resolved
Hide resolved
0facded
to
4d1b3f1
Compare
comments fixed, pls have a look, thanks! |
4d1b3f1
to
193115a
Compare
@dianny123 - Thanks for taking the time to help raise this PR. Once @juherr takes a quick look and approves, we can get this merged. I believe that @juherr is on a personal time off. So lets wait for him to be back |
@@ -54,7 +55,12 @@ protected void runInvokedMethodListeners( | |||
|
|||
InvokedMethodListenerInvoker invoker = | |||
new InvokedMethodListenerInvoker(listenerMethod, testResult, testResult.getTestContext()); | |||
for (IInvokedMethodListener currentListener : m_invokedMethodListeners) { | |||
boolean isBeforeInvocation = InvokedMethodListenerMethod.BEFORE_INVOCATION == listenerMethod; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment which explains why we have a specific behavior for BEFORE_INVOCATION
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For BEFORE_INVOCATION
method, still run as insert order, but regarding AFTER_INVOCATION
, it should be reverse order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not, but why is it important? How/where can we track the rule?
Could you implement what you describe by replacing isBeforeInvocation
with isAfterInvocation
?
@@ -232,7 +233,12 @@ public FailureContext retryFailed( | |||
} | |||
|
|||
public void runTestResultListener(ITestResult tr) { | |||
TestListenerHelper.runTestListeners(tr, m_notifier.getTestListeners()); | |||
boolean isStarted = tr.getStatus() == ITestResult.STARTED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -87,7 +84,12 @@ public void endTest(Test test) { | |||
|
|||
org.testng.internal.TestResult tr = recordResults(test, tri); | |||
|
|||
TestListenerHelper.runTestListeners(tr, m_parentRunner.getTestListeners()); | |||
boolean isStarted = tr.getStatus() == ITestResult.STARTED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the listener start method and finished method worked with insertion order, this commit changes the finished method worked with reverse order.
193115a
to
7a096c7
Compare
Now the listener start method and finished method worked with insertion
order, this commit changes the finished method worked with reverse
order.
Fixes #2558 .