What is stress testing?
Stress testing in competitive programming helps you:- Find edge cases where your solution fails
- Verify correctness against a brute-force solution
- Detect time limit exceeded (TLE) issues
- Test with hundreds or thousands of random inputs automatically
Prerequisites
Before you begin, ensure you have:- Quick Test CLI installed (see installation guide)
- A compiler for your programming language (g++, python3, javac, etc.)
- Basic familiarity with competitive programming
Your first stress test
Prepare your files
You’ll need three files for a basic stress test with
quicktest cmp:- Target file: Your optimized solution to test
- Correct file: A brute-force solution (slower but guaranteed correct)
- Generator file: Creates random test cases
Write a generator
Create
gen.cpp to generate random test cases:gen.cpp
The generator must accept a seed argument from quicktest to ensure reproducible test cases.
Interpret the results
Quick Test will show you:Test cases are saved in the
- AC (Accepted): Output matches the correct solution
- WA (Wrong Answer): Output differs from the correct solution
- TLE (Time Limit Exceeded): Execution exceeded the timeout
- RTE (Runtime Error): Program crashed or exited with an error
--save-bad to save failing test cases:.qt/testcases/ directory.Understanding test modes
Quick Test provides different testing modes for various scenarios:quicktest cmp - Compare against correct solution
quicktest cmp - Compare against correct solution
Use when you have a brute-force solution to verify correctness.Best for: Finding wrong answer bugs
quicktest stress - Test for time limits
quicktest stress - Test for time limits
Use when you only want to check for TLE issues without comparing outputs.Best for: Performance testing
quicktest check - Custom checker validation
quicktest check - Custom checker validation
Use for problems with multiple valid answers (requires a checker script).Best for: Problems with multiple correct outputs
quicktest output - Run against saved test cases
quicktest output - Run against saved test cases
Use to run your solution against pre-made test cases.Best for: Testing with official sample inputs
Quick reference
| Command | Purpose | Required Files |
|---|---|---|
qt cmp | Compare outputs | target, correct, generator |
qt stress | Check time limits | target, generator |
qt check | Custom validation | target, checker, generator |
qt output | Run saved tests | target, test files |
Next steps
Configuration
Customize compiler flags and language settings
Examples
Explore real-world usage patterns
Troubleshooting
Fix common issues
CLI Reference
View all available commands and options