Skip to content
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

Bugfix/2331 proper progress updates #172

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 96 additions & 96 deletions audit-resolve.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.7"

services:
mojaloop-testing-toolkit:
image: mojaloop/ml-testing-toolkit:v12.4.1
image: mojaloop/ml-testing-toolkit:v13.0.0
#image: mojaloop-testing-toolkit:local
#build:
# context: .
Expand All @@ -18,7 +18,7 @@ services:
- -c
- "npm start"
mojaloop-testing-toolkit-ui:
image: mojaloop/ml-testing-toolkit-ui:v12.2.2
image: mojaloop/ml-testing-toolkit-ui:v13.0.0
ports:
- "6060:6060"
environment:
Expand Down
2 changes: 1 addition & 1 deletion native-app-generation/build-native-app.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TTK_UI_TAG="v12.2.2"
TTK_UI_TAG="v13.0.0"

HelpMessage () {
echo "Usage: $0 -platform [macos|linux|win] -arch [x64|x86|armv6|armv7]"
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ml-testing-toolkit",
"description": "Testing Toolkit for Mojaloop implementations",
"version": "11.17.4",
"version": "12.0.0",
"license": "Apache-2.0",
"author": "Vijaya Kumar Guthi, ModusBox Inc. ",
"contributors": [
Expand Down
54 changes: 51 additions & 3 deletions src/lib/test-outbound/outbound-initiator.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,23 @@ const getTracing = (traceID, dfspId) => {
}

const OutboundSend = async (inputTemplate, traceID, dfspId) => {
const totalCounts = getTotalCounts(inputTemplate)
const globalConfig = {
broadcastOutboundProgressEnabled: true,
scriptExecution: true,
testsExecution: true
testsExecution: true,
totalProgress: {
testCasesTotal: totalCounts.totalTestCases,
testCasesProcessed: 0,
requestsTotal: totalCounts.totalRequests,
requestsProcessed: 0,
assertionsTotal: totalCounts.totalAssertions,
assertionsProcessed: 0,
assertionsPassed: 0,
assertionsFailed: 0
}
}

const startedTimeStamp = new Date()
const tracing = getTracing(traceID, dfspId)

Expand All @@ -79,6 +91,7 @@ const OutboundSend = async (inputTemplate, traceID, dfspId) => {
}
try {
for (const i in inputTemplate.test_cases) {
globalConfig.totalProgress.testCasesProcessed++
await processTestCase(inputTemplate.test_cases[i], traceID, inputTemplate.inputValues, variableData, dfspId, globalConfig)
}

Expand Down Expand Up @@ -322,6 +335,13 @@ const setResponse = async (convertedRequest, resp, variableData, request, status
curlRequest: resp.curlRequest
}
}

// Update total progress counts
globalConfig.totalProgress.requestsProcessed++
globalConfig.totalProgress.assertionsProcessed += request.tests && request.tests.assertions ? request.tests.assertions.length : 0
globalConfig.totalProgress.assertionsPassed += testResult.passedCount
globalConfig.totalProgress.assertionsFailed += request.tests && request.tests.assertions ? (request.tests.assertions.length - testResult.passedCount) : 0

if (tracing.outboundID && globalConfig.broadcastOutboundProgressEnabled) {
notificationEmitter.broadcastOutboundProgress({
outboundID: tracing.outboundID,
Expand All @@ -336,7 +356,8 @@ const setResponse = async (convertedRequest, resp, variableData, request, status
curlRequest: resp.curlRequest,
scriptsExecution: scriptsExecution
},
testResult
testResult,
totalProgress: globalConfig.totalProgress
}, tracing.sessionID)
}
}
Expand All @@ -356,6 +377,13 @@ const setSkippedResponse = async (convertedRequest, request, status, tracing, te
curlRequest: null
}
}

// Update total progress counts
globalConfig.totalProgress.requestsProcessed++
globalConfig.totalProgress.assertionsProcessed += request.tests && request.tests.assertions && request.tests.assertions.length
globalConfig.totalProgress.assertionsPassed += testResult.passedCount
// globalConfig.totalProgress.assertionsFailed += 0

if (tracing.outboundID && globalConfig.broadcastOutboundProgressEnabled) {
notificationEmitter.broadcastOutboundProgress({
outboundID: tracing.outboundID,
Expand All @@ -370,7 +398,8 @@ const setSkippedResponse = async (convertedRequest, request, status, tracing, te
curlRequest: null,
scriptsExecution: scriptsExecution
},
testResult
testResult,
totalProgress: globalConfig.totalProgress
}, tracing.sessionID)
}
}
Expand Down Expand Up @@ -766,6 +795,25 @@ const getFunctionResult = (param, inputValues, request) => {
return utilsInternal.getFunctionResult(param, inputValues, request)
}

// Get Total Counts
const getTotalCounts = (inputTemplate) => {
var result = {
totalTestCases: 0,
totalRequests: 0,
totalAssertions: 0
}
const { test_cases } = inputTemplate // eslint-disable-line
result.totalTestCases = test_cases.length
test_cases.forEach(testCase => {
const { requests } = testCase
result.totalRequests += requests.length
requests.forEach(request => {
result.totalAssertions += request.tests && request.tests.assertions && request.tests.assertions.length
})
})
return result
}

// Generate consolidated final report
const generateFinalReport = (inputTemplate, runtimeInformation) => {
const { test_cases, ...remaingPropsInTemplate } = inputTemplate // eslint-disable-line
Expand Down