Use Cases and System Tests
Case 1: Create a city with intersections and roads
Primary Actor: User
Goal in context: Create a city
Preconditions: start of simulation
Trigger: beginning of simulation
When a city is created, the following should be verifiable:
1. The city consists of the correct amount of intersections and roads.
2. Any road or intersection should be accessible.
3. Adjacent intersections should have correspondingly adjacent coordinates. e.g. 1,1 should be next to 1,2.
Priority: Must be implemented
When available: First increment
Frequency of Use: Frequently
Channel to actor: GUI
Secondary Actor: N/A
Channel to Secondary Actor: N/A
Case 2: Add or Subtract Service Vehicles
Primary Actor: User
Goal in context: User wishes to add or remove vehicles from simulation to see the effect they will have overall
Preconditions: There must be vehicles in the simulation in order to remove them
Trigger: User clicks the add/subtract vehicle button.
a. When a vehicle is added:
1. Vehicle counter should increase by one.
2. User should see vehicle on road.
b. When a vehicle is subtracted
1. Vehicle counter should decrease
2. User should see vehicle on road
Priority: Must be implemented
When available: First or second increment
Frequency of Use: Frequently
Channel to actor: GUI
Secondary Actor: N/A
Channel to Secondary Actor: N/A
Case 3: Create Accident/ Place Accident on Map
Primary Actor: Simulation
Goal in context: Create an accident either randomly or via user interaction, and place the accident on the map.
Preconditions: Accident probability met.
Trigger: User clicks the add accident button or accident is being generated by simulation.
When an accident is created the following should occur:
1. The time to get through the surrounding intersections should increase
2. Emergency services should be notified of the accident
3. Visual representation of the accident should show up on simulation
4. A priority should be assigned to that accident and represented on simulation
5. If the event is being entered manually the intersection will be given by the user else it will be random.
Priority: Must be implemented
When available: First increment
Frequency of Use: Frequently
Channel to actor: Simulation
Secondary Actor: User
Channel to Secondary Actor: GUI
Open Issues: How do we handle backlogged accidents, and accidents occurring at the same intersection?
Case 4: Cause vehicle to move to location
Primary Actor: Simulation
Goal in context: move vehicle closer to its destination
Preconditions: Vehicle must have a location given to it
Trigger: move event
When a vehicle is set to move to location the following should occur.
1. A path needs to be calculated and if location is an accident displayed from vehicle to destination.
2. Vehicle should continue moving along path until destination is reached or one of higher priority is assigned.
Priority: Must be implemented
When available: First increment
Frequency of Use: Frequently
Channel to actor: Simulation
Secondary Actor: N/A
Channel to Secondary Actor: N/A
Case 5: User clicks the pause button
Primary Actor: User
Goal in context: To pause the simulation.
Preconditions: Simulation is running.
Trigger: Pause button is clicked
When the pause button is clicked the following should be verifiable:
1. All items stop moving and no new items are dequeued.
2. Average response time, number of current accidents and total resolved accidents will be displayed.
Priority: Must be implemented
When available: First increment
Frequency of Use: Frequently
Channel to actor: GUI
Secondary Actor: N/A
Channel to Secondary Actor: N/A
Case 6: Statistics
Primary Actor: User
Goal in context: To get statistics at the end of simulation
Preconditions: Simulation has finished running
Trigger: End simulation is selected
When the simulation is ended the following should be verifiable:
1. A window will show the following statistics:
a. Total distance traveled per vehicle
b. number of accidents fixed by vehicle
c. average accident wait time
d. average time for vehicle to reach accident
e. average lifetime of vehicle
f. average time to fix accident
g. percent of events fixed per vehicle
h. average idle time
Priority: Must be implemented
When available: Will be added near end of simulation.
Frequency of Use: Frequently
Channel to actor: GUI
Secondary Actor: N/A
Channel to Secondary Actor: N/A
Case 7: Modify Map Size
Primary Actor: User
Goal in context: To modify the size of the simulation map
Preconditions: Simulation has already initialized and modifications are specified.
Trigger: Button Press on the GUI
When the button is pressed the following should happen:
1. A dialog box will pop up and prompt for the new size of the city map.
2. After the new map size has been submitted, check to verify that the new
size does not generate any conflicts with vehicle locations and is of a valid
dimension (at least 1x1).
3. Once verified, the dimensions of the map are modified by adding or removing
rows and columns. The new map should have the same integrity as the
original; new nodes are linked properly and removed nodes are no longer a part
of the map.
Priority: Low
When available: Will be added after primary simulation is implemented.
Frequency of Use: User-Driven
Channel to actor: GUI
Secondary Actors: N/A
Channels to Secondary Actors: N/A
Open Issues: What if the map is intended to shrink, and this displaces an existing vehicle?
System Tests For Use Cases:
This section outlines the System tests that were developed from the use cases written for the project.
Case 1:
Test 1: Create a city with intersections and roads
1. Start new simulation
2. Enter a height of x and a width of y
3. Verify that a city x by y is created.
4. Step through intersections and output their stats to ensure proper linking between exits.
5. Later, have vehicles head through boundaries and all exits of common nodes to ensure proper linking.
Case 2:
Test 1: System Test: Adding a Vehicle:
1. User presses "Add Vehicle" button
2. User enters a coordinate for the vehicle's placement
3. User should see vehicle appear at designated coordinate
4. Vehicle counter should increase
5. Efficiency of accident response should increase
Test 2: Subtracting a Vehicle:
1. User selects a vehicle and presses "Delete Vehicle" button
2. User should observe vehicle disappearing
3. Vehicle count should decrease
4. Efficiency of accident response should decrease
Notes: Vehicle should disappear from the simulation display but the stats on the vehicle should still be available for data collection purposes.
Case 3:
Test 1: User Creates Accident
1. User presses the “Create Accident Button”.
2. User enters the coordinates of the accident, a severity, and a time for the accident to occur.
3. Verify that the accident appears on the screen at the correct intersection.
4. Verify that emergency services are notified of the accident.
5. Verify that the time to get through the intersection of the accident increases.
Test 2: Simulation Creates Random Accident
1. Begin simulation.
2. After some time the simulation should create an accident at a random intersection.
Case 4:
Test 1: Cause vehicle to move to location
1. Start simulation, add a vehicle.
2. User creates an accident
3. Verify that when a vehicle is assigned to the accident its path to the accident is highlighted
4. Verify that vehicle stay on designated path until accident is reached
5. Repeat steps 2-5 some number of times to ensure that intersection blocking is handled properly.
Case 5:
Test 1: User clicks the pause button
1. User clicks pause button.
2. Verify that all of the simulation stops.
3. User then clicks the pause button again.
4. Simulation should start again.
Case 6:
Test 1: Statistics
1. When simulation ends verify that the following are shown:
a. Total distance traveled per vehicle
b. number of accidents fixed by vehicle
c. average accident wait time
d. average time for vehicle to reach accident
e. average lifetime of vehicle
f. average time to fix accident
g. percent of events fixed per vehicle
h. average idle time
Case 7:
Test 1: Modify Map Size
1. When user clicks the modify map button, verify:
a. Window pops up asking for user input into new map size.
b. If map size would be below 1x1, or displace vehicles, display an error message and abort the operation.
c. Otherwise, generate the new map and proceed with steps 3-5 for Case 4, Test 1.
Show Wiki activity