Questions#
Theory: White Box vs Black Box Testing#
What is the fundamental difference between White Box and Black Box testing?
Hint: Think about what the tester can see regarding the internal code.
List the three basic steps to perform White Box testing.
Hint: It starts with understanding something specific.
What are two advantages of Black Box testing?
Hint: Consider the tester’s perspective and the implementation details.
Compare White Box and Black Box testing in terms of “Module Communication”.
Hint: Which one facilitates verifying how modules talk to each other?
Why is Unit Testing considered a “White Box” technique?
Hint: Who writes unit tests and what do they inspect?
Practice: Pytest#
How does
pytestautomatically discover test files and functions?Hint: What naming convention must be followed?
What is the purpose of a
fixturein pytest? Give an example of when you would use one.Hint: Think about setup code and reusability.
How do you assert that a specific exception is raised in a test function?
Hint: Look for a specific context manager provided by pytest.
What is “Mocking” and why is it useful when testing database interactions?
Hint: Consider what happens if the database is down or slow.
In the directory structure, why are
__init__.pyfiles included insrcandtestsdirectories?Hint: How does Python handle modules?