Regression Testing#
Regression testing is the process of re-running tests to ensure that previously working functionality still works after code changes.
Trident enables regression testing by allowing you to specify which accounts should be included in the regression test, generating a JSON file with all monitored state, and providing a subcommand to compare two regression test results.
Regression Test Setup#
-
First, decide which account(s) should be included in the regression test.
-
Add accounts for tracking using the
add_to_regressionmethod:#[flow_executor] impl FuzzTest { #[init] fn start(&mut self) { let account = self.fuzz_accounts.target_account.insert(&mut self.trident, None); let instruction = create_initialize_instruction(account); let result = self.trident.process_transaction(&[instruction], Some("initialize")); if result.is_success() { // Add the account to regression tracking self.trident.add_to_regression(&account, "target_account"); } } } -
Enable the regression test in the Trident manifest by setting:
-
Run the fuzz test to generate the regression test data.
-
Run the same fuzz test with the same MASTER SEED on a different version of the program.
-
Run the following command to compare the generated JSON files: