200-901 Software Development and Design Practice Question
A developer is writing unit tests for a Python function that interacts with a REST API. Which TWO practices are recommended to ensure tests are reliable and isolated? (Choose two.)
⚠ Common exam trap
The trap here is thinking that testing against real APIs provides more confidence, but it actually makes tests unreliable and non-deterministic.
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
✓
Mock external HTTP requests using a library like unittest.mock or responses.
Mocking external HTTP requests and asserting on the function's output are key to reliable unit tests. Mocking isolates the code under test from external dependencies, while assertions validate correct behavior. Together, they ensure tests are fast, deterministic, and focused on logic. The other practices either introduce dependencies or do not address isolation and reliability.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Include delays between test cases to simulate network latency.
Why it's wrong here
Adding artificial delays increases test execution time without adding value. Unit tests should run as fast as possible. Simulating network latency is more appropriate for performance testing or integration tests, not unit tests. Delays do not contribute to reliability or isolation; they only slow down the feedback loop.
- ✗
Run tests in parallel to reduce execution time.
Why it's wrong here
While parallel test execution can speed up suites, it does not inherently improve reliability or isolation. In fact, if tests share state or resources, parallel execution can cause race conditions and flakiness. The focus here is on isolation from external APIs, not performance optimization. Parallelization is a separate concern and not a best practice for reliability in this context.
- ✓
Mock external HTTP requests using a library like unittest.mock or responses.
Why this is correct
Mocking external HTTP requests prevents tests from depending on network availability or API rate limits. It allows you to simulate various responses, including errors, and ensures tests run quickly and deterministically. This isolation is crucial for reliable unit tests, as it removes external dependencies and focuses on the function's logic.
- ✗
Use real API endpoints to ensure the function works with actual data.
Why it's wrong here
Using real API endpoints makes tests flaky and slow, as they depend on network conditions, API availability, and data state. It also may incur costs or hit rate limits. Unit tests should be isolated and repeatable, so relying on live services is an anti-pattern. Instead, mock or use a sandbox environment for integration tests.
- ✓
Assert that the function returns the expected data structure and values.
Why this is correct
Assertions verify that the function's output matches expectations, catching regressions. When combined with mocking, assertions ensure the function processes simulated data correctly. This practice is fundamental to unit testing, as it validates behavior without external dependencies. It also documents the expected contract of the function.
Go deeper
Related to this question
About these practice questions
Courseiva writes every 200-901 question from scratch — 975 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.