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?"
Practice
black-box testing?Solution
Step 1: Understand black-box testing definition
Black-box testing focuses on checking software behavior from the user's perspective without knowledge of internal code.Step 2: Compare options with definition
Testing software based on its functionality without looking at the code matches this definition exactly, while others describe different testing types.Final Answer:
Testing software based on its functionality without looking at the code -> Option AQuick Check:
Black-box testing = Functionality testing without code [OK]
- Confusing black-box with white-box testing
- Thinking black-box tests only UI
- Assuming black-box tests check performance
Solution
Step 1: Identify black-box testing techniques
Equivalence partitioning divides input data into groups to reduce test cases, a classic black-box method.Step 2: Eliminate non-black-box options
Code coverage and static code review require code knowledge; memory leak detection is performance testing.Final Answer:
Equivalence partitioning -> Option AQuick Check:
Black-box technique = Equivalence partitioning [OK]
- Choosing code-based techniques for black-box
- Confusing static analysis with black-box testing
- Mixing performance tools with black-box
Solution
Step 1: Understand boundary value analysis
This technique tests values at the edges of input ranges, such as minimum and maximum valid inputs.Step 2: Identify valid boundary values
Valid input range is 1 to 100, so boundaries are 1 and 100. Among options, 1 is a boundary value.Final Answer:
1 -> Option CQuick Check:
Boundary value = 1 [OK]
- Choosing invalid inputs like 0 or 101 as boundaries
- Picking middle values instead of edges
- Confusing equivalence partitioning with boundary testing
Solution
Step 1: Analyze given test cases
Tests cover empty and valid/invalid inputs but do not check input length boundaries.Step 2: Identify missing black-box technique
Boundary value analysis for input length is important to catch edge errors, missing here.Final Answer:
Testing with boundary values for input length -> Option BQuick Check:
Missing boundary tests = Testing with boundary values for input length [OK]
- Confusing security tests with black-box functional tests
- Thinking code review is part of black-box testing
- Ignoring boundary value analysis
Solution
Step 1: Understand equivalence partitioning and boundary value analysis
Equivalence partitioning divides inputs into valid and invalid groups; boundary value analysis tests edges of valid ranges.Step 2: Check options for both techniques
17, 18, 30, 60, 61 includes invalid low (17), valid boundaries (18, 60), valid middle (30), and invalid high (61), covering partitions and boundaries.Final Answer:
17, 18, 30, 60, 61 -> Option DQuick Check:
Both partitions and boundaries = 17, 18, 30, 60, 61 [OK]
- Ignoring invalid inputs in test sets
- Testing only valid inputs without boundaries
- Confusing boundary values with just middle values
Ready to prove it?
Pass the test and this pattern moves unknown
