ml-testing-toolkit 18.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +10 -0
- package/.grype.yaml +16 -0
- package/.ncurc.yaml +9 -0
- package/.nvmrc +1 -0
- package/.versionrc.js +16 -0
- package/CHANGELOG.md +504 -0
- package/CODEOWNERS +30 -0
- package/Dockerfile +42 -0
- package/Dockerfile-newman +13 -0
- package/LICENSE.md +9 -0
- package/README.md +119 -0
- package/assets/diagrams/architectural/architectural-diagram.svg +3 -0
- package/assets/diagrams/flow/flow-diagram.svg +3 -0
- package/assets/images/Sample-Response-Failure.png +0 -0
- package/assets/images/Screenshot 2020-04-16 at 22.58.04.png +0 -0
- package/assets/images/TLS-Enabled-on-Environment.png +0 -0
- package/assets/images/adapter-mutual-tls-enabled.png +0 -0
- package/assets/images/add-additional-input-values.png +0 -0
- package/assets/images/add-condition-button.png +0 -0
- package/assets/images/add-new-assertion.png +0 -0
- package/assets/images/add-new-input-value.png +0 -0
- package/assets/images/add-new-input-variable.png +0 -0
- package/assets/images/additional-transfers.png +0 -0
- package/assets/images/api-provisioning-add-new-api-confirmation.png +0 -0
- package/assets/images/api-provisioning-file-input-window.png +0 -0
- package/assets/images/api-provisioning-list-apis-view.png +0 -0
- package/assets/images/api-provisioning-menu-item.png +0 -0
- package/assets/images/apply_and_restart.jpg +0 -0
- package/assets/images/assess-request-or-response.png +0 -0
- package/assets/images/assess-response-equation-save.png +0 -0
- package/assets/images/assess-response-equation.png +0 -0
- package/assets/images/assess-response-status.png +0 -0
- package/assets/images/building-new-rules-file.png +0 -0
- package/assets/images/callback-rules-screen.png +0 -0
- package/assets/images/configurable-parameter-assertion.png +0 -0
- package/assets/images/configurable-parameter-currency.png +0 -0
- package/assets/images/configurable-parameter.png +0 -0
- package/assets/images/connection-manager-ui-opening.png +0 -0
- package/assets/images/create-inbound-user-simulator.png +0 -0
- package/assets/images/creating-new-rule-file.png +0 -0
- package/assets/images/dfsp-client-cacert.png +0 -0
- package/assets/images/dfsp-client-submit.png +0 -0
- package/assets/images/dfsp-client.png +0 -0
- package/assets/images/dfsp-p2p-happy-path.png +0 -0
- package/assets/images/dfsp-server-cacert.png +0 -0
- package/assets/images/dfsp-server-cert.png +0 -0
- package/assets/images/download-report.png +0 -0
- package/assets/images/drive_have_not_been_shared.jpg +0 -0
- package/assets/images/event-response-options.png +0 -0
- package/assets/images/expand-monitoring-messages.png +0 -0
- package/assets/images/fixed-response-sample.png +0 -0
- package/assets/images/header-selection.png +0 -0
- package/assets/images/heap_error_windows.jpg +0 -0
- package/assets/images/hosted-mode-docker-compose-intro.png +0 -0
- package/assets/images/hub-client-cert.png +0 -0
- package/assets/images/import-template.png +0 -0
- package/assets/images/inbound-requests-environment.png +0 -0
- package/assets/images/inbound-requests-scripts.png +0 -0
- package/assets/images/jws-certificate-submit.png +0 -0
- package/assets/images/jws-certificate.png +0 -0
- package/assets/images/jws-certs-keys.png +0 -0
- package/assets/images/jws-hub-certs-keys.png +0 -0
- package/assets/images/local-enable-jws-publickey.png +0 -0
- package/assets/images/local-mutual-tls-enabled.png +0 -0
- package/assets/images/local_drives_to_be_available.jpg +0 -0
- package/assets/images/mcm-environment-opening.png +0 -0
- package/assets/images/menu-items.png +0 -0
- package/assets/images/mock-response-sample.png +0 -0
- package/assets/images/monitoring-initial-state.png +0 -0
- package/assets/images/monitoring-messages.png +0 -0
- package/assets/images/new-empty-assertion.png +0 -0
- package/assets/images/opened-imported-template.png +0 -0
- package/assets/images/opening-default-settings.png +0 -0
- package/assets/images/opening-sync-response-rules.png +0 -0
- package/assets/images/opening-view.png +0 -0
- package/assets/images/outbound-display-opening-hub.png +0 -0
- package/assets/images/outbound-display-opening.png +0 -0
- package/assets/images/override-with-environment-variable.png +0 -0
- package/assets/images/populate-with-sample-body.png +0 -0
- package/assets/images/resource-selection.png +0 -0
- package/assets/images/rule-builder-select-api.png +0 -0
- package/assets/images/sample-condition-add-configurable-params.png +0 -0
- package/assets/images/sample-condition.png +0 -0
- package/assets/images/sample-editor.png +0 -0
- package/assets/images/sample-request.png +0 -0
- package/assets/images/sample-test-assertion.png +0 -0
- package/assets/images/send-transfer.png +0 -0
- package/assets/images/sending-single-test-case-1.png +0 -0
- package/assets/images/sending-single-test-case-2.png +0 -0
- package/assets/images/sending-test-cases.png +0 -0
- package/assets/images/server-certificates-submitted.png +0 -0
- package/assets/images/simulator-response.png +0 -0
- package/assets/images/simulator-scheme-adapter-endpoint.png +0 -0
- package/assets/images/summarized-view-of-rule.png +0 -0
- package/assets/images/template-window.png +0 -0
- package/assets/images/test-case-editor-console-log.png +0 -0
- package/assets/images/test-case-editor-environment-state.png +0 -0
- package/assets/images/test-case-editor-scripts.png +0 -0
- package/assets/images/test-case-editor.png +0 -0
- package/assets/images/testcase-definition-download.png +0 -0
- package/assets/images/testcase-definition-edit-meta-info.png +0 -0
- package/assets/images/testing-toolkit-mojaloop-testing-toolkit-endpoint.png +0 -0
- package/assets/images/tls-hub-certs-keys.png +0 -0
- package/assets/images/tls-jws-enabled-on-environment.png +0 -0
- package/assets/images/updated-sample-body-data.png +0 -0
- package/assets/images/using-configurable-parameter.png +0 -0
- package/assets/images/validation-rules-screen.png +0 -0
- package/assets/images/view-response.png +0 -0
- package/audit-ci.jsonc +7 -0
- package/connection-manager/docker-compose.yml +55 -0
- package/database/docker-compose.yml +16 -0
- package/docker/hosted-mode/docker-compose.yaml +107 -0
- package/docker/hosted-mode/keycloak/keycloak-realm.json +2298 -0
- package/docker/hosted-mode/mongo-init.sh +1 -0
- package/docker/hosted-mode-tls/docker-compose.yaml +171 -0
- package/docker/hosted-mode-tls/keycloak/keycloak-realm.json +2298 -0
- package/docker/hosted-mode-tls/mongo-init.sh +1 -0
- package/docker-compose.yml +62 -0
- package/documents/Mojaloop-Testing-Toolkit.md +296 -0
- package/documents/RULES_ENGINE.md +403 -0
- package/documents/User-Guide-API-Provisioning.md +121 -0
- package/documents/User-Guide-CLI.md +218 -0
- package/documents/User-Guide-Connection-Manager.md +282 -0
- package/documents/User-Guide-Frequently-Asked-Questions.md +39 -0
- package/documents/User-Guide-Hosted-Mode-Docker-Compose.md +110 -0
- package/documents/User-Guide-Installation.md +163 -0
- package/documents/User-Guide-Mojaloop-Testing-Toolkit.md +642 -0
- package/documents/User-Guide-OAuth-Server-Deployment.md +283 -0
- package/documents/User-Guide-Onboarding-DFSP.md +197 -0
- package/documents/User-Guide-Onboarding-HUB.md +191 -0
- package/documents/User-Guide.md +53 -0
- package/examples/collections/dfsp/p2p_failed_tests.json +7161 -0
- package/examples/collections/dfsp/p2p_fx_happy_path.json +502 -0
- package/examples/collections/dfsp/p2p_happy_path.json +350 -0
- package/examples/collections/dfsp/p2p_happy_path_extended.json +6106 -0
- package/examples/collections/dfsp/p2p_happy_path_jws.json +511 -0
- package/examples/collections/dfsp/p2p_payee_assertions_websocket.json +441 -0
- package/examples/collections/dfsp/sample.json +5029 -0
- package/examples/collections/dfsp/transaction_request_service.json +240 -0
- package/examples/collections/fxp/FXP.json +264 -0
- package/examples/collections/fxp/SDK_backend.json +98 -0
- package/examples/collections/fxp/SDK_outbound.json +163 -0
- package/examples/collections/hub/hub_01_p2p_happy_path/hub_p2p_receive_quote.json +400 -0
- package/examples/collections/hub/hub_01_p2p_happy_path/hub_p2p_send_quote.json +395 -0
- package/examples/collections/hub/hub_02_block_transfer/hub_block_transfer.json +393 -0
- package/examples/collections/hub/hub_03_funds_in_out/hub_funds_in.json +224 -0
- package/examples/collections/hub/hub_03_funds_in_out/hub_funds_out.json +780 -0
- package/examples/collections/hub/hub_04_settlements/hub_settlements.json +3138 -0
- package/examples/collections/hub/hub_05_transfer_negative_scenarios/hub_transfer_negative_payee_abort.json +475 -0
- package/examples/collections/hub/hub_05_transfer_negative_scenarios/hub_transfer_negative_payee_invalid_fulfillment.json +370 -0
- package/examples/collections/hub/hub_05_transfer_negative_scenarios/hub_transfer_negative_transfer_timeout.json +262 -0
- package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_authorizations.json +117 -0
- package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_error_framework.json +591 -0
- package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_received_state.json +379 -0
- package/examples/collections/hub/hub_06_transaction_requests_service/hub_trs_reject_state.json +361 -0
- package/examples/collections/hub/hub_07_quoting_service.json +525 -0
- package/examples/collections/hub/hub_08_participant_inactive_stop_transfers.json +706 -0
- package/examples/collections/hub/hub_09_duplicate_handling_transfers.json +1377 -0
- package/examples/collections/hub/hub_10_on_us_transfers.json +245 -0
- package/examples/collections/hub/hub_11_accented_and_spl_chars.json +629 -0
- package/examples/collections/hub/hub_12_fspiop_version_1.1.json +646 -0
- package/examples/collections/hub/hub_13_bulk_transfers.json +1857 -0
- package/examples/collections/iso20022/self_referencing_iso20022.json +926 -0
- package/examples/collections/provisioning/testingtoolkitdfsp.json +904 -0
- package/examples/environments/dfsp_local_environment.json +46 -0
- package/examples/environments/hub_local_environment.json +57 -0
- package/jest.config.js +17 -0
- package/package.json +199 -0
- package/sbom-v18.12.4.csv +1553 -0
- package/secrets/keygen.sh +5 -0
- package/secrets/privatekey.pem +27 -0
- package/secrets/publickey.cer +21 -0
- package/secrets/tls/01.pem +132 -0
- package/secrets/tls/createSecrets.sh +20 -0
- package/secrets/tls/hub_client.csr +32 -0
- package/secrets/tls/hub_client_cacert.pem +35 -0
- package/secrets/tls/hub_client_cakey.pem +52 -0
- package/secrets/tls/hub_client_key.key +52 -0
- package/secrets/tls/hub_server.csr +31 -0
- package/secrets/tls/hub_server_cacert.pem +35 -0
- package/secrets/tls/hub_server_cakey.pem +52 -0
- package/secrets/tls/hub_server_cert.pem +132 -0
- package/secrets/tls/hub_server_key.key +52 -0
- package/secrets/tls/index.txt +1 -0
- package/secrets/tls/index.txt.attr +1 -0
- package/secrets/tls/openssl-client.cnf +36 -0
- package/secrets/tls/openssl-clientca.cnf +71 -0
- package/secrets/tls/openssl-server.cnf +39 -0
- package/secrets/tls/openssl-serverca.cnf +71 -0
- package/secrets/tls/serial.txt +1 -0
- package/spec_files/api_definitions/als_admin_1.1/api_spec.yaml +804 -0
- package/spec_files/api_definitions/central_admin_1.0/api_spec.yaml +1850 -0
- package/spec_files/api_definitions/central_admin_1.0/response_map.json +96 -0
- package/spec_files/api_definitions/central_admin_old_9.3/api_spec.yaml +2467 -0
- package/spec_files/api_definitions/central_admin_old_9.3/response_map.json +96 -0
- package/spec_files/api_definitions/fspiop_1.0/api_spec.yaml +4187 -0
- package/spec_files/api_definitions/fspiop_1.0/callback_map.json +568 -0
- package/spec_files/api_definitions/fspiop_1.0/mockRef.json +79 -0
- package/spec_files/api_definitions/fspiop_1.0/trigger_templates/transaction_request_followup.json +126 -0
- package/spec_files/api_definitions/fspiop_1.0/trigger_templates/transaction_request_followup_quotes_only.json +97 -0
- package/spec_files/api_definitions/fspiop_1.1/api_spec.yaml +3778 -0
- package/spec_files/api_definitions/fspiop_1.1/callback_map.json +568 -0
- package/spec_files/api_definitions/fspiop_1.1/mockRef.json +79 -0
- package/spec_files/api_definitions/fspiop_1.1/trigger_templates/transaction_request_followup.json +125 -0
- package/spec_files/api_definitions/fspiop_2.0/api_spec.yaml +4839 -0
- package/spec_files/api_definitions/fspiop_2.0/callback_map.json +716 -0
- package/spec_files/api_definitions/fspiop_2.0/mockRef.json +79 -0
- package/spec_files/api_definitions/fspiop_2.0/trigger_templates/transaction_request_followup.json +125 -0
- package/spec_files/api_definitions/fspiop_2.0_iso20022/api_spec.yaml +8331 -0
- package/spec_files/api_definitions/fspiop_2.0_iso20022/callback_map.json +508 -0
- package/spec_files/api_definitions/fspiop_2.0_iso20022/mockRef.json +66 -0
- package/spec_files/api_definitions/fx-api_2.0/api_spec.yaml +1768 -0
- package/spec_files/api_definitions/fx-api_2.0/callback_map.json +188 -0
- package/spec_files/api_definitions/fx-api_2.0/mockRef.json +83 -0
- package/spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/api_spec.yaml +2612 -0
- package/spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/mockRef.json +22 -0
- package/spec_files/api_definitions/mojaloop_sdk_outbound_scheme_adapter_1.0/response_map.json +35 -0
- package/spec_files/api_definitions/mojaloop_simulator_0.1/api_spec.yaml +225 -0
- package/spec_files/api_definitions/mojaloop_simulator_sim_1.4/api_spec.yaml +1087 -0
- package/spec_files/api_definitions/mojaloop_simulator_sim_1.4/mockRef.json +75 -0
- package/spec_files/api_definitions/mojaloop_simulator_sim_1.4/response_map.json +55 -0
- package/spec_files/api_definitions/payment_manager_1.4/api_spec.yaml +1389 -0
- package/spec_files/api_definitions/sdk-scheme-adapter-backend-v2_1_0-openapi3-snippets_2.1/api_spec.yaml +2834 -0
- package/spec_files/api_definitions/sdk-scheme-adapter-outbound-v2_1_0-openapi3-snippets_2.1/api_spec.yaml +3449 -0
- package/spec_files/api_definitions/settlements_1.0/api_spec.yaml +983 -0
- package/spec_files/api_definitions/settlements_1.0/mockRef.json +38 -0
- package/spec_files/api_definitions/settlements_1.0/response_map.json +34 -0
- package/spec_files/api_definitions/settlements_2.0/api_spec.yaml +1001 -0
- package/spec_files/api_definitions/settlements_2.0/mockRef.json +38 -0
- package/spec_files/api_definitions/settlements_2.0/response_map.json +34 -0
- package/spec_files/api_definitions/thirdparty_sdk_outbound_0.1/api_spec.yaml +2139 -0
- package/spec_files/reports/templates/newman/html_template.html +1202 -0
- package/spec_files/reports/templates/newman/pdf_template.html +790 -0
- package/spec_files/reports/templates/testcase_definition/table_view.html +1602 -0
- package/spec_files/rules_callback/config.json +3 -0
- package/spec_files/rules_callback/default.json +2698 -0
- package/spec_files/rules_callback/p2p-limit.json +129 -0
- package/spec_files/rules_forward/config.json +3 -0
- package/spec_files/rules_forward/default.json +482 -0
- package/spec_files/rules_response/config.json +3 -0
- package/spec_files/rules_response/default.json +295 -0
- package/spec_files/rules_validation/config.json +3 -0
- package/spec_files/rules_validation/default.json +1 -0
- package/spec_files/rules_validation/p2p-limit.json +55 -0
- package/spec_files/system_config.json +175 -0
- package/spec_files/user_config.json +109 -0
- package/src/index.js +67 -0
- package/src/lib/MyEventEmitter.js +54 -0
- package/src/lib/api-management.js +143 -0
- package/src/lib/api-routes/config.js +83 -0
- package/src/lib/api-routes/history.js +139 -0
- package/src/lib/api-routes/keycloak.js +54 -0
- package/src/lib/api-routes/longpolling.js +70 -0
- package/src/lib/api-routes/oauth2.js +149 -0
- package/src/lib/api-routes/objectstore.js +53 -0
- package/src/lib/api-routes/openapi.js +224 -0
- package/src/lib/api-routes/outbound.js +134 -0
- package/src/lib/api-routes/reports.js +72 -0
- package/src/lib/api-routes/rules.js +356 -0
- package/src/lib/api-routes/samples.js +92 -0
- package/src/lib/api-routes/server-logs.js +44 -0
- package/src/lib/api-routes/settings.js +71 -0
- package/src/lib/api-server.js +135 -0
- package/src/lib/arrayStore.js +101 -0
- package/src/lib/callbackHandler.js +201 -0
- package/src/lib/config.js +177 -0
- package/src/lib/configuration-providers/mb-connection-manager.js +625 -0
- package/src/lib/db/adapters/dbAdapter.js +184 -0
- package/src/lib/db/dfspMockUsers.js +64 -0
- package/src/lib/db/models/mongoDBWrapper.js +78 -0
- package/src/lib/eventListenerClient/inboundEventListener.js +176 -0
- package/src/lib/fileAdapter.js +57 -0
- package/src/lib/httpAgentStore.js +135 -0
- package/src/lib/importExport.js +186 -0
- package/src/lib/jws/JwsSigning.js +141 -0
- package/src/lib/loadSamples.js +128 -0
- package/src/lib/logger.js +20 -0
- package/src/lib/longpollingEmitter.js +56 -0
- package/src/lib/metrics.js +51 -0
- package/src/lib/mocking/custom-functions/generic.js +57 -0
- package/src/lib/mocking/middleware-functions/ilpModel.js +238 -0
- package/src/lib/mocking/middleware-functions/quotesAssociation.js +75 -0
- package/src/lib/mocking/middleware-functions/transactionRequestsService.js +78 -0
- package/src/lib/mocking/openApiDefinitionsModel.js +64 -0
- package/src/lib/mocking/openApiMockHandler.js +466 -0
- package/src/lib/mocking/openApiRulesEngine.js +492 -0
- package/src/lib/mocking/openApiVersionTools.js +136 -0
- package/src/lib/mocking/transformers/fspiopToISO20022.js +230 -0
- package/src/lib/mocking/transformers/index.js +41 -0
- package/src/lib/notificationEmitter.js +64 -0
- package/src/lib/oauth/KeycloakHelper.js +220 -0
- package/src/lib/oauth/LoginService.js +133 -0
- package/src/lib/oauth/OAuthHelper.js +181 -0
- package/src/lib/oauth/OAuthValidator.js +118 -0
- package/src/lib/oauth/Wso2Client.js +64 -0
- package/src/lib/objectStore/inMemoryImpl.js +50 -0
- package/src/lib/objectStore/objectStoreInterface.js +51 -0
- package/src/lib/objectStore.js +122 -0
- package/src/lib/report-generator/generator.js +126 -0
- package/src/lib/report-generator/helpers.js +154 -0
- package/src/lib/requestLogger.js +190 -0
- package/src/lib/resources/wso2carbon-publickey.cert +20 -0
- package/src/lib/rulesEngine.js +95 -0
- package/src/lib/rulesEngineModel.js +463 -0
- package/src/lib/scripting-engines/postman-sandbox.js +142 -0
- package/src/lib/scripting-engines/vm-javascript-sandbox.js +294 -0
- package/src/lib/server-logs/adapters/elastic-search.js +102 -0
- package/src/lib/server-logs/adapters/grafana.js +0 -0
- package/src/lib/server-logs/index.js +75 -0
- package/src/lib/socket-server.js +55 -0
- package/src/lib/storageAdapter.js +109 -0
- package/src/lib/test-outbound/TestCaseRunner.js +173 -0
- package/src/lib/test-outbound/getTracing.js +19 -0
- package/src/lib/test-outbound/outbound-initiator.js +1107 -0
- package/src/lib/uniqueIdGenerator.js +35 -0
- package/src/lib/utils.js +89 -0
- package/src/lib/utilsInternal.js +56 -0
- package/src/lib/webSocketClient/WebSocketClientManager.js +197 -0
- package/src/server.js +218 -0
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
# Users Guide Mojaloop Testing Toolkit
|
|
2
|
+
|
|
3
|
+
## _Mojaloop Testing Toolkit_
|
|
4
|
+
|
|
5
|
+
**Table of Contents**
|
|
6
|
+
|
|
7
|
+
0. [User Guide](/documents/User-Guide.md)
|
|
8
|
+
|
|
9
|
+
1. [At first glance](#1-at-first-glance)
|
|
10
|
+
|
|
11
|
+
2. [Welcome Page](#2-welcome-page)
|
|
12
|
+
|
|
13
|
+
3. [Monitoring](#3-monitoring)
|
|
14
|
+
|
|
15
|
+
4. [Rules](#4-rules)
|
|
16
|
+
|
|
17
|
+
4.1 [Sync Response Rules](#41-sync-response-rules)
|
|
18
|
+
|
|
19
|
+
4.2. [Validation Rules (_Error Callbacks_)](#42-validation-rules)
|
|
20
|
+
|
|
21
|
+
4.3. [Callback Rules (_Success Callbacks_)](#43-callback-rules)
|
|
22
|
+
|
|
23
|
+
4.4 [Building your own Rules File](#44-building-your-own-rules-file)
|
|
24
|
+
|
|
25
|
+
4.5 [Inbound Scripting](#45-inbound-scripting)
|
|
26
|
+
|
|
27
|
+
5. [Outbound Request](#5-outbound-request)
|
|
28
|
+
|
|
29
|
+
5.1 [Collection Manager](#51-collection-manager)
|
|
30
|
+
|
|
31
|
+
5.2 [Import Environment](#52-import-environment)
|
|
32
|
+
|
|
33
|
+
5.3 [Test Cases](#53-test-cases)
|
|
34
|
+
|
|
35
|
+
5.3.1 [Request](#531-request)
|
|
36
|
+
|
|
37
|
+
5.3.2 [Test Editor](#532-editor)
|
|
38
|
+
|
|
39
|
+
5.3.3 [Test Scripts](#533-scripts)
|
|
40
|
+
|
|
41
|
+
5.3.4 [Tests](#534-tests)
|
|
42
|
+
|
|
43
|
+
5.4 [Download Report](#54-download-report)
|
|
44
|
+
|
|
45
|
+
5.5 [New Template](#55-new-template)
|
|
46
|
+
|
|
47
|
+
5.6 [Show Template](#56-dhow-template)
|
|
48
|
+
|
|
49
|
+
5.7 [Save](#57-save)
|
|
50
|
+
|
|
51
|
+
5.8 [Send](#58-send)
|
|
52
|
+
|
|
53
|
+
5.9 [Download Testcase Definition](#59-download-testcase-definition)
|
|
54
|
+
|
|
55
|
+
6. [Settings](#6-settings)
|
|
56
|
+
|
|
57
|
+
### 1 At first glance
|
|
58
|
+
|
|
59
|
+
When you open the **Mojaloop Testing Toolkit** in your browser, you will be welcomed by the Dashboard display. Currently this is still under development, and only display "static data". The current static display will provide you with a fair representations of the intentional Dashboard functionality.
|
|
60
|
+
|
|
61
|
+

|
|
62
|
+
|
|
63
|
+
Take note of the navigation bar on the left. The navigational items are;
|
|
64
|
+
|
|
65
|
+
- **Welcome Page**
|
|
66
|
+
- **Monitoring**
|
|
67
|
+
- **Sync Response Rules**
|
|
68
|
+
- **Validation Rules (Error Callbacks)**
|
|
69
|
+
- **Callback Rules (Success Callbacks)**
|
|
70
|
+
- **Outbound Request**
|
|
71
|
+
- **Settings**
|
|
72
|
+
|
|
73
|
+
We will work through each one of the items and provide you with a fair understanding of the current functionality.
|
|
74
|
+
|
|
75
|
+
### 2 Welcome Page
|
|
76
|
+
|
|
77
|
+
The _Welcome page_ is the default opening window.
|
|
78
|
+
|
|
79
|
+

|
|
80
|
+
|
|
81
|
+
### 3 Monitoring
|
|
82
|
+
|
|
83
|
+
The _Monitoring_ navigation tab allows you to monitor _incoming_ and _outgoing_ requests to / from the **Testing Toolkit**.
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
By following the docker installation instructions in the [README](/README.md) document, you should have the **Mojaloop Simulator UI** open in your browser tab. On the **Mojaloop Simulator UI** open browser, go to the navigation bar on the left and click on _Outbound Send_ tab.
|
|
88
|
+
|
|
89
|
+
Press _**Send Transfer**_ button on the main window to send sample test data from the **Mojaloop Simulater UI** to the **Mojaloop Testing Toolkit**.
|
|
90
|
+
|
|
91
|
+

|
|
92
|
+
|
|
93
|
+
You should receive a response on the **Mojaloop Simulator UI** as indicated below. **Note** the variable data are generated randomly, therefore it could differ from the information displayed in the images provided below.
|
|
94
|
+
|
|
95
|
+

|
|
96
|
+
|
|
97
|
+
Go back to the **Mojaloop Testing Toolkit UI** in your browser and select from the navigation bar on the left the _Monitoring_ tab. You will notice the three operations associated with the above transfer request send. The most recent request with the associated operations will be the most recent displayed item on the main page and can be verified by the date/time stamp associated to each operation.
|
|
98
|
+
|
|
99
|
+
- GET /parties/{Type}/{ID}
|
|
100
|
+
- POST /quotes
|
|
101
|
+
- POST /transfers
|
|
102
|
+
|
|
103
|
+

|
|
104
|
+
|
|
105
|
+
To view detailed information on any one of the Callbacks, click on the operation - in this example _**GET /parties/MSISDN/0001**_ presented as a _blue button_.
|
|
106
|
+
|
|
107
|
+
If you recall the [Architecture Diagram](/documents/Mojaloop-Testing-Toolkit.md#7-architecture) mentioned earlier, under messages, you'll notice, Version negotiation, Schema Validation and Additional validations;
|
|
108
|
+
|
|
109
|
+
Clicking on the _+_ to the left of the expanded list on the main window to view detail related to that specific timeline message.
|
|
110
|
+
|
|
111
|
+

|
|
112
|
+
|
|
113
|
+
As an example for this document, the above messages in the image has be expanded to provide better insight.
|
|
114
|
+
|
|
115
|
+
- Request: get/parties/MSISDN/000111
|
|
116
|
+
- This contains the body of the request
|
|
117
|
+
- Version negotiation succeeded, picked up the version 1.0
|
|
118
|
+
- Confirm the API version that was used
|
|
119
|
+
- Callback rules are matched
|
|
120
|
+
- The callback rule used in this process. This can be customized, and will be covered later in this document
|
|
121
|
+
- Received callback response 200 OK
|
|
122
|
+
- The http response for the previous step "Sending callback put /parties/MSISDN/000111"
|
|
123
|
+
|
|
124
|
+
When you send more transfers from the **Mojaloop Simulator UI**, these transactions will be added to the monitoring event.
|
|
125
|
+
|
|
126
|
+

|
|
127
|
+
|
|
128
|
+
### 4 Rules
|
|
129
|
+
|
|
130
|
+
#### 4.1 Sync Response Rules
|
|
131
|
+
|
|
132
|
+
**_Validation and synchronous response based on the schema of the code_**
|
|
133
|
+
|
|
134
|
+
The _Sync Response Rules_ navigation tab on the left of the **Mojaloop Testing Toolset** allow you the setup fixed or mock responses. Take note of the _default.json_ file on the right hand side window. That contains the list of operations and sample content for mock or fixed responses for the operations listed on the center window. These can be tested by running the collection in Postman. (Import the [collection](/postman/mojaloop-pdp-testing-tool.postman_collection.json) and [environment](/postman/mojaloop-pdp-testing-tool.postman_environment.json) files into Postman testing tool.)
|
|
135
|
+
|
|
136
|
+

|
|
137
|
+
|
|
138
|
+
Below is a sample **MOCK_RESPONSE**
|
|
139
|
+
|
|
140
|
+

|
|
141
|
+
|
|
142
|
+
Below is a sample **FIXED_RESPONSE**
|
|
143
|
+
|
|
144
|
+

|
|
145
|
+
|
|
146
|
+
#### 4.2 Validation Rules
|
|
147
|
+
|
|
148
|
+
_**Error Callbacks**_
|
|
149
|
+
|
|
150
|
+
This Rules section is to simulate asynchronous error callbacks.
|
|
151
|
+
|
|
152
|
+
The setup and functionality is similar to [4 Sync Response Rules](#24-sync-response-rules) with the ability to create your own Rules file. This has already been explained in the previous section under [4.1 Building your own Rules File](#241-building-your-own-rules-file).
|
|
153
|
+
|
|
154
|
+

|
|
155
|
+
|
|
156
|
+
#### 4.3 Callback Rules
|
|
157
|
+
|
|
158
|
+
_**Success Callbacks**_
|
|
159
|
+
|
|
160
|
+
This Rules section is to simulate asynchronous success callbacks.
|
|
161
|
+
|
|
162
|
+
The same applies for this section, the functionality is similar to [4 Sync Response Rules](#4-sync-response-rules) with the ability to create your own Rules file. This has already been explained in the previous section under [4.1 Building your own Rules File](#41-building-your-own-rules-file).
|
|
163
|
+
|
|
164
|
+

|
|
165
|
+
|
|
166
|
+
#### 4.4 Building your own Rules File
|
|
167
|
+
|
|
168
|
+
The toolset allows you to create your own file with a collection of rules to suite your specific testing requirements. A rule can be created completely with the web UI. But for advanced users and a comprehensive insight, please view the [Rules Engine](/RULES_ENGINE.md) document for more information related to the **Rules Engine**.
|
|
169
|
+
|
|
170
|
+
The following section will provide an overview into building your own Rules file.
|
|
171
|
+
|
|
172
|
+
On the left window, click the _**New Rules File**_ button in the top left. Provide an appropriate file name. Remember to save it with a _.json_ extension. Click on the _**√**_ to create/save the file.
|
|
173
|
+
|
|
174
|
+

|
|
175
|
+
|
|
176
|
+
Click on the _**Add a new Rule**_ button on the middle top center window. The **Rule Builder** window will popup.
|
|
177
|
+
|
|
178
|
+

|
|
179
|
+
|
|
180
|
+
Firstly, select your desired **API** from the drop down list provided. All of the supported API's are included in this list.
|
|
181
|
+
|
|
182
|
+

|
|
183
|
+
|
|
184
|
+
Next, select the _operationId_ you require for the new rule in the **Resource** dropdown list. All the _operationId_'s are listed in the dropdown list. Click on the down arrow to provide the selection. The list is as per the Swagger definition of the API selected.
|
|
185
|
+
|
|
186
|
+

|
|
187
|
+
|
|
188
|
+

|
|
189
|
+
|
|
190
|
+
You will be presented with 4 boxes each with a dropdown list to select from;
|
|
191
|
+
|
|
192
|
+
- _**Fact Type**_
|
|
193
|
+
- _**Fact**_
|
|
194
|
+
- _**Operation**_
|
|
195
|
+
- _**Value**_
|
|
196
|
+
|
|
197
|
+
For each of the above mentioned items, click on the down arrow in the item box to list the selection options to select from. These selection options are as per the Swagger definition for the selected **API** above.
|
|
198
|
+
|
|
199
|
+

|
|
200
|
+
|
|
201
|
+
You can use configurable param in Value field. You can select one by clicking on **Add Configuration Params** button.
|
|
202
|
+
|
|
203
|
+

|
|
204
|
+
|
|
205
|
+
Next step would be to select the **EVENT Type** detail below. Click on the down arrow in the item box to list the option. Select either _**Mock Response**_ or _**Fixed Response**_.
|
|
206
|
+
|
|
207
|
+

|
|
208
|
+
|
|
209
|
+
For normal use cases you can select _**Mock Response**_, where the testing toolkit can generate mock data based on the schema in the swagger file. By selecting the _**Mock Response**_, you will have the option to override the standard mock response by selecting _**Override some parameters**_ tick box. This will open the **Headers**. Your options to select from are _**Add Header**_, _**Add Required Header**_, _**Add All Headers**_.
|
|
210
|
+
|
|
211
|
+

|
|
212
|
+
|
|
213
|
+
A sample body can also be created. The data is generated by using the swagger definition pertaining to the specified _operationId_. There are no real "value" to the sample data, but it can be edited in the editing console to be more meaningfull for testing purposes.
|
|
214
|
+
|
|
215
|
+
Click on the _**Populate with sample body**_ button. The editing window will be filled with the sample data for the body of the selected **Resource** _operationId_.
|
|
216
|
+
|
|
217
|
+

|
|
218
|
+
|
|
219
|
+
Update the sample body if so required.
|
|
220
|
+
|
|
221
|
+

|
|
222
|
+
|
|
223
|
+
The body of the response can be configured. Click on the _**Add Configurable Params**_. The **Select a Configurable Parameter** window will pop-up with a list of valid selections. Once completed, the **Configured Parameter** is copied to clipboard by clicking on the completed ```{$request.body.state}```. This can then be used within the latter as can be seen in the sample rules image below.
|
|
224
|
+
|
|
225
|
+

|
|
226
|
+
|
|
227
|
+
Once completed, you should save the newly create rule by selecting the _**Save**_ button on the top of the **Rule Builder** window.
|
|
228
|
+
|
|
229
|
+
This will provide a summarized view of the newly created rule, similar to the samples provided.
|
|
230
|
+
|
|
231
|
+

|
|
232
|
+
|
|
233
|
+
Going forward, the option exist to updated the rule or delete it by selecting the appropriate button - _**Edit**_ or _**Delete**_.
|
|
234
|
+
|
|
235
|
+
Lastly, set the new rule file as active by selecting the new rule file on the right hand side window and selecting the _**Set as active**_ button. You will see the _**√**_ mark next to it to indicate it is active.
|
|
236
|
+
|
|
237
|
+
You have the option to include one or more **CONDITIONS** for the new rule. Select the _**Add Condition**_ button should you wish to add an additional condition to your rule.
|
|
238
|
+
|
|
239
|
+
#### 4.5 Inbound Scripting
|
|
240
|
+
|
|
241
|
+
You have the option to enable or disable inbound requests scripts. You can use Scripts tab to set dfsp positions and do validations later. In the given example we are updating the ttkdfspTotalAmount if the transfer request is successfull for testingtoolkit dfsp. You could execute p2p-happy-path with fromFspId equal to testingtoolkitdfsp and go back to Environment tab to see the total amount.
|
|
242
|
+
|
|
243
|
+

|
|
244
|
+
|
|
245
|
+
In the Environment tab you could observe the current environment state.
|
|
246
|
+
|
|
247
|
+

|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
You can write scripts in two formats.
|
|
251
|
+
|
|
252
|
+
- **Postman Script:**
|
|
253
|
+
|
|
254
|
+
If you select postman script option, you can use the same functions like pm.sendRequest as in postman. _(Postman script format in the Testing Toolkit is deprecated and not encouraged, please use javascript format)_
|
|
255
|
+
|
|
256
|
+
- **Java Script:**
|
|
257
|
+
|
|
258
|
+
If you want advanced features and flexibility, you can select javascript option. This option enables you to write the scripts in javascript format and you can use the following functions.
|
|
259
|
+
- **console.log** - function
|
|
260
|
+
- **request** - variable
|
|
261
|
+
- **environment** - variable
|
|
262
|
+
- **axios** - library
|
|
263
|
+
|
|
264
|
+
With axios library, you can use various functions like axios.get, axios.post...etc. Please note these functions are async functions and you may need to use `await` before the function.
|
|
265
|
+
```
|
|
266
|
+
const resp = await axios.get('http://someurl')
|
|
267
|
+
```
|
|
268
|
+
You can find the documentation about axios at this link https://github.com/axios/axios#axios-api
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
### 5 Outbound Request
|
|
272
|
+
|
|
273
|
+
This sections will enable you to intiate requests from the testing toolkit to your DFSP / HUB implementations.
|
|
274
|
+
|
|
275
|
+
The user can create a collection of operations and add a number of assertions to these operations. The assertions can be setup and customized to support your testing requirements and verify both positive and negative requests and responses.
|
|
276
|
+
|
|
277
|
+
Selecting the _**Outbound Request**_ navigation tab on the left side, the following will open in the main display window.
|
|
278
|
+
|
|
279
|
+

|
|
280
|
+
|
|
281
|
+
At the top of the screen, you will notice the following buttons on the main window, starting from the left.
|
|
282
|
+
|
|
283
|
+
- _**Collections Manager**_
|
|
284
|
+
- _**Load Sample**_
|
|
285
|
+
- _**Show Current Template**_
|
|
286
|
+
- _**Iteration Runner**_
|
|
287
|
+
- _**Send**_
|
|
288
|
+
|
|
289
|
+
You can see two tabs _'Test Cases'_ and _'Input Values'_.
|
|
290
|
+
|
|
291
|
+

|
|
292
|
+
|
|
293
|
+
#### 5.1 Collection Manager
|
|
294
|
+
|
|
295
|
+
By selecting the _**Collection Manager**_ button, it will open a drawer on left which contains a number of file operations. That will allow you to import, export and modify a collection. For your exploration, sample collections are available under the project root directory under [/examples/collections](/examples/collections) sub directory. To select one of the sample files, on the file explorer window that poped up when you selected the _**Import File**_ button, navigate to [/examples/collections/dfsp](/examples/collections/dfsp) under the project root directory. Select the ```p2p_happy_path.json``` file to import into the **Mojaloop Testing Toolkit** application. You should select the file in the collection manager, and observe the test cases should be loaded in the main screen. You could add more test cases by clicking on _Add Test Case_ button
|
|
296
|
+
|
|
297
|
+

|
|
298
|
+
|
|
299
|
+
_**P2P Transfer Happy Path**_
|
|
300
|
+
|
|
301
|
+
- **get/parties/{Type}/{ID}** - Get party information
|
|
302
|
+
|
|
303
|
+
- **post/quotes** - Get quote
|
|
304
|
+
|
|
305
|
+
- **post/transfers** - Send transfer
|
|
306
|
+
|
|
307
|
+

|
|
308
|
+
|
|
309
|
+
#### 5.2 Import Environment
|
|
310
|
+
By selecting the _**Import Environment**_ button in _Input Values_ tab, it will allow you to import input values. For your exploration, sample environments are available under the project root directory under [/examples/environments](/examples/environments) sub directory. To select one of the sample files, on the file explorer window that poped up when you selected the _**Import Environment**_ button, navigate to [/examples/environments](/examples/environments) under the project root directory. Select the ```dfsp_local_environment.json``` file to import into the **Mojaloop Testing Toolkit** application. This sample file consist of a couple of input values.
|
|
311
|
+
|
|
312
|
+
It is possible to update the **Input Values** on the right hand side window. Additional input values can be added, by selecting the _**Add Input Value**_ button on the top right of this right hand side window. These values relates to the specified variable that you can select and use in any **Request** that you create.
|
|
313
|
+
|
|
314
|
+

|
|
315
|
+
|
|
316
|
+
The process is straight forward. Provide a name for the new input value and click on the _**Add**_ button.
|
|
317
|
+
|
|
318
|
+

|
|
319
|
+
|
|
320
|
+
To update values of exisiting variable(s) to the **Input Values**, simply select the value next to the variable and type in a new value. It will then be available for use in the test cases imported earlier.
|
|
321
|
+
|
|
322
|
+

|
|
323
|
+
|
|
324
|
+
#### 5.3 Test Cases
|
|
325
|
+
|
|
326
|
+
Click on the _**Edit**_ button, to open up the _**Test Case**_ in the edit mode.
|
|
327
|
+
|
|
328
|
+

|
|
329
|
+
|
|
330
|
+
##### 5.3.1 Request
|
|
331
|
+
|
|
332
|
+
The **Request** tab reflects both the appropriate _Header_ and _Body_ that makes up the request as per the selected **API** swagger specification. These values can be changed in the **Editor** tab.
|
|
333
|
+
|
|
334
|
+

|
|
335
|
+
|
|
336
|
+
##### 5.3.2 Editor
|
|
337
|
+
|
|
338
|
+
The **Editor** tab displays request content and it can be updated manually on this window. Depending on how the request was defined, you will be able to see the selected **API**, the _operationId_, the _Header_ and _Body_ content. Options to _**Duplicate**_, _**Delete**_ or _**Rename**_ are also available as buttons above. There are some additional options like _Override with Custom URL_ or _Ignore Callbacks_. You can also build your own new request by selecting the _**Add New Request**_ button on the top right of this window. The process to build a new request is similar to the one explained in [2.4 Sync Response Rules](#24-sync-response-rules)
|
|
339
|
+
|
|
340
|
+

|
|
341
|
+
|
|
342
|
+
##### 5.3.3 Scripts
|
|
343
|
+
|
|
344
|
+
The **Scripts** tab allows you to use postman like pre request and test scripts. Make sure that advanced features options is enabled.
|
|
345
|
+
|
|
346
|
+
You can write scripts in two formats.
|
|
347
|
+
|
|
348
|
+
- **Postman Script:**
|
|
349
|
+
|
|
350
|
+
If you select postman script option, you can use the same functions like pm.sendRequest as in postman. This option is usefull when you want to convert your existing postman tests to testing toolkit format.
|
|
351
|
+
- pm.test - not supported - Use Testing Toolkit Tests for this purpose. In **Tests** You could use values stored in the environment. To access thoes values use environment.'key'
|
|
352
|
+
- pm.response - to get the response object outside pm.sendRequest use pm.response.body not pm.response.json()
|
|
353
|
+
- everything else should work the same way is in postman
|
|
354
|
+
|
|
355
|
+
- **Java Script:**
|
|
356
|
+
|
|
357
|
+
If you want advanced features and flexibility, you can select javascript option. This option enables you to write the scripts in javascript format and you can use the following functions.
|
|
358
|
+
- **console.log** - function
|
|
359
|
+
- **response** - variable
|
|
360
|
+
- **environment** - variable
|
|
361
|
+
- **axios** - library
|
|
362
|
+
|
|
363
|
+
With axios library, you can use various functions like axios.get, axios.post...etc. Please note these functions are async functions and you may need to use `await` before the function.
|
|
364
|
+
```
|
|
365
|
+
const resp = await axios.get('http://someurl')
|
|
366
|
+
```
|
|
367
|
+
You can find the documentation about axios at this link https://github.com/axios/axios#axios-api
|
|
368
|
+
- **websocket** - library
|
|
369
|
+
|
|
370
|
+
With websocket library, you can connect to a websocket server and get the first message from the server.
|
|
371
|
+
|
|
372
|
+
Functions supported:
|
|
373
|
+
|
|
374
|
+
- _**websocket.connect**_ - To connect to a websocket URL and listen for messsages
|
|
375
|
+
- _**websocket.getMessage**_ - To get the message arrived. This function can also wait for the message some time. The session will be disconnected automatically after returning the message
|
|
376
|
+
- _**websocket.disconnect**_ - To disconnect a particular session
|
|
377
|
+
- _**websocket.disconnectAll**_ - To disconnect all the sessions
|
|
378
|
+
|
|
379
|
+
This will be used to assert on the payee side data from the sdk-scheme-adapter in tests cases. You may need to enable websocket capabilities in the sdk-scheme-adapter.
|
|
380
|
+
|
|
381
|
+
**Examaple:**
|
|
382
|
+
|
|
383
|
+
In Pre-request
|
|
384
|
+
```
|
|
385
|
+
await websocket.connect('ws://localhost:4002/requests/{$inputs.toIdValue}', 'payeeRequest')
|
|
386
|
+
```
|
|
387
|
+
In Post-request
|
|
388
|
+
```
|
|
389
|
+
environment.payeeRequest = await websocket.getMessage('payeeRequest')
|
|
390
|
+
```
|
|
391
|
+
Then you can use the above environment variable in assertions.
|
|
392
|
+
```
|
|
393
|
+
environment.payeeRequest.headers['content-type']
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
- **inboundEvent** - library
|
|
397
|
+
|
|
398
|
+
With inboundEvent library, you can listen on an inbound request to testing toolkit
|
|
399
|
+
|
|
400
|
+
Functions supported:
|
|
401
|
+
|
|
402
|
+
- _**inboundEvent.addListener(clientName, method, path, [conditionFn], [timeout])**_
|
|
403
|
+
|
|
404
|
+
To start listening for the inbound messsages to TTK
|
|
405
|
+
|
|
406
|
+
Parameters:
|
|
407
|
+
- **clientName** - Client name to be referred later in postrequest script
|
|
408
|
+
|
|
409
|
+
Type: [`String`]
|
|
410
|
+
|
|
411
|
+
- **method** - Http method to match
|
|
412
|
+
|
|
413
|
+
Type: [`Request`]
|
|
414
|
+
|
|
415
|
+
- **path** - Http path to match
|
|
416
|
+
|
|
417
|
+
Type: [`Request`]
|
|
418
|
+
|
|
419
|
+
- **conditionFn** (optional) - An optional function to call for addional matching logic
|
|
420
|
+
|
|
421
|
+
Type: [`Function`]
|
|
422
|
+
|
|
423
|
+
Parameters passed: (`request.headers, request.body`)
|
|
424
|
+
|
|
425
|
+
Return Value: [`Boolean`]
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
- **timeout** - Time in ms to wait for the inbound request
|
|
429
|
+
|
|
430
|
+
Type: [`integer`]
|
|
431
|
+
|
|
432
|
+
Example usage:
|
|
433
|
+
```javascript
|
|
434
|
+
await inboundEvent.addListener('quote1', 'post', '/quotes', (headers, body) => {
|
|
435
|
+
return body.quoteId === '<SOME_ID_HERE>'
|
|
436
|
+
})
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
- _**inboundEvent.getMessage(clientName, [timeout])**_
|
|
440
|
+
|
|
441
|
+
To get the message arrived. This function can also wait for the message some time. The session will be disconnected automatically after returning the message
|
|
442
|
+
|
|
443
|
+
Parameters:
|
|
444
|
+
- **clientName** - Client name to get the message from. The name should match with the name provided in the addListener call.
|
|
445
|
+
|
|
446
|
+
Type: [`String`]
|
|
447
|
+
|
|
448
|
+
- **timeout** - Time in ms to wait for the inbound request
|
|
449
|
+
|
|
450
|
+
Type: [`integer`]
|
|
451
|
+
|
|
452
|
+
Example usage:
|
|
453
|
+
```javascript
|
|
454
|
+
await inboundEvent.getMessage('quote1')
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
- **custom.setRequestTimeout** - To set a specific timeout value for the request in milli seconds (Default: 3000ms)
|
|
458
|
+
- **custom.sleep** - To wait for particular amount of milli seconds
|
|
459
|
+
- **custom.jws** - library
|
|
460
|
+
|
|
461
|
+
With custom.jws library, you can sign and validate an FSPIOP request using JWS
|
|
462
|
+
|
|
463
|
+
Functions supported:
|
|
464
|
+
|
|
465
|
+
- _**custom.jws.signRequest**(<PRIVATE_KEY>)_ - To sign the outgoing request using the private key
|
|
466
|
+
- _**custom.jws.validateCallback**(<callback.headers>, <callback.body>, <PUBLIC_CERTIFICATE>)_ - To validate the incoming callback using public certificate. This will validate protected headers too.
|
|
467
|
+
- _**custom.jws.validateCallbackProtectedHeaders**(<callback.headers>)_ - To validate only protected headers in the FSPIOP-Signature header
|
|
468
|
+
- **custom.skipRequest** - function
|
|
469
|
+
|
|
470
|
+
By using this function in the pre-request script, you can skip the current request including post-request-scripts and assertions. You can see the request and assertions as skipped in the UI and in the report as well.
|
|
471
|
+
|
|
472
|
+
- _**custom.pushMessage(message, [sessionID])**_
|
|
473
|
+
|
|
474
|
+
By using this function in the scripts in rules for inbound requests, you can push a websocket message to the clients listening on the websocket server of TTK and on topic 'pushMessage'. There is an optional sessionId that we can pass as second argument to this function
|
|
475
|
+
|
|
476
|
+
Parameters:
|
|
477
|
+
- **message** - The message object to emit to the clients.
|
|
478
|
+
|
|
479
|
+
Type: [`Object`]
|
|
480
|
+
|
|
481
|
+
- **sessionID** - Optional sessionID to send message to targetted clients who are listening on the topic 'pushMessage/<sessionID>'
|
|
482
|
+
|
|
483
|
+
Type: [`string`]
|
|
484
|
+
|
|
485
|
+
Example usage:
|
|
486
|
+
```javascript
|
|
487
|
+
await custom.pushMessage({ name: 'Sample Name' })
|
|
488
|
+
await custom.pushMessage({ name: 'Sample Name' }, 'client1')
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
- _**custom.appendRequestBody(requestBody)**_
|
|
492
|
+
|
|
493
|
+
By using this function in the outbound pre-request script, we can mutate the request and override some values in the request.
|
|
494
|
+
|
|
495
|
+
Parameters:
|
|
496
|
+
- **requestBody** - The request body to override.
|
|
497
|
+
|
|
498
|
+
Type: [`Object`]
|
|
499
|
+
|
|
500
|
+
Example usage:
|
|
501
|
+
```javascript
|
|
502
|
+
await custom.appendRequestBody({ sampleKey: 'Sample Value' })
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
- _**custom.appendEventBody(eventBody)**_
|
|
506
|
+
|
|
507
|
+
By using this function in the inbound script, we can modify the event body specified in the rule.
|
|
508
|
+
|
|
509
|
+
Parameters:
|
|
510
|
+
- **eventBody** - The event body to override.
|
|
511
|
+
|
|
512
|
+
Type: [`Object`]
|
|
513
|
+
|
|
514
|
+
Example usage:
|
|
515
|
+
```javascript
|
|
516
|
+
await custom.appendEventBody({ sampleKey: 'Sample Value' })
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+

|
|
520
|
+
|
|
521
|
+
After executing the test case you will see _Console Log_ and _Environment State_ as well.
|
|
522
|
+
|
|
523
|
+
- _Console Log_
|
|
524
|
+
|
|
525
|
+

|
|
526
|
+
|
|
527
|
+
- _Environment State_
|
|
528
|
+
|
|
529
|
+

|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
##### 5.3.4 Tests
|
|
533
|
+
|
|
534
|
+
The **Tests** tab contains the assertions that was setup for the specified _operationId_. These are similar to PostMan tests and will evaluate the request and/or the response based on the requirements of the assertion. The below is an assertion from the sample _Import Template_ imported earlier, and validate the Callback and expect the _**response.status**_ to be equal to _**202**_.
|
|
535
|
+
|
|
536
|
+

|
|
537
|
+
|
|
538
|
+
To create a new assertion, you can either add to an existing assertion, or choose to set-up a new assertion. Apart from naming new assertion,the rest of the steps are the same in both cases. We will only cover the basic set-up for this document. The options to _**Rename**_ or _**Delete**_ the assertion are also avalable.
|
|
539
|
+
|
|
540
|
+
To create a new assertion, select the _**Add New Assertion**_ button on the top right. Provide an appropriate name and click on the _**Add**_ button.
|
|
541
|
+
|
|
542
|
+

|
|
543
|
+
|
|
544
|
+
The new assertion will be available at the bottom of the existing assertions for that operation.
|
|
545
|
+
|
|
546
|
+
Navigate to the newly created assertion, and click on the arrow on the left to expand the dropdown list.
|
|
547
|
+
|
|
548
|
+

|
|
549
|
+
|
|
550
|
+
Include a new expectation by selecting the _**Add Expectation**_ button at the bottom left. This will launch the **Expectation** window. Selecting the first box will provide you with the option to either select a synchronous response or a callback to be assessed.
|
|
551
|
+
|
|
552
|
+

|
|
553
|
+
|
|
554
|
+
We have opted for the _Response_. Next select the field to be assessed - _Status_ was selected for this demo.
|
|
555
|
+
|
|
556
|
+

|
|
557
|
+
|
|
558
|
+
Select the equation from the middle box. We have opted for _Not Equal to_.
|
|
559
|
+
|
|
560
|
+

|
|
561
|
+
|
|
562
|
+
Add the required value in the last box and click on the _**Save**_ button. Congratulations - you have successfully created an assertion.
|
|
563
|
+
|
|
564
|
+

|
|
565
|
+
|
|
566
|
+
It is also possible to compare the values from **Input Values** or the parameters from the request. Select the _**Configurable Parameter**_ button at the bottom right to launch the **Configurable Parameter** window. Click on the dropdown box to provide the list of possible options. We have selected _Input Values_ for this demo.
|
|
567
|
+
|
|
568
|
+

|
|
569
|
+
|
|
570
|
+
Click on the **Input Values** box below to display the dropdown list. Select one of the options listed. We have chosen _currency_ for this demo.
|
|
571
|
+
|
|
572
|
+

|
|
573
|
+
|
|
574
|
+
The _Configurable Parameter_ ```{$inputs.currency}``` is now available for use with the option to _Copy to clipboard_ or _Insert into editor_.
|
|
575
|
+
|
|
576
|
+
To get a better understanding of how this will work, please refer to the below. This assertion is part of the samples provided. This assertion contains 2 expectations. You will notice it is possible to refer to the values from the previous _operationId_ ```$prev.2.callback.body.*``` and can be compared to the values from the current _operationId_ ```$request.body.*```. Due to the technical nature of these assertions, it will be explained in detail in a seperate document.
|
|
577
|
+
|
|
578
|
+

|
|
579
|
+
|
|
580
|
+
#### 5.4 Download Report
|
|
581
|
+
|
|
582
|
+
You could download a report in several formats by clicking on _Download Report_ in the top right corner:
|
|
583
|
+
- JSON
|
|
584
|
+
- HTML
|
|
585
|
+
- Printer Friendly HTML
|
|
586
|
+
|
|
587
|
+

|
|
588
|
+
|
|
589
|
+
#### 5.5 New Template
|
|
590
|
+
|
|
591
|
+
You could create a new template by clicking on _New Template_ button the top right corner
|
|
592
|
+
|
|
593
|
+
#### 5.6 Show Template
|
|
594
|
+
|
|
595
|
+
You could view the template by clicking on _Show Template_ button in the top right corner
|
|
596
|
+
|
|
597
|
+
#### 5.7 Save
|
|
598
|
+
|
|
599
|
+
You could save the collection or the environment by clicking on _Save_ button in the top right corner
|
|
600
|
+
|
|
601
|
+
#### 5.8 Send
|
|
602
|
+
|
|
603
|
+
You could execute the whole template by clicking on _Send_ button in the top right corner. Please insure you added a user with {MSISDN} and value found in the **Input Values** on the simulator (see [Frequently Asked Questions](/documents/Mojaloop-Testing-Toolkit.md#4-frequently-asked-questions) section [4.2 Generic ID not found](/documents/Mojaloop-Testing-Toolkit.md#42-eneric-id-not-found)).
|
|
604
|
+
(/documents/Mojaloop-Testing-Toolkit.md#7-architecture)
|
|
605
|
+
|
|
606
|
+

|
|
607
|
+
|
|
608
|
+
- Select the aditional options and _**Send this test case**_ button on the right top.
|
|
609
|
+
|
|
610
|
+

|
|
611
|
+
|
|
612
|
+
- Select _**Edit**_ and then the _**Send**_ button on the right top.
|
|
613
|
+
|
|
614
|
+

|
|
615
|
+
|
|
616
|
+
If you select the _**Edit**_ button now, you will notice the addition of the response tab. Select that to view all the responses for the operation.
|
|
617
|
+
|
|
618
|
+

|
|
619
|
+
|
|
620
|
+
#### 5.9 Download Testcase Definition
|
|
621
|
+
|
|
622
|
+
You can download a report with all the definitions of testcases (like descriptions for all the requests in a test case, expected results ...etc) Currently only HTML format is supported and by clicking on _Download Definition_ at the right side of begining of the test cases.
|
|
623
|
+
|
|
624
|
+

|
|
625
|
+
|
|
626
|
+
And you can edit meta information about each testcase and request using the option provided.
|
|
627
|
+
|
|
628
|
+

|
|
629
|
+
|
|
630
|
+
### 6 Settings
|
|
631
|
+
|
|
632
|
+
The _**SETTINGS**_ navigation tab will open to the **SETTINGS** window. Below is the default view of this page.
|
|
633
|
+
|
|
634
|
+

|
|
635
|
+
|
|
636
|
+
- The **SETTINGS** window consist of the following two windows;
|
|
637
|
+
- On the left **Runtime Global Configuration** displays the actual configuration that is effectively active by the **Mojaloop Testing Toolkit** service.
|
|
638
|
+
- On the right **Edit Global Configuration** amongst a couple of other options, it allows you to edit the values manually. Should you elect to use other environment values you can disable the default values by selecting the _**Override with Environment Variable**_ option.
|
|
639
|
+
|
|
640
|
+
- In a default docker deployment, the environment values will be provided in the _local.env_ file in the project root directory.
|
|
641
|
+
|
|
642
|
+

|