Created
February 17, 2021 07:10
-
-
Save ivancorrales/b2c85a27081651793820bafadeca4453 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scenario "a user registration fails because required fields are not provcided" { | |
examples = [ | |
{ fullName ="", username = "", password =""}, | |
{ fullName ="Jane Doe", username = "", password =""}, | |
{ fullName ="Jane Doe", username = "jane@mail.com", password =""}, | |
{ fullName ="Jane Doe", username = "", password ="secret"}, | |
] | |
when "register the user" { | |
call signUp { | |
with { | |
user = { | |
fullName = fullName | |
username = username | |
password = password | |
} | |
} | |
as = "createUserResponse" | |
} | |
} | |
then "the server returns with a bad request error" { | |
assert { | |
assertion = createUserResponse.statusCode==400 | |
} | |
} | |
} | |
scenario "user registration fails when email is already in use" { | |
given "a user with valid email & password" { | |
set user { | |
value = { username = "user@mail.com", password = "secret"} | |
} | |
} | |
when "tries to register the user" { | |
# omit block `with` because both user and basiApi are in the scope | |
call signUp { | |
as = "response" | |
} | |
} | |
then "the server returns with a success status code" { | |
assert { | |
assertion = response.statusCode==200 | |
} | |
} | |
when "tries to register the same user" { | |
# omit block `with` because both user and basiApi are in the scope | |
call signUp { | |
as = "response" | |
} | |
} | |
then "the server returns with an error" { | |
assert { | |
assertion = ( | |
response.statusCode==400 && | |
response.body.message=="Failed! Username is already in use!" | |
) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment