src/main/java/com/capitalone/dashboard/event/TestResultEventListener.java
/**
     * Extracts the test result threshold values to build performance metrics object
     * @param testCase, testCapability
     */
Extracts the test result threshold values to build performance metrics object
@param testCase, testCapability
Extracts the test result threshold values to build performance metrics object @param testCase testCapability
private void extractPerformanceMetrics(TestCase testCase, TestCapability testCapability) {
        long testCapabilityDurationSecs = TimeUnit.MILLISECONDS.toSeconds(testCapability.getDuration());
        if(testCase.getDescription().equalsIgnoreCase(STR_RESP_TIME_THRESHOLD)){
            isResponseTimeGood = testCase.getStatus().name().equalsIgnoreCase(TestCaseStatus.Success.name());
            testCase.getTestSteps().forEach(testCaseStep -> {
                if (testCaseStep.getId().equalsIgnoreCase(STR_TARGET_RESP_TIME)){
                    targetRespTime = NumberUtils.isCreatable(testCaseStep.getDescription()) ?
                            Double.valueOf(testCaseStep.getDescription()) : NumberUtils.DOUBLE_ZERO;
                }
                if (testCaseStep.getId().equalsIgnoreCase(STR_ACTUAL_RESP_TIME)){
                    actualRespTime = NumberUtils.isCreatable(testCaseStep.getDescription()) ?
                            Double.valueOf(testCaseStep.getDescription()) : NumberUtils.DOUBLE_ZERO;
                }
            });
        }
        if(testCase.getDescription().equalsIgnoreCase(STR_TXN_PER_SEC_THRESHOLD)){
            isTxnGoodHealth = testCase.getStatus().name().equalsIgnoreCase(TestCaseStatus.Success.name());
            testCase.getTestSteps().forEach(testCaseStep -> {
                if (testCaseStep.getId().equalsIgnoreCase(STR_TARGET_TXN_PER_SEC)) {
                    targetTxnsPerSec = NumberUtils.isCreatable(testCaseStep.getDescription()) ?
                            Double.valueOf(testCaseStep.getDescription()) : NumberUtils.DOUBLE_ZERO;
                }
                if (testCaseStep.getId().equalsIgnoreCase(STR_ACTUAL_TXN_PER_SEC)) {
                    actualTxnsPerSec = NumberUtils.isCreatable(testCaseStep.getDescription()) ?
                            Double.valueOf(testCaseStep.getDescription()) : NumberUtils.DOUBLE_ZERO;
                }
            });
        }
        if(testCase.getDescription().equalsIgnoreCase(STR_ERROR_RATE_THRESHOLD)){
            isErrorRateGood = testCase.getStatus().name().equalsIgnoreCase(TestCaseStatus.Success.name());
            testCase.getTestSteps().forEach(testCaseStep -> {
                if (testCaseStep.getId().contains(STR_TARGET_ERROR_RATE)){
                    targetErrorRate = NumberUtils.isCreatable(testCaseStep.getDescription()) ?
                            Double.valueOf(testCaseStep.getDescription()) : NumberUtils.DOUBLE_ZERO;
                }
                if (testCaseStep.getId().equalsIgnoreCase(STR_ACTUAL_ERROR_RATE)){
                    actualErrorRate = NumberUtils.isCreatable(testCaseStep.getDescription()) ?
                            Double.valueOf(testCaseStep.getDescription()) : NumberUtils.DOUBLE_ZERO;
                    actualErrorsVal =  (actualErrorRate / 100) * (testCapabilityDurationSecs * actualTxnsPerSec);
                }
            });
        }
    }
private void extractPerformanceMetrics ( TestCase testCase , TestCapability testCapability ) { long testCapabilityDurationSecs = TimeUnit . MILLISECONDS . toSeconds ( testCapability . getDuration ( ) ) ; if ( testCase . getDescription ( ) . equalsIgnoreCase ( STR_RESP_TIME_THRESHOLD ) ) { isResponseTimeGood = testCase . getStatus ( ) . name ( ) . equalsIgnoreCase ( TestCaseStatus . Success . name ( ) ) ; testCase . getTestSteps ( ) . forEach ( testCaseStep -> { if ( testCaseStep . getId ( ) . equalsIgnoreCase ( STR_TARGET_RESP_TIME ) ) { targetRespTime = NumberUtils . isCreatable ( testCaseStep . getDescription ( ) ) ? Double . valueOf ( testCaseStep . getDescription ( ) ) : NumberUtils . DOUBLE_ZERO ; } if ( testCaseStep . getId ( ) . equalsIgnoreCase ( STR_ACTUAL_RESP_TIME ) ) { actualRespTime = NumberUtils . isCreatable ( testCaseStep . getDescription ( ) ) ? Double . valueOf ( testCaseStep . getDescription ( ) ) : NumberUtils . DOUBLE_ZERO ; } } ) ; } if ( testCase . getDescription ( ) . equalsIgnoreCase ( STR_TXN_PER_SEC_THRESHOLD ) ) { isTxnGoodHealth = testCase . getStatus ( ) . name ( ) . equalsIgnoreCase ( TestCaseStatus . Success . name ( ) ) ; testCase . getTestSteps ( ) . forEach ( testCaseStep -> { if ( testCaseStep . getId ( ) . equalsIgnoreCase ( STR_TARGET_TXN_PER_SEC ) ) { targetTxnsPerSec = NumberUtils . isCreatable ( testCaseStep . getDescription ( ) ) ? Double . valueOf ( testCaseStep . getDescription ( ) ) : NumberUtils . DOUBLE_ZERO ; } if ( testCaseStep . getId ( ) . equalsIgnoreCase ( STR_ACTUAL_TXN_PER_SEC ) ) { actualTxnsPerSec = NumberUtils . isCreatable ( testCaseStep . getDescription ( ) ) ? Double . valueOf ( testCaseStep . getDescription ( ) ) : NumberUtils . DOUBLE_ZERO ; } } ) ; } if ( testCase . getDescription ( ) . equalsIgnoreCase ( STR_ERROR_RATE_THRESHOLD ) ) { isErrorRateGood = testCase . getStatus ( ) . name ( ) . equalsIgnoreCase ( TestCaseStatus . Success . name ( ) ) ; testCase . getTestSteps ( ) . forEach ( testCaseStep -> { if ( testCaseStep . getId ( ) . contains ( STR_TARGET_ERROR_RATE ) ) { targetErrorRate = NumberUtils . isCreatable ( testCaseStep . getDescription ( ) ) ? Double . valueOf ( testCaseStep . getDescription ( ) ) : NumberUtils . DOUBLE_ZERO ; } if ( testCaseStep . getId ( ) . equalsIgnoreCase ( STR_ACTUAL_ERROR_RATE ) ) { actualErrorRate = NumberUtils . isCreatable ( testCaseStep . getDescription ( ) ) ? Double . valueOf ( testCaseStep . getDescription ( ) ) : NumberUtils . DOUBLE_ZERO ; actualErrorsVal = ( actualErrorRate / 100 ) * ( testCapabilityDurationSecs * actualTxnsPerSec ) ; } } ) ; } }
Extracts the test result threshold values to build performance metrics object
 @param testCase, testCapability
Extracts the test result threshold values to build performance metrics object @param testCase testCapability
// Error rate is percentage of actual errors in total calls