-
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
Copy test result attributes when unexpected failures #3065
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
testng-core/src/test/java/test/listeners/issue3064/EvidenceListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package test.listeners.issue3064; | ||
|
||
import org.testng.ITestListener; | ||
import org.testng.ITestResult; | ||
|
||
public class EvidenceListener implements ITestListener { | ||
public static final String ATTRIBUTE_KEY = "attributeKey"; | ||
public static ITestResult failureTestResult; | ||
|
||
@Override | ||
public void onTestStart(ITestResult result) { | ||
result.setAttribute(ATTRIBUTE_KEY, "attributeValue"); | ||
} | ||
|
||
@Override | ||
public void onTestFailure(ITestResult result) { | ||
failureTestResult = result; | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
testng-core/src/test/java/test/listeners/issue3064/EvidenceRetryAnalyzer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package test.listeners.issue3064; | ||
|
||
import org.testng.IRetryAnalyzer; | ||
import org.testng.ITestResult; | ||
|
||
public class EvidenceRetryAnalyzer implements IRetryAnalyzer { | ||
|
||
public EvidenceRetryAnalyzer() { | ||
throw new RuntimeException("Failed on purpose"); | ||
} | ||
|
||
@Override | ||
public boolean retry(ITestResult result) { | ||
return false; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
testng-core/src/test/java/test/listeners/issue3064/SampleTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package test.listeners.issue3064; | ||
|
||
import static org.testng.Assert.fail; | ||
|
||
import org.testng.ITestContext; | ||
import org.testng.ITestNGMethod; | ||
import org.testng.Reporter; | ||
import org.testng.annotations.BeforeSuite; | ||
import org.testng.annotations.Listeners; | ||
import org.testng.annotations.Test; | ||
|
||
@Test | ||
@Listeners(EvidenceListener.class) | ||
public class SampleTestCase { | ||
|
||
@BeforeSuite(alwaysRun = true) | ||
public void suiteSetup() { | ||
ITestContext context = Reporter.getCurrentTestResult().getTestContext(); | ||
for (ITestNGMethod method : context.getAllTestMethods()) { | ||
method.setRetryAnalyzerClass(EvidenceRetryAnalyzer.class); | ||
} | ||
} | ||
|
||
@Test | ||
public void testOne() { | ||
fail(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Tip
Codebase Verification
The verification process for the issues mentioned in the CHANGES.txt file for version 7.10.0 reveals the following:
Given this discrepancy with GITHUB-3064, it appears there is an issue with the completeness of the resolution as documented in the CHANGES.txt file for version 7.10.0.
Analysis chain
The summary of changes for version
7.10.0
should be consistent with the project's versioning history and the detailed list of changes provided in the file. Confirm that all mentioned issues (e.g.,GITHUB-3064
,GITHUB-3048
) are accurately resolved in this version.Scripts Executed
The following scripts were executed for the analysis:
Script:
Length of output: 19211