200-901 Software Development and Design Practice Question
A developer is writing unit tests for a Python function that parses Cisco IOS configuration text and returns a dictionary of interfaces. The function relies on an external file read. Which TWO practices improve the testability and reliability of these unit tests? (Choose two.)
⚠ Common exam trap
The trap here is believing that testing against real infrastructure is more thorough, when in fact it makes unit tests slow and flaky, and that combining assertions reduces effort without harming diagnosability.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Use unittest.mock.patch to replace the file read with a mock that returns fixed configuration text
Mocking the file read with unittest.mock.patch and using pytest.mark.parametrize both improve testability: mocking removes external dependencies, and parametrization increases coverage with minimal code. Relying on live devices, merging assertions, or adding sleep delays all reduce reliability and speed, making them poor choices for unit tests.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Place all test assertions inside a single test function to minimize the number of test cases
Why it's wrong here
Combining many assertions into one test function makes it harder to identify which specific case failed and can cause subsequent assertions to be skipped after the first failure. Granular tests or parametrized cases are preferred for clear diagnostics and maintainability.
- ✗
Write tests that depend on a live Cisco device reachable over SSH to fetch real configuration
Why it's wrong here
Depending on a live device introduces network latency, authentication requirements, and potential device state changes, making tests slow and flaky. Unit tests should not require external systems; such integration tests belong in a separate suite and are not suitable for fast, repeatable unit testing.
- ✗
Use time.sleep to wait for the file read to complete before asserting results
Why it's wrong here
Introducing artificial delays slows down the test suite and does not address the nondeterminism of file I/O. Proper mocking eliminates the need for waiting and makes tests faster and more reliable. Sleep-based synchronization is an anti-pattern in unit testing.
- ✓
Use unittest.mock.patch to replace the file read with a mock that returns fixed configuration text
Why this is correct
Patching the file read isolates the unit test from the actual filesystem, making tests fast, deterministic, and independent of external state. It allows the developer to supply controlled input strings that exercise specific parsing logic without creating real files, which is a core technique for reliable unit testing.
- ✓
Use pytest.mark.parametrize to run the parser against multiple input strings and expected dictionaries
Why this is correct
Parametrization allows a single test function to validate many input-output pairs, increasing coverage of edge cases such as missing sections or malformed lines. It keeps tests concise and readable while ensuring the parser behaves correctly across diverse configuration samples, which improves reliability.
Go deeper
Related to this question
About these practice questions
One of 975 original 200-901 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.