Skip to content
Snippets Groups Projects
Commit 5dc85fc4 authored by Alma Berisha's avatar Alma Berisha
Browse files

Merge branch 'develop' into 'main'

Develop

See merge request !1
parents 66ccad1f 73a2f01c
Branches main
No related tags found
1 merge request!1Develop
You are a tester tasked with creating comprehensive test cases for a given usecase description.
## Usecase description
{
"name": "Driving the Rover on Mars",
"scenario": "MissionControl sends drive commands to move the rover across the plateau.",
"actors": "MissionControl",
"preconditions": "Rover is landed on the plateau at position (0,0)",
"steps": [
"MissionControl sends command string (e.g. 'FFRLF') to the rover",
"Rover interprets each character and updates position/heading accordingly",
"Before each move, Rover checks for obstacles or plateau boundaries",
"If an obstacle or edge is detected, Rover stops and ignores remaining commands",
"Rover returns the string of successfully executed commands"
]
}
## Testcase
[
{
"name": "Rover Moves Successfully with No Obstacles",
"description": "Verify that the rover moves as expected with valid input and no obstacles",
"input": {
"command": "FFRFF"
},
"expected": {
"outcome": "Rover moved successfully",
"executedCommands": "FFRFF"
}
},
{
"name": "Rover Stops at Obstacle",
"description": "Verify that the rover stops when an obstacle is detected and remaining commands are ignored",
"input": {
"command": "FFRFF"
},
"expected": {
"outcome": "Rover stopped due to obstacle",
"executedCommands": "FFR"
}
},
{
"name": "Invalid Command Input",
"description": "Verify that the rover handles invalid commands gracefully",
"input": {
"command": "FXZ"
},
"expected": {
"outcome": "Invalid command encountered",
"executedCommands": "F"
}
}
]
You are a tester tasked with creating comprehensive test cases for a given usecase description.
## Usecase description
{
"name": "Rover Obstacle Detection",
"scenario": "The rover must stop when it detects an obstacle in its path.",
"actors": "MissionControl",
"preconditions": "Rover is landed on the plateau at position (0,0)",
"steps": [
"MissionControl sends a movement command to the rover",
"Rover checks each step for obstacles using its obstacle detection system (ODS)",
"If an obstacle is detected, the rover stops before moving into it",
"Remaining commands in the sequence are ignored",
"Rover returns only the successfully executed commands"
]
}
## Testcase
[
{
"name": "Rover Stops at First Obstacle",
"description": "Verify that the rover stops immediately when the first obstacle is detected",
"input": {
"command": "FFRFF"
},
"expected": {
"outcome": "Obstacle detected; rover stopped",
"executedCommands": "FF"
}
},
{
"name": "Rover Avoids Obstacle and Continues",
"description": "Verify that rover only moves until just before the obstacle",
"input": {
"command": "FRFRF"
},
"expected": {
"outcome": "Obstacle detected mid-sequence",
"executedCommands": "FRF"
}
},
{
"name": "Rover Encounters No Obstacles",
"description": "Verify that the rover executes all commands when no obstacles are present",
"input": {
"command": "FFLFF"
},
"expected": {
"outcome": "Rover moved successfully",
"executedCommands": "FFLFF"
}
}
]
You are a tester tasked with creating comprehensive test cases for a given usecase description.
## Usecase description
{
"name": "MissionControl Map Tracking",
"scenario": "The rover tracks all visited positions during execution so that MissionControl can recreate the path.",
"actors": "MissionControl",
"preconditions": "The rover is landed on the plateau at position (0,0)",
"steps": [
"MissionControl sends a movement command to the rover",
"Rover executes each movement command (F, B, L, R)",
"Rover records each visited position in order",
"MissionControl calls a method to retrieve the full path history",
"The system returns the sequence of all visited coordinates"
]
}
## Testcase
[
{
"name": "Path Tracking with No Obstacles",
"description": "Verify that the rover records all visited positions when no obstacles are present",
"input": {
"command": "FFRFF"
},
"expected": {
"executedCommands": "FFRFF",
"path": [
[0, 0],
[0, 1],
[0, 2],
[1, 2],
[2, 2],
[3, 2]
]
}
},
{
"name": "Path Tracking Stops at Obstacle",
"description": "Verify that the rover records the path until just before an obstacle is detected",
"input": {
"command": "FFRFF"
},
"expected": {
"executedCommands": "FFR",
"path": [
[0, 0],
[0, 1],
[0, 2],
[1, 2]
]
}
},
{
"name": "Path Tracking with Backward Movement",
"description": "Verify that backward movements are correctly added to the path",
"input": {
"command": "FFLBB"
},
"expected": {
"executedCommands": "FFLBB",
"path": [
[0, 0],
[0, 1],
[0, 2],
[-1, 2],
[-2, 2]
]
}
}
]
# 05_FDD_Assignement RoverMovement
You are a tester tasked with creating comprehensive test cases for a given usecase description.
Usecase descpription
## Getting started
{
To make it easy for you to get started with GitLab, here's a list of recommended next steps. "name": "Driving the Rover on Mars",
"scenario": "MissionControl sends drive commands to move the rover across the plateau.",
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! "actors": "MissionControl",
"preconditions": "Rover is landed on the plateau at position (0,0)",
## Add your files "steps": [
"MissionControl sends command string (e.g. 'FFRLF') to the rover",
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files "Rover interprets each character and updates position/heading accordingly",
- [ ] [Add files using the command line](https://docs.gitlab.com/topics/git/add_files/#add-files-to-a-git-repository) or push an existing Git repository with the following command: "Before each move, Rover checks for obstacles or plateau boundaries",
"If an obstacle or edge is detected, Rover stops and ignores remaining commands",
``` "Rover returns the string of successfully executed commands"
cd existing_repo ]
git remote add origin https://gitlab.reutlingen-university.de/Alma.Berisha/05_fdd_assignement.git }
git branch -M main
git push -uf origin main Testcase
``` [
{
## Integrate with your tools "name": "Rover Moves Successfully with No Obstacles",
"description": "Verify that the rover moves as expected with valid input and no obstacles",
- [ ] [Set up project integrations](https://gitlab.reutlingen-university.de/Alma.Berisha/05_fdd_assignement/-/settings/integrations) "input": {
"command": "FFRFF"
## Collaborate with your team },
"expected": {
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) "outcome": "Rover moved successfully",
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) "executedCommands": "FFRFF"
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) }
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) },
- [ ] [Set auto-merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/) {
"name": "Rover Stops at Obstacle",
## Test and Deploy "description": "Verify that the rover stops when an obstacle is detected and remaining commands are ignored",
"input": {
Use the built-in continuous integration in GitLab. "command": "FFRFF"
},
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) "expected": {
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) "outcome": "Rover stopped due to obstacle",
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) "executedCommands": "FFR"
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) }
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) },
{
*** "name": "Invalid Command Input",
"description": "Verify that the rover handles invalid commands gracefully",
# Editing this README "input": {
"command": "FXZ"
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. },
"expected": {
## Suggestions for a good README "outcome": "Invalid command encountered",
"executedCommands": "F"
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. }
}
## Name ]
Choose a self-explaining name for your project.
ObstacleDetection
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. You are a tester tasked with creating comprehensive test cases for a given usecase description.
## Badges Usecase description
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
{
## Visuals "name": "Rover Obstacle Detection",
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. "scenario": "The rover must stop when it detects an obstacle in its path.",
"actors": "MissionControl",
## Installation "preconditions": "Rover is landed on the plateau at position (0,0)",
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. "steps": [
"MissionControl sends a movement command to the rover",
## Usage "Rover checks each step for obstacles using its obstacle detection system (ODS)",
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. "If an obstacle is detected, the rover stops before moving into it",
"Remaining commands in the sequence are ignored",
## Support "Rover returns only the successfully executed commands"
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. ]
}
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README. Testcase
## Contributing [
State if you are open to contributions and what your requirements are for accepting them. {
"name": "Rover Stops at First Obstacle",
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. "description": "Verify that the rover stops immediately when the first obstacle is detected",
"input": {
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. "command": "FFRFF"
},
## Authors and acknowledgment "expected": {
Show your appreciation to those who have contributed to the project. "outcome": "Obstacle detected; rover stopped",
"executedCommands": "FF"
## License }
For open source projects, say how it is licensed. },
{
## Project status "name": "Rover Avoids Obstacle and Continues",
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. "description": "Verify that rover only moves until just before the obstacle",
"input": {
"command": "FRFRF"
},
"expected": {
"outcome": "Obstacle detected mid-sequence",
"executedCommands": "FRF"
}
},
{
"name": "Rover Encounters No Obstacles",
"description": "Verify that the rover executes all commands when no obstacles are present",
"input": {
"command": "FFLFF"
},
"expected": {
"outcome": "Rover moved successfully",
"executedCommands": "FFLFF"
}
}
]
ControlMap
You are a tester tasked with creating comprehensive test cases for a given usecase description.
Use description
{
"name": "MissionControl Map Tracking",
"scenario": "The rover tracks all visited positions during execution so that MissionControl can recreate the path.",
"actors": "MissionControl",
"preconditions": "The rover is landed on the plateau at position (0,0)",
"steps": [
"MissionControl sends a movement command to the rover",
"Rover executes each movement command (F, B, L, R)",
"Rover records each visited position in order",
"MissionControl calls a method to retrieve the full path history",
"The system returns the sequence of all visited coordinates"
]
}
Testcase
[
{
"name": "Path Tracking with No Obstacles",
"description": "Verify that the rover records all visited positions when no obstacles are present",
"input": {
"command": "FFRFF"
},
"expected": {
"executedCommands": "FFRFF",
"path": [
[0, 0],
[0, 1],
[0, 2],
[1, 2],
[2, 2],
[3, 2]
]
}
},
{
"name": "Path Tracking Stops at Obstacle",
"description": "Verify that the rover records the path until just before an obstacle is detected",
"input": {
"command": "FFRFF"
},
"expected": {
"executedCommands": "FFR",
"path": [
[0, 0],
[0, 1],
[0, 2],
[1, 2]
]
}
},
{
"name": "Path Tracking with Backward Movement",
"description": "Verify that backward movements are correctly added to the path",
"input": {
"command": "FFLBB"
},
"expected": {
"executedCommands": "FFLBB",
"path": [
[0, 0],
[0, 1],
[0, 2],
[-1, 2],
[-2, 2]
]
}
}
]
# RoverMovement: (F, B, L, R)
# ObstacleDetection : (ODS)
DIRECTIONS = ['N', 'E', 'S', 'W']
MOVES = {
'N': (0, 1),
'E': (1, 0),
'S': (0, -1),
'W': (-1, 0)
}
class Rover:
def __init__(self):
self.x = 0
self.y = 0
self.heading = 0
def drive(self, command_string):
executed = ""
for cmd in command_string:
if cmd in ['F', 'B']:
dx, dy = MOVES[DIRECTIONS[self.heading]]
if cmd == 'B':
dx, dy = -dx, -dy
self.x += dx
self.y += dy
elif cmd == 'L':
self.heading = (self.heading - 1) % 4
elif cmd == 'R':
self.heading = (self.heading + 1) % 4
else:
break # stop on invalid command
executed += cmd
return executed
def get_position(self):
return (self.x, self.y)
def get_heading(self):
return DIRECTIONS[self.heading]
# Adds obstacle detection to rover1.py
DIRECTIONS = ['N', 'E', 'S', 'W']
MOVES = {
'N': (0, 1),
'E': (1, 0),
'S': (0, -1),
'W': (-1, 0)
}
class Rover:
def __init__(self, obstacles=None):
self.x = 0
self.y = 0
self.heading = 0
self.obstacles = obstacles if obstacles else set()
def drive(self, command_string):
executed = ""
for cmd in command_string:
if cmd in ['F', 'B']:
dx, dy = MOVES[DIRECTIONS[self.heading]]
if cmd == 'B':
dx, dy = -dx, -dy
next_x = self.x + dx
next_y = self.y + dy
if (next_x, next_y) in self.obstacles:
break
self.x = next_x
self.y = next_y
elif cmd == 'L':
self.heading = (self.heading - 1) % 4
elif cmd == 'R':
self.heading = (self.heading + 1) % 4
else:
break
executed += cmd
return executed
def get_position(self):
return (self.x, self.y)
def get_heading(self):
return DIRECTIONS[self.heading]
# adds missionconrtoll to rover2.py
DIRECTIONS = ['N', 'E', 'S', 'W']
MOVES = {
'N': (0, 1),
'E': (1, 0),
'S': (0, -1),
'W': (-1, 0)
}
class Rover:
def __init__(self, obstacles=None):
self.x = 0
self.y = 0
self.heading = 0
self.obstacles = obstacles if obstacles else set()
self.path = [(0, 0)]
def drive(self, command_string):
executed = ""
for cmd in command_string:
if cmd in ['F', 'B']:
dx, dy = MOVES[DIRECTIONS[self.heading]]
if cmd == 'B':
dx, dy = -dx, -dy
next_x = self.x + dx
next_y = self.y + dy
if (next_x, next_y) in self.obstacles:
break
self.x = next_x
self.y = next_y
self.path.append((self.x, self.y))
elif cmd == 'L':
self.heading = (self.heading - 1) % 4
elif cmd == 'R':
self.heading = (self.heading + 1) % 4
else:
break
executed += cmd
return executed
def get_position(self):
return (self.x, self.y)
def get_heading(self):
return DIRECTIONS[self.heading]
def get_path(self):
return self.path
from backuprover1 import Rover
# FEATURE 1: Basic Movement
def test_basic_forward_movement():
rover = Rover()
result = rover.drive("FFRFF")
assert result == "FFRFF"
assert rover.get_position() == (2, 2)
def test_invalid_command_stops_execution():
rover = Rover()
result = rover.drive("FXZ")
assert result == "F"
def test_rotation_behavior():
rover = Rover()
rover.drive("LL")
assert rover.get_heading() == 'S'
from backuprover2 import Rover
def test_stops_at_first_obstacle():
rover = Rover(obstacles={(0, 2)})
result = rover.drive("FFRFF")
assert result == "F"
assert rover.get_position() == (0, 1)
def test_mid_sequence_obstacle():
rover = Rover(obstacles={(1, 1)})
result = rover.drive("FRFRF")
assert result == "FR"
assert rover.get_position() == (0, 1)
def test_no_obstacles_full_execution():
rover = Rover()
result = rover.drive("FFLFF")
assert result == "FFLFF"
assert rover.get_position() == (-2, 2)
from my_rover import Rover
def test_path_tracking_no_obstacles():
rover = Rover()
rover.drive("FFRFF")
assert rover.get_path() == [(0,0), (0,1), (0,2), (1,2), (2,2)]
assert rover.get_position() == (2,2)
def test_path_tracking_stops_at_obstacle():
rover = Rover(obstacles={(1, 2)})
rover.drive("FFRFF")
assert rover.get_path() == [(0,0), (0,1), (0,2)]
assert rover.get_position() == (0,2)
def test_backward_path_tracking():
rover = Rover()
rover.drive("FFLFFBB")
assert rover.get_path() == [(0,0), (0,1), (0,2), (-1,2), (-2,2), (-1,2), (0,2)]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment