forked from ConsoleCatzirl/jenkins-logstash-plugin
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add passing tests and test duration #80
Closed
Closed
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ed3fc46
Add passing tests and test duration
eugene-davis 82c1b7b
Reverted failedTestsWithErrorDetail name
eugene-davis 58233d6
Add testListFill function
eugene-davis 8975d82
Change passedTestWithDetail to passedTestWithErrorDetail for consistency
eugene-davis 685437e
Fix failing test
eugene-davis 069e31c
Set empty List for passedTests when testResultAction is null
eugene-davis 51c51ea
Intermediate version with global setting to disable passing test reco…
eugene-davis 6932b51
Minor corrections to LogstashConfiguration
eugene-davis 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,15 +67,20 @@ public class BuildData { | |
private final static Logger LOGGER = Logger.getLogger(MethodHandles.lookup().lookupClass().getCanonicalName()); | ||
public static class TestData { | ||
private int totalCount, skipCount, failCount, passCount; | ||
private List<FailedTest> failedTestsWithErrorDetail; | ||
private List<ExecutedTest> failedTestsWithErrorDetail; | ||
private List<String> failedTests; | ||
|
||
public static class FailedTest { | ||
private List<ExecutedTest> passedTestsWithErrorDetail; | ||
private List<String> passedTests; | ||
|
||
public static class ExecutedTest { | ||
private final String fullName, errorDetails; | ||
public FailedTest(String fullName, String errorDetails) { | ||
private final float duration; | ||
public ExecutedTest(String fullName, String errorDetails, float duration) { | ||
super(); | ||
this.fullName = fullName; | ||
this.errorDetails = errorDetails; | ||
this.duration = duration; | ||
} | ||
|
||
public String getFullName() | ||
|
@@ -103,6 +108,7 @@ public TestData(Action action) { | |
totalCount = skipCount = failCount = 0; | ||
failedTests = Collections.emptyList(); | ||
failedTestsWithErrorDetail = Collections.emptyList(); | ||
passedTestsWithErrorDetail = Collections.emptyList(); | ||
return; | ||
} | ||
|
||
|
@@ -112,10 +118,18 @@ public TestData(Action action) { | |
passCount = totalCount - skipCount - failCount; | ||
|
||
failedTests = new ArrayList<String>(); | ||
failedTestsWithErrorDetail = new ArrayList<FailedTest>(); | ||
for (TestResult result : testResultAction.getFailedTests()) { | ||
failedTests.add(result.getFullName()); | ||
failedTestsWithErrorDetail.add(new FailedTest(result.getFullName(),result.getErrorDetails())); | ||
failedTestsWithErrorDetail = new ArrayList<ExecutedTest>(); | ||
testListFill((List<TestResult>) testResultAction.getFailedTests(), failedTests, failedTestsWithErrorDetail); | ||
|
||
passedTests = new ArrayList<String>(); | ||
passedTestsWithErrorDetail = new ArrayList<ExecutedTest>(); | ||
testListFill((List<TestResult>) testResultAction.getPassedTests(), passedTests, passedTestsWithErrorDetail); | ||
} | ||
|
||
private void testListFill(List<TestResult> testResults, List<String> testNames, List<ExecutedTest> testDetails) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make the signature of the method |
||
for (TestResult result : testResults) { | ||
testNames.add(result.getFullName()); | ||
testDetails.add(new ExecutedTest(result.getFullName(),result.getErrorDetails(), result.getDuration())); | ||
} | ||
} | ||
|
||
|
@@ -139,11 +153,21 @@ public int getPassCount() | |
return passCount; | ||
} | ||
|
||
public List<FailedTest> getFailedTestsWithErrorDetail() | ||
public List<ExecutedTest> getFailedTestsWithDetail() | ||
{ | ||
return failedTestsWithErrorDetail; | ||
} | ||
|
||
public List<ExecutedTest> getPassedTestsWithDetail() | ||
{ | ||
return passedTestsWithErrorDetail; | ||
} | ||
|
||
public List<String> getPassedTests() | ||
{ | ||
return passedTests; | ||
} | ||
|
||
public List<String> getFailedTests() | ||
{ | ||
return failedTests; | ||
|
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
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.
Is there a smarter way to invoke this function than an unchecked cast?