Exercise 2: Input Space Partitioning & Control Flow Graph
You are asked to design an input domain model (IDM) and a control flow graph (CFG) for testing the Spring Petclinic Rest project. Specifically, you need to create IDM and CFG for designing the test cases for testing at least two methods listed in To Model section.
After you have designed the IDM and CFG, you need to define the test requirements based on each model by using a coverage criteria of your choice such as Base Choice Coverage (for IDM) and Edge-Pair Coverage (for CFG). Based on the test requirements, you need to design the test case values from the IDM and the test paths from the CFG that will satisfy the test requirements.
You can use a template for the IDM that is available in Markdown or Microsoft Word. As for the CFG, there is no template. You can use image editor or diagram tool to create the CFG. Do not forget to include the CFG drawing into the written report.
Finally, show that there is at least one test value and at least one test path derived from the corresponding models that will satisfy the existing JUnit test suite in the project. If there are no test cases in the test suite that have been satisfied by the test value and test path, you need to update the existing JUnit test suite by adding new test cases as JUnit test methods.
Notes: We provide an IDM example from past exercise if you require a reference on how to create an IDM.
To Model
The following is a list of methods that can be modeled into IDM and CFG in this exercise:
getOwnersPet
method inOwnerRestController
class.updateVet
method inVetRestController
class.saveUser
method inUserServiceImpl
class.
You only need to pick two methods out of three to model into IDM and CFG.
Preparatory Tasks
- Fork the Spring Petclinic Rest repository to your own account on GitLab CSUI.
- Clone the Git repository of the new fork into your local development machine.
- Open the cloned Git repository as a project using your favourite text editor or IDE that supports Java-based project.
- Create a new branch named
exercise2
from thecsui
branch of your cloned fork. - Choose two methods from the codebase that you want to model.
IDM Tasks
For each method you picked:
- Create the IDM
Please choose whether to follow interface-based (syntax) or functionality-based approach (behaviour) for each method when trying to identify the characteristics and their partition.
- Identify the constraints among characteristics, if exists.
Remember that specifying constraints in the IDM can help filtering out unfeasible test values values from being picked up, thus may reduce the number of possible test cases.
- List the test requirements using the Base Choice Coverage criteria.
- Determine the test values that satisfy the test requirements.
- Associate at least one test value to their corresponding test case method in the existing JUnit test suite and briefly explain the reason (at most 3 sentences).
- If you cannot find a test value that corresponds to any of the test case method in the existing test suite, update the existing JUnit test suite by adding a new test case method that corresponds to a test value in your model. Then, briefly explain your justification why the new test case method satifies the chosen test value (at most 3 sentences).
- Commit and push your changes to your fork on GitLab CSUI.
CFG Tasks
For each method you picked:
- Create the CFG
- List the test requirements using the Edge-Pair Coverage criteria.
- Determine the test paths that satisfy the test requirements.
- Associate at least one test path to their corresponding test case method in the existing JUnit test suite and briefly explain the reason (at most 3 sentences).
- If you cannot find a test path that corresponds to any of the test case method in the existing test suite, update the existing JUnit test suite by adding a new test case method that corresponds to a test path in your model. Then, briefly explain your justification why the new test case method satisfies the chosen test path (at most 3 sentences).
- Commit and push your changes to your fork on GitLab CSUI.
Deliverables
At the end of this exercise, you are required to prepare the following artifacts:
- A fork repository of Spring Petclinic Rest in your own namespace on GitLab CSUI.
- A written report in a Markdown file named
EXERCISE_2_REPORT.md
or Word file namedEXERCISE_2_REPORT.docx
in the fork repository. The report must contain the following: - The IDM and CFG for each method you choose to model.
- The test requirements for each chosen method derived from their IDM and CFG.
- The test values and test paths for each chosen method.
- Your reasons when associating a test value and a test path to their corresponding test case method.
- Similarly, your reasons why creating a new test case method to satisfy a test value and a test path.
- An updated JUnit test suite if you created new test case methods.
The due date of this exercise is: 22 November 2023, 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.
References
- Ch 6. Input Space Partitioning slide at Paul Amman's Introduction to Software Testing book website
- 6.005 — Software Construction on MIT OpenCourseWare | Reading 3: Testing
Appendix 1: Markdown Template
You can use the following Markdown template to document the IDM in your
EXERCISE_2_REPORT.md
file:
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 |
|
Created: 2024-11-13 14:44:29