Exercise 2: Input Space Partitioning & Control Flow Graph
In this exercise, you will practice model-based test design on a fork of Spring Petclinic REST. You will build an Input Domain Model (IDM) and a Control Flow Graph (CFG) for two methods, derive test requirements using coverage criteria, and connect the resulting test values and paths to the project's JUnit test suite.
Getting Started
Do the following steps before starting the exercise:
- Ensure you are enrolled in PMPL (SQA) course and have an account on GitLab CSUI. If you don't have an account, please notify the instructors as soon as possible.
- Set up the required tools on your local development machine:
- Git
- Java JDK version 17
- (optional) A text editor/IDE that supports Markdown and Java, e.g., Visual Studio Code or JetBrains IntelliJ
- Open the project page: Spring Petclinic REST.
- Fork the repository to your own namespace on GitLab CSUI, then clone your fork:
1 2
git clone git@gitlab.cs.ui.ac.id:<your-namespace>/spring-petclinic-rest.git cd spring-petclinic-rest
- Ensure the main branch of your fork is
csui
:1 2
git status # On branch csui
- Create a working branch for this exercise:
1
git switch -c task/2-modeling
Task 1: Build the Input Domain Model (IDM)
You will build an IDM for the following methods:
updateVet
inVetRestController
saveUser
inUserServiceImpl
Steps for each method:
- Identify the inputs and their characteristics (interface-based and/or functionality-based). Define meaningful partitions (blocks) for each characteristic.
- Identify constraints among characteristics, if any (e.g., infeasible combinations, conditional dependencies). Use constraints to prune unfeasible test values.
- List the test requirements using Pair Wise Coverage (PWC).
- Derive concrete test values that satisfy the PWC requirements.
- Document the IDM in the report (tabular format is recommended; see template).
Task 2: Build the Control Flow Graph (CFG)
You will build a CFG for the following methods:
updateVet
inVetRestController
saveUser
inUserServiceImpl
Steps for each method:
- Create the CFG including entry/exit, nodes (basic blocks), and directed edges (control transfers). You may use any diagramming tool.
- List the test requirements using Edge-Pair Coverage (EPC).
- Derive test paths that satisfy the EPC requirements.
- Export and include the CFG diagram in the report.
Task 3: Validate Against the Existing JUnit Test Suite
For each method:
- Map at least one IDM-derived test value to an existing JUnit test case in the project. Explain the mapping briefly (max. 3 sentences).
- Map at least one CFG-derived test path to an existing JUnit test case. Explain briefly (max. 3 sentences).
- If no existing test satisfies a required value/path, add a new JUnit test method that does. Justify the addition (max. 3 sentences) and keep the test style consistent with the project.
- Commit and push your changes to your fork on GitLab CSUI.
Deliverables
At the end of this exercise, prepare the following artefacts in your fork:
- A written report named
EXERCISE_2_REPORT.md
(orEXERCISE_2_REPORT.docx
). The report must include for each chosen method:- The IDM and its constraints
- The PWC test requirements and selected test values
- The CFG, the EPC test requirements, and selected test paths
- The mapping from test values/paths to JUnit tests (and justifications)
- The CFG diagram files (e.g., screenshots or exports in PNG) referenced from the report
- Updates to the JUnit test suite if you added new tests
Ensure the updated codebase and the written report is commited and pushed to your fork on GitLab CSUI.
The due date of this exercise is: Friday, 26 September 2025, 23:55 UTC+7. Submit the URL of your fork repository to the designated submission slot on SCELE. Please ensure any updates to the fork repository related to this exercise were made and pushed before the due date.
Generative AI Usage Policy
You may use generative AI tools for this exercise, but you must understand that you are trying to learn and practice the subject, not the AI itself. AI may produce incorrect results; review outputs critically.
If you do use generative AI, you must agree to the following:
Allowed Uses
- Code generation (e.g., suggest test cases or refactorings)
- Explanations (e.g., clarify partitioning decisions, coverage criteria)
- Debugging help (e.g., interpret failing tests)
For every AI-assisted change, document it in the report under AI Assistance Log.
Prohibited Uses
- Direct submission of AI-generated content without understanding or testing it
- Bypassing learning by outsourcing the entire report or model construction
Report Template
You can use the following Markdown template as a starting point:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
References
- Paul Ammann & Jeff Offutt, Ch. 6 Input Space Partitioning (slides): https://cs.gmu.edu/~offutt/softwaretest/powerpoint/Ch06-ISP.pptx
- MIT 6.005 Software Construction, Reading 3: Testing: https://ocw.mit.edu/ans7870/6/6.005/s16/classes/03-testing/index.html
Generative AI Use Disclosure
GitHub Copilot with GPT-5 is used to draft and proofread this document.
Created: 2025-09-17 13:10:05