Practice PCPP2 Software Testing questions with full explanations on every answer.
Start practicing
Software Testing — choose a session length
Free · No account required
Click any question to see the full explanation and answer options, or start a focused practice session above.
In pytest, how can you skip a test based on the operating system platform?
2Which 'unittest' assertion is best suited to verify that two floating-point numbers are equal within a certain tolerance?
3You need to mock an object that is imported into a module. Which patch strategy correctly replaces the object where it is used?
4When using the 'unittest' framework, which method is executed exactly once before any test methods in a class are run?
5In 'unittest.mock', when you want to return a specific value based on the input arguments of a mocked function, which property should be configured?
6You are refactoring a legacy module and want to use 'pytest' to check if a function raises a specific custom exception. Which construct is most idiomatic?
7You are writing a pytest fixture that opens a database connection. Which scope should you use to ensure the connection is created once per module, rather than once per test function?
8When using 'unittest.mock.MagicMock', what happens when you access an attribute that hasn't been defined?
9What command-line flag is used in pytest to stop the test suite execution after the first failure?
10Which pytest feature allows you to run the same test multiple times with different sets of inputs?
11When using 'unittest', how do you ensure that a teardown method runs even if the test method raises an exception?
12Which of the following is a valid way to run all tests in a directory using pytest?
13In pytest, how can you share a fixture across multiple files?
14You are writing a pytest plugin and need to access the command-line options. Which hook should you implement in conftest.py?
15When asserting that a mock was called with specific arguments, which method should be used to verify the call history?
16What is the purpose of the 'autospec' argument in 'patch'?
17How do you check how many times a mock object was called?
18What is the purpose of 'pytest.mark.xfail'?
19Which TWO of the following are valid ways to pass data into a pytest test function?
20What is the result of using 'unittest.mock.patch.object' instead of 'unittest.mock.patch'?
21In pytest, how can you dynamically add a marker to a test at runtime?
22Which of these is the most effective way to test a function that uses 'time.sleep()' without actually waiting?
23Which command-line argument shows the values of local variables in the event of a test failure?
24Which TWO of the following are true regarding 'unittest' test suites?
25Which THREE of the following are valid scopes for a pytest fixture?
26Which TWO of the following pytest command-line options allow for filtering which tests are run?
27Which TWO of the following are valid ways to run tests?
28Which THREE attributes of 'unittest.mock.Mock' allow for verifying call interactions?
29Which THREE of the following are common benefits of using a mocking framework in testing?
30Which THREE features are provided by 'pytest' but NOT by the standard 'unittest' framework?
31Which TWO of the following are valid ways to assert that a mock was NOT called?
32Which THREE of the following are true regarding the use of 'unittest.mock.patch'?
The Software Testing domain covers the key concepts tested in this area of the PCPP2 exam blueprint published by Python Institute. Courseiva provides free domain-focused practice, mock exams, missed-question review, and readiness tracking across all PCPP2 domains — no account required.
The Courseiva PCPP2 question bank contains 32 questions in the Software Testing domain. Click any question to see the full explanation and answer breakdown.
Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.
Yes — the session launcher on this page draws questions exclusively from the Software Testing domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.
Save your results, see per-domain analytics, and get readiness scores — free, for every certification.
Sign Up FreeFree forever · Every certification included