PCPP2 · domain
Software Testing
Practise Python Institute Certified Professional in Python Programming 2 (PCPP2) (PCPP2) Software Testing practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.
Focused practice
Practice Software Testing questions
Scored sessions drawing only from this domain — pick a length below.
Start 20-question practice test →What this domain covers
What to know about Software Testing
Software Testing questions test whether you can apply the concept in context, not just recognise a definition.
How the topic appears in realistic exam-style scenarios.
Which detail in the question changes the correct answer.
How to eliminate plausible but wrong options.
How to connect the question back to the wider exam objective.
Watch out for
Common Software Testing exam traps
- ▸Answering from memory before reading the full scenario.
- ▸Missing a constraint such as cost, availability, security, scope or command context.
- ▸Choosing a broad answer when the question asks for the most specific fix.
- ▸Ignoring why the wrong options are tempting.
Question index
All Software Testing questions (32)
Click any question to see the full explanation, or start a practice session above.
When using the 'unittest' framework, which method is executed exactly once before any test methods in a class are run?
Easy2Which THREE of the following are common benefits of using a mocking framework in testing?
Easy3In 'unittest.mock', when you want to return a specific value based on the input arguments of a mocked function, which property should be configured?
Hard4Which THREE of the following are valid scopes for a pytest fixture?
Hard5Which TWO of the following are true regarding 'unittest' test suites?
Hard6Which pytest feature allows you to run the same test multiple times with different sets of inputs?
Hard7Which THREE features are provided by 'pytest' but NOT by the standard 'unittest' framework?
Hard8Which TWO of the following are valid ways to run tests?
Easy9Which TWO of the following are valid ways to assert that a mock was NOT called?
Medium10Which of these is the most effective way to test a function that uses 'time.sleep()' without actually waiting?
Hard11Which TWO of the following pytest command-line options allow for filtering which tests are run?
Medium12Which THREE attributes of 'unittest.mock.Mock' allow for verifying call interactions?
Medium13Which command-line argument shows the values of local variables in the event of a test failure?
Easy14Which THREE of the following are true regarding the use of 'unittest.mock.patch'?
Hard15When using 'unittest', how do you ensure that a teardown method runs even if the test method raises an exception?
Medium16In pytest, how can you skip a test based on the operating system platform?
Easy17What is the purpose of the 'autospec' argument in 'patch'?
Medium18Which of the following is a valid way to run all tests in a directory using pytest?
Easy19What command-line flag is used in pytest to stop the test suite execution after the first failure?
Easy20Which 'unittest' assertion is best suited to verify that two floating-point numbers are equal within a certain tolerance?
Medium21How do you check how many times a mock object was called?
Medium22You need to mock an object that is imported into a module. Which patch strategy correctly replaces the object where it is used?
Hard23You 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?
Medium24What is the result of using 'unittest.mock.patch.object' instead of 'unittest.mock.patch'?
Medium25Which TWO of the following are valid ways to pass data into a pytest test function?
Medium26When asserting that a mock was called with specific arguments, which method should be used to verify the call history?
Hard27You are writing a pytest plugin and need to access the command-line options. Which hook should you implement in conftest.py?
Hard28What is the purpose of 'pytest.mark.xfail'?
Medium29You 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?
Medium30When using 'unittest.mock.MagicMock', what happens when you access an attribute that hasn't been defined?
Medium31In pytest, how can you dynamically add a marker to a test at runtime?
Hard32In pytest, how can you share a fixture across multiple files?
MediumOther domains
All PCPP2 exam domains
Frequently asked questions
- What does the Software Testing domain cover on the PCPP2 exam?
- Software Testing questions test whether you can apply the concept in context, not just recognise a definition.
- How many questions are in this domain?
- This page lists all 32 Software Testing questions in the PCPP2 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
- What is the best way to practise this domain?
- Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
- Can I practise only Software Testing questions?
- Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.