-
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
Changes from 7 commits
ed3fc46
82c1b7b
58233d6
8975d82
685437e
069e31c
51c51ea
6932b51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,7 @@ public class LogstashConfiguration extends GlobalConfiguration | |
private Boolean enabled; | ||
private boolean dataMigrated = false; | ||
private boolean enableGlobally = false; | ||
private boolean recordingPassingTests = false; | ||
private boolean milliSecondTimestamps = true; | ||
private transient LogstashIndexer<?> activeIndexer; | ||
|
||
|
@@ -82,6 +83,16 @@ public void setEnableGlobally(boolean enableGlobally) | |
this.enableGlobally = enableGlobally; | ||
} | ||
|
||
public void setrecordingPassingTests(boolean recordingPassingTests) | ||
{ | ||
this.recordingPassingTests = recordingPassingTests; | ||
} | ||
|
||
public boolean isrecordingPassingTests() | ||
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. camel case |
||
{ | ||
return recordingPassingTests; | ||
} | ||
|
||
public boolean isMilliSecondTimestamps() | ||
{ | ||
return milliSecondTimestamps; | ||
|
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,8 @@ public TestData(Action action) { | |
totalCount = skipCount = failCount = 0; | ||
failedTests = Collections.emptyList(); | ||
failedTestsWithErrorDetail = Collections.emptyList(); | ||
passedTests = Collections.emptyList(); | ||
passedTestsWithErrorDetail = Collections.emptyList(); | ||
return; | ||
} | ||
|
||
|
@@ -112,10 +119,24 @@ 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); | ||
|
||
LogstashConfiguration configuration = LogstashConfiguration.getInstance(); | ||
if (configuration.isrecordingPassingTests()) { | ||
passedTests = new ArrayList<String>(); | ||
passedTestsWithErrorDetail = new ArrayList<ExecutedTest>(); | ||
testListFill((List<TestResult>) testResultAction.getPassedTests(), passedTests, passedTestsWithErrorDetail); | ||
} else { | ||
passedTests = Collections.emptyList(); | ||
passedTestsWithErrorDetail = Collections.emptyList(); | ||
} | ||
} | ||
|
||
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 +160,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; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,9 @@ | |
</f:entry> | ||
<f:entry title="Enable Globally" field="enableGlobally" description="This will not enable it for pipeline jobs."> | ||
<f:checkbox/> | ||
</f:entry> | ||
<f:entry title="Enable Globally" field="recordingPassingTests" description="This will record all passing tests in addition to failing tests."> | ||
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. Title is wrong |
||
<f:checkbox/> | ||
</f:entry> | ||
<f:entry title="Use millisecond time stamps" field="milliSecondTimestamps"> | ||
<f:checkbox default="true"/> | ||
|
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.
Camel case