REVISION AND PRACTICE

Mini revision questions

2 min read
On this page 1 headings

1. What are I, S and R in a test case?

2. Why can random inputs still miss a bug?

3. How do black-box and white-box testing differ?

4. Which boundary values should be checked for isPrime(num)?

5. Why can multiple condition coverage be stronger than branch coverage?

6. What is the difference between a driver and a stub?

7. When does pytest.raises(ValueError) pass?

8. What is the Red–Green–Refactor order?

9. Why is one passing is_prime(5) test insufficient?

10. Why is integration testing necessary after unit testing?

Suggested answers

Answer 1: I is input data, S is the program state at input, and R is the expected result.

Answer 2: Random pairs may all make the first value smaller and miss the defective second branch.

Answer 3: Black-box is functional testing; white-box is structural testing.

Answer 4: 0 and 1.

Answer 5: For num < 50 or num > 150, {49, 100} covers both branches; {49, 100, 200} also covers the component conditions.

Answer 6: A driver holds the non-local data used by the module under test; a stub is a dummy for a function the module calls.

Answer 7: It passes when ValueError is raised inside the context.

Answer 8: Write a failing test, implement enough to pass, then refactor while tests pass.

Answer 9: A function that always returns True would pass. Test non-primes and boundaries too.

Answer 10: To detect errors at module interfaces, including parameter passing and communication.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑