Black-box testing techniques in Software Engineering - Time & Space Complexity
When we use black-box testing techniques, we check software by looking only at inputs and outputs.
We want to understand how the testing effort grows as the number of test cases or input variations increases.
Analyze the time complexity of this simple black-box test approach.
for input in test_inputs:
result = run_test(input)
check_output(result)
log_result(input, result)
This code runs tests on a list of inputs, checking outputs one by one.
Look for repeated actions in the testing process.
- Primary operation: Running a test for each input and checking its output.
- How many times: Once for every input in the test list.
As the number of test inputs grows, the total testing steps grow in the same way.
| Input Size (n) | Approx. Operations |
|---|---|
| 10 | About 10 test runs |
| 100 | About 100 test runs |
| 1000 | About 1000 test runs |
Pattern observation: The work grows directly with the number of tests; doubling tests doubles work.
Time Complexity: O(n)
This means the testing effort grows in a straight line with the number of test inputs.
[X] Wrong: "Adding more test inputs won't affect testing time much because tests are simple."
[OK] Correct: Each test takes time, so more inputs mean more total time, growing steadily.
Understanding how testing effort grows helps you plan and explain testing strategies clearly in real projects.
"What if we grouped inputs and tested groups instead of individual inputs? How would the time complexity change?"