Testing basics
RippleNet Test Harness can test payments that are sent or received in either active or passive mode.
-
Passive mode
is the default mode with two workflows:
- (1) A " happy path " payment flow with toggles to control locking or completing payment.
- (2) Actively failing payment.
- Active mode allows you to design test cases in a test profile based on business workflows that include unhappy paths , edge cases , return payments, sub-states, and so on.
When Test Harness encounters a payment, it acts according to the mode of that payment's Test record. When you create or "open" an active mode test, the test record is generated from a test profile (of defined test cases). It sets the expected results and displays the actual results and is updated dynamically.
For more information, see Testing Terms.
Passive mode
In passive mode, a default workflow is applied to a payment. The term, "default" means slightly different things depending on whether the Test Harness sends or receives payments. In general, a passive mode test is one that does not map to an active and OPEN
test record (with a test case ID).
Sender tests
In a Test Harness that receives payments, default means passive mode. If an active payment is received without a matching test case ID, it becomes a passive test and displays on the passive test record.
Receiver tests
In a Test Harness that sends payments, default means a DEFAULT
payment from the payment template set. If an active test profile cannot find a payment with a matching test case ID, it uses a DEFAULT
payment from the template (if it exists). These payments display on the active (not the passive) test record.
Active mode
In active mode, payments are tested based on test cases that you define in a test profile (from which a test record is generated when a new test is opened). You can create and edit test profiles in the UI using Profile editor.
Test Harness scans the user_info
of each payment for a test case ID to match the defined test cases. If an ID matches an ID in the test record (which must be in the OPEN
state), the test runs in active mode; otherwise, it uses a default workflow.
Define your Test Case ID
To run tests in active mode, the Test Case ID must be defined within the payment's user_info
and it must be prepended by TCID-
. For example, if a Test Profile defines "test_case_id": "1.01"
then user_info
in the payment must include {"TxId":"TCID-1.01"}
.
Here is an example from the test profile in Run active mode sender tests:
{
"test_case_id": "1.03",
"test_case_description": "This test passes if the payment is COMPLETED within 35 minutes. Test Harness rejects the ACCEPTED payment twice with ISO codes RC04 and FF06 respectively, then locks the third time.",
"execution_steps": [
{
"state": "ACCEPTED",
"action": "REJECT_LOCK",
"action_data": "2;RC04,FF06"
},
{
"state": "EXECUTED",
"action": "COMPLETE"
}
],
"expected_results": [
{
"criterion": "STATE",
"value": "COMPLETED"
},
{
"criterion": "MAX_DURATION_MINS",
"value": "35"
},
{
"criterion": "RECEIVER_LOCK_DECLINED_CODES",
"value": "RC04,FF06"
}
]
}
If more than one payment arrives for the same test case in a single test, each one is processed according to the execution steps in the test case. However, only one (non-deterministic) is used when evaluating the test case's outcome.