Export to Tests - Convert Interactive Tests to Automated CI/CD
Overview
Section titled “Overview”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.
Vision
Section titled “Vision”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
Planned Features
Section titled “Planned Features”Test Recording
Section titled “Test Recording”Record your testing actions:
- Capture instruction calls
- Save account configurations
- Record parameter values
- Store expected results
Code Generation
Section titled “Code Generation”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();});
Test Scenarios
Section titled “Test Scenarios”Create comprehensive test suites:
- Setup/teardown scripts
- Multiple test cases
- Edge case handling
- Error scenarios
- Success paths
Assertions
Section titled “Assertions”Automatically generate assertions for:
- Account state changes
- Balance changes
- Program logs
- Event emissions
- Error conditions
Test Templates
Section titled “Test Templates”Customizable templates for:
- Unit tests
- Integration tests
- End-to-end tests
- Fuzzing tests
- Stress tests
Use Cases
Section titled “Use Cases”CI/CD Integration
Section titled “CI/CD Integration”Export tests to run in GitHub Actions:
- name: Run Anchor Tests run: | anchor test
Regression Testing
Section titled “Regression Testing”Prevent bugs from reoccurring:
- Find bug through interactive testing
- Export the reproduction case
- Fix the bug
- Test suite ensures it stays fixed
Documentation
Section titled “Documentation”Generate test documentation:
- Markdown test reports
- API usage examples
- Integration guides
- Troubleshooting scenarios
Team Handoff
Section titled “Team Handoff”QA to Developer workflow:
- QA tests interactively in Testship
- Exports test case when bug found
- Shares exported test with developer
- Developer runs exact same test locally
Planned Configuration
Section titled “Planned Configuration”[export]# Export formatformat = "typescript" # typescript, rust, javascript
# Test frameworkframework = "anchor" # anchor, mocha, jest, rust-test
# Include optionsinclude_setup = trueinclude_assertions = trueinclude_comments = trueinclude_documentation = true
# Outputoutput_dir = "./tests/exported"overwrite = false
Architecture
Section titled “Architecture”Test Capture
Section titled “Test Capture”- Record all RPC calls
- Capture account state before/after
- Save transaction parameters
- Store results and errors
Code Generator
Section titled “Code Generator”- Parse captured test data
- Generate idiomatic code for target language
- Add proper error handling
- Include descriptive comments
Test Runner Integration
Section titled “Test Runner Integration”- Integrate with existing test frameworks
- Respect project structure
- Use project dependencies
- Follow naming conventions
Challenges & Considerations
Section titled “Challenges & Considerations”State Management
Section titled “State Management”- How to recreate exact on-chain state?
- Handle account initialization dependencies
- Manage test isolation
Randomness & Timing
Section titled “Randomness & Timing”- Deal with non-deterministic elements
- Handle clock-dependent logic
- Manage transaction ordering
Network Variations
Section titled “Network Variations”- Tests on devnet vs mainnet-fork
- Account address differences
- Program deployment variations
Maintenance
Section titled “Maintenance”- Keep exported tests in sync with program
- Update tests when IDL changes
- Handle breaking changes gracefully
Feedback Welcome
Section titled “Feedback Welcome”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:
- X: @testshipxyz
- Website: testship.xyz
Alternative Approaches
Section titled “Alternative Approaches”While we develop this feature, consider:
Manual Export
Section titled “Manual Export”- Copy transaction signatures
- Recreate tests manually
- Use Testship as reference
Screen Recording
Section titled “Screen Recording”- Record your testing session
- Share videos with team
- Document test procedures
Session Sharing
Section titled “Session Sharing”- Use Session Sharing to share live tests
- Collaborative testing
- Non-technical team member access
Timeline
Section titled “Timeline”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
Stay Updated
Section titled “Stay Updated”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.