In this exercise you will get experience with writing simple Cucumber tests
and the step definitions to support those tests. The starting point is the
project
at https://gitlab.com/hasker/cucumber-phonebook
You will modify and add a few files to this project for the exercise. You
can use Docker in a VM to test your changes, or you can use GitLab's CI to
do the tests for you. There will be no evidence document
since the GitLab CI system will capture everything needed for grading. You
will submit your revised feature and step definition file to simplify
grading and so I know when you are done.
msoe.edu > se >
se3800f22
using the name cuke_username
where username
is replaced by your username.
git clone https://gitlab.com/hasker/cucumber-phonebook.gitand move the files - except the old
.git
folder! -
to your own repository. The new files should be at
the top of your repository! In particular, make
sure .gitlab-ci.yml
, .gitignore
, Dockerfile
,
and pom.xml
are all in the root of your project. Note the
project Readme file contains more detail about running the code, but you
do not have to read through this to complete the lab.
.gitlab-ci.yml
file. You must replace it by the file I distribute
for CI to work correctly.
src/test/resources/pbook_command_tests/remove_phone.feature
by adding a step to remove Zoe (using appropriate text such as "When I
remove Zoe") and uncommenting the step to check the number of entries is
0.
remove_phone.feature
. This CI build will fail indicating
there is no step definition for the remove operation.
src/test/java/pbook_tests/AddStepDefinitions.java
to add a step definition for the remove command. See do_add
for the pattern, noting from the project Readme that the remove operation
will only ask for the person's name (not a phone number). This step will
have no assertions since it simply emulates the action done by the user.
A weakness of the provided scenarios is that if the wrong entries are
removed from the phonebook (using either remove
or undo
after an add
), the tests will not
identify the problem. For 5 points of extra credit on the lab (assuming the
rest of the lab is done correctly), you can add a step definition for
looking up names in the phonebook (the get
command) and use
this to confirm that the correct entries have been removed in the other
commands. This will require changing add_phone.feature
as
well. Be sure to write at the top of add_phone.feature
that
the code tests the contents as well; make sure this remark is prominent to
get your extra credit.
.feature
and .java
files.
You may work with others on this assignment, but you must submit your own solution to GitLab and Canvas. The coding standard does not apply to this exercise.