Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
0
05_FDD_Assignement
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alma Berisha
05_FDD_Assignement
Commits
92b930b1
Commit
92b930b1
authored
2 months ago
by
Alma Berisha
Browse files
Options
Downloads
Patches
Plain Diff
basic movement implempented and tested
parents
Branches
feature/basic-movement
Branches containing commit
No related tags found
1 merge request
!1
Develop
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
01_UC_RoverMovement.txt
+54
-0
54 additions, 0 deletions
01_UC_RoverMovement.txt
backuprover1.py
+42
-0
42 additions, 0 deletions
backuprover1.py
test_rover1.py
+19
-0
19 additions, 0 deletions
test_rover1.py
with
115 additions
and
0 deletions
01_UC_RoverMovement.txt
0 → 100644
+
54
−
0
View file @
92b930b1
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"
}
}
]
This diff is collapsed.
Click to expand it.
backuprover1.py
0 → 100644
+
42
−
0
View file @
92b930b1
# 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
]
This diff is collapsed.
Click to expand it.
test_rover1.py
0 → 100644
+
19
−
0
View file @
92b930b1
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
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment