Skip to content
This repository was archived by the owner on Oct 2, 2023. It is now read-only.

Commit 5b99f32

Browse files
authored
Account for unknown status test cases in threshold (#176)
* Account for 'unknownStatus' test cases * Increment version
1 parent 9cf0164 commit 5b99f32

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<artifactId>api-audit</artifactId>
55
<packaging>jar</packaging>
66
<name>${project.groupId}:${project.artifactId}</name>
7-
<version>3.7.25-SNAPSHOT</version>
7+
<version>3.7.26-SNAPSHOT</version>
88
<description>Hygieia Audit Rest API Layer</description>
99
<url>https://github.com/Hygieia/${repository.name}</url>
1010

src/main/java/com/capitalone/dashboard/evaluator/FeatureTestResultEvaluator.java

+13-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public class FeatureTestResultEvaluator extends Evaluator<TestResultsAuditRespon
4747
private static final String TEST_CASE_SUCCESS_COUNT = "successTestCaseCount";
4848
private static final String TEST_CASE_FAILURE_COUNT = "failureTestCaseCount";
4949
private static final String TEST_CASE_SKIPPED_COUNT = "skippedTestCaseCount";
50+
private static final String TEST_CASE_UNKNOWN_COUNT = "unknownStatusTestCaseCount";
5051
private static final String TEST_CASE_TOTAL_COUNT = "totalTestCaseCount";
52+
5153
private static final String PRIORITY_HIGH = "High";
5254

5355

@@ -153,6 +155,7 @@ private TestResultsAuditResponse updateTestResultAuditStatuses(List<TestCapabili
153155
}
154156

155157
double testCasePassPercent = this.getTestCasePassPercent(testCapabilities);
158+
156159
if (testCasePassPercent < threshold) {
157160
testResultsAuditResponse.addAuditStatus(TestResultAuditStatus.TEST_RESULT_AUDIT_FAIL);
158161
} else {
@@ -180,13 +183,16 @@ private double getTestCasePassPercent(List<TestCapability> testCapabilities) {
180183
double testCaseSkipCount = testCapabilities.stream().mapToDouble(testCapability ->
181184
testCapability.getTestSuites().parallelStream().mapToDouble(TestSuite::getSkippedTestCaseCount).sum()
182185
).sum();
186+
double testCaseUnkownCount = testCapabilities.stream().mapToDouble(testCapability ->
187+
testCapability.getTestSuites().parallelStream().mapToDouble(TestSuite::getUnknownStatusCount).sum()
188+
).sum();
183189

184-
if(totalTestCaseCount == 0 || testCaseSkipCount == totalTestCaseCount){
190+
if(totalTestCaseCount == 0 || (testCaseSkipCount + testCaseUnkownCount) == totalTestCaseCount){
185191
return 100.0;
186192
}
187193

188-
return (testCaseSuccessCount/(totalTestCaseCount - testCaseSkipCount)) * 100;
189-
194+
return (testCaseSuccessCount/(totalTestCaseCount - testCaseSkipCount - testCaseUnkownCount)) * 100;
195+
190196
}catch(Exception e){
191197
LOGGER.error("Could not get 'testCasePassPercent', setting to 0.0%");
192198
return 0.0;
@@ -215,11 +221,15 @@ protected HashMap getFeatureTestResult(TestResult testResult) {
215221
testCapability.getTestSuites().parallelStream().mapToInt(TestSuite::getFailedTestCaseCount).sum()).sum();
216222
int testCaseSkippedCount = testCapabilities.stream().mapToInt(testCapability ->
217223
testCapability.getTestSuites().parallelStream().mapToInt(TestSuite::getSkippedTestCaseCount).sum()).sum();
224+
int testCaseUnknownCount = testCapabilities.stream().mapToInt(testCapability ->
225+
testCapability.getTestSuites().parallelStream().mapToInt(TestSuite::getUnknownStatusCount).sum()).sum();
218226

219227
featureTestResultMap.put(TEST_CASE_TOTAL_COUNT, totalTestCaseCount);
220228
featureTestResultMap.put(TEST_CASE_SUCCESS_COUNT, testCaseSuccessCount);
221229
featureTestResultMap.put(TEST_CASE_FAILURE_COUNT, testCaseFailureCount);
222230
featureTestResultMap.put(TEST_CASE_SKIPPED_COUNT, testCaseSkippedCount);
231+
featureTestResultMap.put(TEST_CASE_UNKNOWN_COUNT, testCaseUnknownCount);
232+
223233
}catch(Exception e){
224234
LOGGER.error("Exception occurred while processing testResult " + testResult.getDescription(), e);
225235
}

0 commit comments

Comments
 (0)