POC Testing & Quality Assurance Flashcards
6 cards from real POC practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 POC Testing & Quality Assurance flashcards as text
In pytest, what built-in fixture provides a temporary directory for test files?
Answer: tmp_path
The `tmp_path` fixture in pytest provides a `pathlib.Path` temporary directory unique to each test invocation.
Which method in unittest asserts that a specific exception is raised?
Answer: assertRaises()
`assertRaises(ExceptionType)` is used as a context manager or callable to verify that the specified exception is raised.
What is mocking in Python unit testing?
Answer: Replacing real objects with simulated ones to isolate units under test
Mocking replaces real dependencies with controlled substitutes so tests verify only the unit being tested.
What does the `@pytest.fixture` decorator do?
Answer: Defines a reusable setup function injected into test parameters
The `@pytest.fixture` decorator defines a function that provides a fixed baseline or shared resource, injected by name into test function parameters.
In unittest, what method is called after each test method to clean up resources?
Answer: tearDown()
`tearDown()` is called after each test method to perform cleanup, even if the test raised an exception.
What is code coverage in software testing?
Answer: The percentage of source code lines executed during test runs
Code coverage measures what percentage of source code is actually executed when the full test suite runs.