Testing
There are currently 2 sets of tests in the UXDProgram:
End to End (E2E) testing done in Javascript using the uxd-client
Unit Testing done in Rust directly in the program source code
E2E
The goal of the E2E tests is to ensure that the program instructions behave as expected, with a variety of input and in different contexts.
There are should fail test that expect a KO, wrong context tests that expect KO, stress tests with intensive calls and sanity tests for accounts and on-chain account states.
These tests are located in the test folder of the uxd-program codebase, they are divided in cases, suites and scenarios.
Case are about unitary instruction calls, with check about this singular logic.
Suites are clusters of Cases put together to form coherent business logic and tests their interactions.
Scenario are the file containing the full groupement of suites for a given collateral for instance.
Unit Tests
Unit tests are aiming at validating and preventing regression on very small logical blocks in the contract, mostly calculation logic.
Note
In a perfect world, there would be a full testing suite, deterministic and reproducible doing E2E like test in rust, as what Serum does. But that is a titan task that hasn't been tackled yet, and that will probably never be.
Last updated
Was this helpful?