Skip to content

Export to Tests - Convert Interactive Tests to Automated CI/CD

Export to Tests is a planned feature that will allow you to convert your interactive testing sessions in Testship into automated test code that runs in your CI/CD pipeline.

The goal is to bridge the gap between manual interactive testing and automated test suites, allowing you to:

  • Test interactively during development
  • Export successful test flows as code
  • Integrate with existing test frameworks
  • Run tests automatically in CI/CD

Record your testing actions:

  • Capture instruction calls
  • Save account configurations
  • Record parameter values
  • Store expected results

Export to multiple formats:

TypeScript/Anchor Tests

describe("my-program", () => {
it("initializes account", async () => {
await program.methods
.initialize()
.accounts({
user: userPda,
authority: provider.wallet.publicKey,
systemProgram: SystemProgram.programId,
})
.rpc();
});
});

Rust Integration Tests

#[test]
fn test_initialize() {
let program_test = ProgramTest::new(...);
let mut context = program_test.start_with_context().await;
// ... generated test code
}

Mocha/Jest Tests

test('transfer tokens', async () => {
const tx = await program.methods
.transfer(amount)
.accounts({ ... })
.rpc();
expect(tx).toBeTruthy();
});

Create comprehensive test suites:

  • Setup/teardown scripts
  • Multiple test cases
  • Edge case handling
  • Error scenarios
  • Success paths

Automatically generate assertions for:

  • Account state changes
  • Balance changes
  • Program logs
  • Event emissions
  • Error conditions

Customizable templates for:

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Fuzzing tests
  • Stress tests

Export tests to run in GitHub Actions:

- name: Run Anchor Tests
run: |
anchor test

Prevent bugs from reoccurring:

  1. Find bug through interactive testing
  2. Export the reproduction case
  3. Fix the bug
  4. Test suite ensures it stays fixed

Generate test documentation:

  • Markdown test reports
  • API usage examples
  • Integration guides
  • Troubleshooting scenarios

QA to Developer workflow:

  1. QA tests interactively in Testship
  2. Exports test case when bug found
  3. Shares exported test with developer
  4. Developer runs exact same test locally
testship.config.toml
[export]
# Export format
format = "typescript" # typescript, rust, javascript
# Test framework
framework = "anchor" # anchor, mocha, jest, rust-test
# Include options
include_setup = true
include_assertions = true
include_comments = true
include_documentation = true
# Output
output_dir = "./tests/exported"
overwrite = false
  • Record all RPC calls
  • Capture account state before/after
  • Save transaction parameters
  • Store results and errors
  • Parse captured test data
  • Generate idiomatic code for target language
  • Add proper error handling
  • Include descriptive comments
  • Integrate with existing test frameworks
  • Respect project structure
  • Use project dependencies
  • Follow naming conventions
  • How to recreate exact on-chain state?
  • Handle account initialization dependencies
  • Manage test isolation
  • Deal with non-deterministic elements
  • Handle clock-dependent logic
  • Manage transaction ordering
  • Tests on devnet vs mainnet-fork
  • Account address differences
  • Program deployment variations
  • Keep exported tests in sync with program
  • Update tests when IDL changes
  • Handle breaking changes gracefully

We’d love to hear from you:

  • Which test format would be most useful?
  • What’s your current testing workflow?
  • What features are must-haves?
  • Integration preferences?

Share your thoughts:

While we develop this feature, consider:

  • Copy transaction signatures
  • Recreate tests manually
  • Use Testship as reference
  • Record your testing session
  • Share videos with team
  • Document test procedures
  • Use Session Sharing to share live tests
  • Collaborative testing
  • Non-technical team member access

Phase 1: Research (Current)

  • Gather user feedback
  • Evaluate test frameworks
  • Design architecture

Phase 2: MVP (TBD)

  • Basic TypeScript/Anchor export
  • Simple test cases
  • Manual assertions

Phase 3: Advanced (TBD)

  • Multiple language support
  • Automatic assertions
  • Complex test scenarios
  • CI/CD templates

Phase 4: Polish (TBD)

  • Advanced features
  • Deep integrations
  • Performance optimization
  • Documentation

This feature is evolving based on community needs. To stay informed:

  • Follow @testshipxyz for updates
  • Visit testship.xyz for announcements
  • Join our community discussions
  • Contribute your ideas

This roadmap is subject to change based on user feedback, technical constraints, and development priorities.