Make sure you have installed Quick Test CLI before proceeding.
Your first stress test
Let’s run a stress test to validate a solution by comparing it against a brute-force approach. This is the most common use case in competitive programming.Create your solution file
Create a file named
main.cpp with your optimized solution. For this example, we’ll solve a simple problem: find the sum of two numbers.main.cpp
Create a correct solution
Create a file named
correct.cpp with a brute-force solution that you’re confident is correct. This can be slower but must always produce the right answer.correct.cpp
For more complex problems, your brute-force solution might use nested loops or simpler algorithms, while your main solution uses optimizations.
Run the stress test
Now run Quick Test CLI to compare your solutions:Or use the shorter alias and options:This command will:
- Compile all three files
- Run 100 test cases (
--tc 100) - Set a timeout of 1000ms per test (
--tout 1000) - Compare outputs from
main.cppandcorrect.cpp
Review the results
Quick Test CLI will display results for each test case:
- ✅ AC (Accepted): Output matches
- ❌ WA (Wrong Answer): Output differs
- ⏱️ TLE (Time Limit Exceeded): Execution timeout
- 💥 RTE (Runtime Error): Program crashed
Understanding test modes
Quick Test CLI supports four different testing modes. Here’s when to use each:cmp
Compare two solutionsUse when you have a correct but slow solution and want to verify your optimized version.
stress
Stress test performanceUse when you only want to verify your solution runs within time limits (no comparison).
check
Custom validationUse for problems with multiple valid answers. Requires a checker program that validates output.
output
Batch processingRun your solution on existing test files and save outputs.
Common options
All test modes support these commonly used options:| Option | Short | Default | Description |
|---|---|---|---|
--test-cases | --tc | 1000 | Number of test cases to generate |
--timeout | --tout | 2000 | Time limit per test in milliseconds |
--memory-limit | --ml | 1GB | Memory limit in bytes |
--break-bad | --break | false | Stop on first WA/TLE/RTE |
--save-bad | - | false | Save failing test cases to disk |
--save-all | - | false | Save all test cases to disk |
Examples with options
Multi-language support
Quick Test CLI supports multiple programming languages. Simply use the appropriate file extension:- C++
- Python
- Java
- Rust
- Go
g++ -std=c++17 -Wall -DONLINE_JUDGE=1 -o .qt/main main.cppWorking with saved test cases
When you find a bug, you’ll want to save failing test cases and re-run them after fixing your code.Save failing test cases
Run your stress test with the Failing test cases will be saved in the
--save-bad flag:.qt/ directory.Example workflow
Here’s a typical workflow for competitive programming:Debug if needed
If a test fails:
- Check the failing test case in
.qt/directory - Fix your solution
- Re-run:
qt cmp -t main.cpp -c correct.cpp -g gen.cpp --run-wa
Next steps
Now that you’ve run your first stress test, explore more features:Compare mode
Deep dive into comparison testing with all available options
Stress mode
Learn about performance stress testing without comparisons
Check mode
Use custom checkers for problems with multiple valid answers
Supported languages
See compilation commands and configuration for all languages
Getting help
Need assistance?- View examples:
qt example --cmp - Check all options:
qt cmp --help - Report bugs: GitHub Issues
- Read full documentation: Browse the sidebar for detailed guides