CTFL 4.5.3: Use acceptance test-driven development (ATDD) to derive test cases
K3Syllabus section 4.5.3
3 original PrepBench practice questions for learning objective 4.5.3 of the CTFL 4.0 syllabus. Try the examples below and check each answer against its syllabus reference.
Practice questions
Question 1
In a specification workshop the team writes this story and its acceptance criteria: Story: As an account holder, I want to download a monthly statement as a PDF, so that I can file it. Criterion 1: a statement for a month that has ended can be downloaded as a PDF. Criterion 2: a statement for the current, unfinished month cannot be downloaded. Criterion 3: a download completes within 5 seconds. Which set of ATDD test cases covers this story without going beyond it?
- Download a finished month as PDF, then download it again and get an identical file
- Download a finished month as PDF, be refused for the current month, finish within 5 seconds
- Download a finished month as PDF, be refused for the current month, check the PDF library used
- Download a finished month as PDF, download the current month as PDF, finish within 5 seconds
Show answer
- Download a finished month as PDF, then download it again and get an identical fileTwo test cases describe the same characteristic, and criteria 2 and 3 are left uncovered.
- Correct answer: Download a finished month as PDF, be refused for the current month, finish within 5 secondsOne positive case, one negative case and one non-functional case, one per criterion.
- Download a finished month as PDF, be refused for the current month, check the PDF library usedChecking which library produces the file goes beyond the story into implementation detail.
- Download a finished month as PDF, download the current month as PDF, finish within 5 secondsDownloading the current month contradicts criterion 2, which requires it to be refused.
In ATDD the test cases are created before the story is implemented and are based on its acceptance criteria. Typically the first test cases are positive, confirming the correct behaviour; after those the team performs negative testing, and finally covers non-functional quality characteristics such as performance efficiency. The test cases must cover all the characteristics of the user story and should not go beyond it, and no two test cases should describe the same characteristics.
Syllabus section 4.5.3
Question 2
A team is using ATDD for the following user story and acceptance criteria. Story: as an account holder, I want to withdraw cash at an ATM. Criterion 1: a withdrawal of an amount up to the account balance is completed and the balance is reduced. Criterion 2: a withdrawal of an amount above the account balance is rejected. Criterion 3: the ATM responds to the request within two seconds. Test-design plan: create positive cases first, then negative cases, then non-functional cases. Which test case should the team create first under this plan?
- Withdraw an amount below the balance and check that the balance is reduced by that amount
- Withdraw an amount above the balance and check that the request is rejected
- Measure the ATM's response time and check that it stays within two seconds
- Withdraw an amount below the balance and check that the receipt printer works
Show answer
- Correct answer: Withdraw an amount below the balance and check that the balance is reduced by that amountThis is the positive case in Criterion 1, which the team's plan places first.
- Withdraw an amount above the balance and check that the request is rejectedThis is the negative case, which the plan places after positive cases.
- Measure the ATM's response time and check that it stays within two secondsResponse time is a non-functional characteristic, which the plan places last.
- Withdraw an amount below the balance and check that the receipt printer worksThe receipt printer is not part of this story, and test cases should not go beyond it.
The team's stated plan follows the typical ATDD sequence. Criterion 1 describes the positive successful withdrawal, so its test is first. The rejection in Criterion 2 is a negative case; response time in Criterion 3 is non-functional and follows later.
Syllabus section 4.5.3
Question 3
A team using ATDD has finished the positive test cases for a sign-in story with these acceptance criteria. Criterion 1: valid credentials sign the user in. Criterion 2: an account that is locked is refused. Criterion 3: a wrong password is refused. Criterion 4: the sign-in page responds within one second. The team now proposes four further test cases. Which one should NOT be written for this story?
- Sign in with a locked account and check that the refusal message appears
- Sign in with a wrong password and check that the refusal message appears
- Measure the sign-in page's response time and check that it stays within one second
- Check that an administrator can unlock an account that has been locked
Show answer
- Sign in with a locked account and check that the refusal message appearsThis is the negative case for Criterion 2 and belongs to this story.
- Sign in with a wrong password and check that the refusal message appearsThis is the negative case for Criterion 3 and belongs to this story.
- Measure the sign-in page's response time and check that it stays within one secondThis covers the non-functional Criterion 4 and belongs to this story.
- Correct answer: Check that an administrator can unlock an account that has been lockedNo acceptance criterion covers unlocking, so this goes beyond the story.
The test cases must cover all the characteristics of the user story and should not go beyond the story. Unlocking an account is an administrator action that none of the four acceptance criteria describes, so it belongs to a different story. The other three proposals are the negative cases for Criteria 2 and 3, which follow the positive cases, and the non-functional case for Criterion 4, which the team should cover last.
Syllabus section 4.5.3
Original PrepBench practice material, not official exam questions or exam dumps. PrepBench is independent and is not affiliated with or endorsed by ISTQB®.