Overview
Testing applications on HyperPaxeer follows the same principles as Ethereum development. This guide covers best practices specific to building reliable applications on HyperPaxeer.For most tests, you don’t need Paxeer-specific features. Use your development stack’s built-in testing tools for faster iteration.
Testing Strategy
1
Unit Tests (Local)
Test individual functions with framework’s local networkTools: Hardhat Network, Anvil (Foundry), GanacheSpeed: ⚡ FastestWhen: 90% of your tests
2
Integration Tests (Local Fork)
Test interactions with deployed contractsTools: Hardhat forking, Foundry forkingSpeed: ⚡ FastWhen: Testing with existing protocols
3
Testnet Tests
Test on live network with real conditionsNetwork: Paxeer Testnet (if available)Speed: 🐌 SlowerWhen: Final validation before mainnet
4
Mainnet
Deploy to productionNetwork: HyperPaxeer (Chain ID: 125)When: After thorough testing
Unit Testing
Hardhat Example
test/MyContract.test.js
Foundry Example
test/MyContract.t.sol
Integration Testing
Testing with Mainnet Fork
Fork HyperPaxeer mainnet to test against real deployed contracts:- Hardhat
- Foundry
hardhat.config.js
test/Integration.test.js
Gas Testing
Measure and Optimize Gas Usage
test/Gas.test.js
Foundry Gas Snapshots
Testing Best Practices
Test Coverage
Test Coverage
Aim for high test coverage:Target:
- Statements: > 90%
- Branches: > 80%
- Functions: > 90%
- Lines: > 90%
Test Edge Cases
Test Edge Cases
Test boundary conditions:
Use Fuzzing
Use Fuzzing
Foundry’s fuzzing finds edge cases automatically:
Test Events
Test Events
Verify events are emitted correctly:
Time-based Testing
Time-based Testing
Test time-dependent functionality:Foundry:
Testing Multi-Contract Interactions
test/MultiContract.test.js
Continuous Integration
GitHub Actions Example
.github/workflows/test.yml
Mock Contracts for Testing
test/mocks/MockERC20.sol
Testing Checklist
Before deploying to HyperPaxeer mainnet:- All unit tests passing
- Integration tests passing
- Gas costs optimized
- Test coverage > 90%
- Edge cases tested
- Events tested
- Access control tested
- Reentrancy protection verified
- Integer overflow scenarios tested
- Failed transaction scenarios handled
- Tested with mainnet fork
- Security review completed
- Documentation updated
Testing Tools & Resources
Hardhat
Hardhat testing guide
Foundry
Foundry testing guide
Waffle
Ethereum smart contract testing library
Chai Matchers
Ethereum-specific assertions
Advanced Testing Patterns
Snapshot Testing
Testing Reverts
Testing Gas Usage
Load Testing
Test your contract under load:test/Load.test.js
Security Testing
Reentrancy Testing
Reentrancy Testing
test/Reentrancy.t.sol
Access Control Testing
Access Control Testing
Integer Overflow Testing
Integer Overflow Testing
CI/CD Integration
Automated Testing Pipeline
.github/workflows/ci.yml
Debugging Tests
Enable Verbose Logging
Use Console.log in Solidity
Hardhat Debugging
Resources
Building Apps
Development guide
Examples
Code examples
Hardhat Testing
Hardhat test guide
Foundry Testing
Foundry test guide
Next Steps
Deploy Contracts
Deploy to HyperPaxeer
Transaction Guides
Understand transactions
Security
Security best practices