From 7c8b1aa3e99da0c355c4dfcf40933873e3037caf Mon Sep 17 00:00:00 2001 From: albertm15 <155188920+albertm15@users.noreply.github.com> Date: Sat, 9 Nov 2024 16:34:54 +0100 Subject: [PATCH 1/5] Create students features test --- .../resources/features/CreateStudent.feature | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 src/test/resources/features/CreateStudent.feature diff --git a/src/test/resources/features/CreateStudent.feature b/src/test/resources/features/CreateStudent.feature new file mode 100644 index 0000000..d3ee686 --- /dev/null +++ b/src/test/resources/features/CreateStudent.feature @@ -0,0 +1,72 @@ +Feature: Create Student + In order to look for properties as an student + I want to create an student profile + + + Scenario: Create a Student with valid data + Given I'm not logged in + When I create a student with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 201 + And There is 1 Student created with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + + Scenario: Create a student with a blank email: + Given I'm not logged in + When I create a student with username "student" and password "password" and email "" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with a blank password: + Given I'm not logged in + When I create a student with username "student" and password "" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with an empty phoneNumber: + Given I'm not logged in + When I create a student with username "student" and password "password" and email "student@student.app" and phoneNumber "" and name "Student" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with an empty name: + Given I'm not logged in + When I create a student with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with an empty username: + Given I'm not logged in + When I create a student with username "" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with a null email: + Given I'm not logged in + When I create a student with username "student" and password "password" and email "null" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with a null password: + Given I'm not logged in + When I create a student with username "student" and password "null" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with an null phoneNumber: + Given I'm not logged in + When I create a student with username "student" and password "password" and email "student@student.app" and phoneNumber "null" and name "Student" + Then The response code is 400 + And There is 0 Student created + + Scenario: Create a student with an null name: + Given I'm not logged in + When I create a student with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "null" + Then The response code is 400 + And There is 0 Student created + + + Scenario: Create a student with a null username: + Given I'm not logged in + When I create a student with username "null" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "" + Then The response code is 400 + And There is 0 Student created \ No newline at end of file From 5ae9191ce865283fa23a0da8eb2b83e5b0bc4751 Mon Sep 17 00:00:00 2001 From: albertm15 <155188920+albertm15@users.noreply.github.com> Date: Sat, 9 Nov 2024 17:45:37 +0100 Subject: [PATCH 2/5] CreateStudentStepDefs created --- .../demo/config/WebSecurityConfig.java | 1 + .../demo/repository/StudentRepository.java | 5 ++ .../demo/steps/CreateStudentStepDefs.java | 74 +++++++++++++++++++ .../resources/features/CreateStudent.feature | 2 +- 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/test/java/cat/udl/eps/softarch/demo/steps/CreateStudentStepDefs.java diff --git a/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java b/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java index 2f9353e..1efdfa1 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java +++ b/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java @@ -39,6 +39,7 @@ protected SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exce .requestMatchers(HttpMethod.POST, "/properties").hasAuthority("ROLE_OWNER") .requestMatchers(HttpMethod.PUT, "/properties/*").hasAuthority("ROLE_OWNER") .requestMatchers(HttpMethod.DELETE, "/properties/*").hasAuthority("ROLE_OWNER") + .requestMatchers(HttpMethod.POST, "/students").permitAll() .requestMatchers(HttpMethod.POST, "/visits").authenticated() .requestMatchers(HttpMethod.DELETE, "/visits/*").authenticated() .requestMatchers(HttpMethod.POST, "/*/*").authenticated() diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java index 057bde1..da5250c 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java @@ -1,7 +1,12 @@ package cat.udl.eps.softarch.demo.repository; +import cat.udl.eps.softarch.demo.domain.Property; import cat.udl.eps.softarch.demo.domain.Student; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; + +import java.util.List; public interface StudentRepository extends CrudRepository { + Student findByEmail(@Param("email") String email); } diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/CreateStudentStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/CreateStudentStepDefs.java new file mode 100644 index 0000000..dd981e0 --- /dev/null +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/CreateStudentStepDefs.java @@ -0,0 +1,74 @@ +package cat.udl.eps.softarch.demo.steps; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +import cat.udl.eps.softarch.demo.domain.Student; +import cat.udl.eps.softarch.demo.repository.StudentRepository; +import io.cucumber.java.en.And; +import io.cucumber.java.en.When; +import org.json.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; +import org.springframework.security.crypto.password.PasswordEncoder; + +import java.nio.charset.StandardCharsets; + +public class CreateStudentStepDefs { + @Autowired + private StepDefs stepDefs; + + @Autowired + private StudentRepository studentRepository; + + @When("^I create a student with username \"([^\"]*)\" and password \"([^\"]*)\" and email \"([^\"]*)\" and phoneNumber \"([^\"]*)\" and name \"([^\"]*)\"$") + public void createStudent(String username, String password, String email, String phoneNumber, String name) throws Throwable { + Student studentTest = new Student(); + + studentTest.setUsername(assignValueInput(username)); + studentTest.setEmail(assignValueInput(email)); + studentTest.setPhoneNumber(assignValueInput(phoneNumber)); + studentTest.setName(assignValueInput(name)); + + + + stepDefs.result = stepDefs.mockMvc.perform( + post("/students") + .contentType(MediaType.APPLICATION_JSON) + .content(new JSONObject( + stepDefs.mapper.writeValueAsString(studentTest) + ).put("password", assignValueInput(password)).toString()) + .characterEncoding(StandardCharsets.UTF_8)) + .andDo(print()); + + } + + private String assignValueInput(String value) { + if(value.equals("null")){ + return null; + } + else { + return value; + } + } + + @And("^There is 0 Student created$") + public void thereIs0StudentCreated() throws Throwable { + assertEquals(studentRepository.count(), 0); + } + + @And("^There is 1 Student created with username \"([^\"]*)\" and email \"([^\"]*)\" and phoneNumber \"([^\"]*)\" and name \"([^\"]*)\"$") + public void thereIs1StudentCreated(String username, String email, String phoneNumber, String name) throws Throwable { + assertEquals(studentRepository.count(), 1); + Student studentToCheck = this.studentRepository.findByEmail(email); + assertEquals(studentToCheck.getUsername(), username); + assertEquals(studentToCheck.getName(), name); + assertEquals(studentToCheck.getPhoneNumber(), phoneNumber); + assertEquals(studentToCheck.getEmail(), email); + } +} diff --git a/src/test/resources/features/CreateStudent.feature b/src/test/resources/features/CreateStudent.feature index d3ee686..c5bfc80 100644 --- a/src/test/resources/features/CreateStudent.feature +++ b/src/test/resources/features/CreateStudent.feature @@ -7,7 +7,7 @@ Feature: Create Student Given I'm not logged in When I create a student with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" Then The response code is 201 - And There is 1 Student created with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Create a student with a blank email: From 769560dbd5dc057b081d13c8547cc1d24c650164 Mon Sep 17 00:00:00 2001 From: PauBarahona22 Date: Sat, 9 Nov 2024 18:37:37 +0100 Subject: [PATCH 3/5] features for ModifyStudent Tests --- .../demo/config/WebSecurityConfig.java | 1 + .../resources/features/ModifyStudent.feature | 84 +++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 src/test/resources/features/ModifyStudent.feature diff --git a/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java b/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java index 1efdfa1..2ed14d8 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java +++ b/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java @@ -40,6 +40,7 @@ protected SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exce .requestMatchers(HttpMethod.PUT, "/properties/*").hasAuthority("ROLE_OWNER") .requestMatchers(HttpMethod.DELETE, "/properties/*").hasAuthority("ROLE_OWNER") .requestMatchers(HttpMethod.POST, "/students").permitAll() + .requestMatchers(HttpMethod.PUT, "/students/*").hasAuthority("ROLE_STUDENT") .requestMatchers(HttpMethod.POST, "/visits").authenticated() .requestMatchers(HttpMethod.DELETE, "/visits/*").authenticated() .requestMatchers(HttpMethod.POST, "/*/*").authenticated() diff --git a/src/test/resources/features/ModifyStudent.feature b/src/test/resources/features/ModifyStudent.feature new file mode 100644 index 0000000..1c5ae65 --- /dev/null +++ b/src/test/resources/features/ModifyStudent.feature @@ -0,0 +1,84 @@ +Feature: Modify Student + + In order to make changes on a student + As a student + I want to modify a student + + Background: + Given There is a registered student with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a Student when not logged in + Given I'm not logged in + When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 401 + And The error message is "Unauthorized" + And The student has not been modified to username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + + Scenario: Modify a Student with valid data + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "passwordModified" and email "studentModified@student.app" and phoneNumber "111222333" and name "StudentModified" + Then The response code is 201 + And There is 1 Student created with username "studentModified" and email "studentModified@student.app" and phoneNumber "111222333" and name "StudentModified" + + + Scenario: Modify a student with a blank email: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "password" and email "" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with a blank password: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with an empty phoneNumber: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "passwordModified" and email "studentModified@student.app" and phoneNumber "" and name "StudentModified" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with an empty name: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with an empty username: + Given I login as "student" with password "password" + When I modify a student with username "" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with a null email: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "passwordModified" and email "null" and phoneNumber "111222333" and name "StudentModified" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with a null password: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "null" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with an null phoneNumber: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "null" and name "Student" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + Scenario: Modify a student with an null name: + Given I login as "student" with password "password" + When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "null" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" + + + Scenario: Modify a student with a null username: + Given I login as "student" with password "password" + When I modify a student with username "null" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + Then The response code is 400 + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" \ No newline at end of file From aa6d89cc62a0d67da756ddddf4b83f74bd9583d3 Mon Sep 17 00:00:00 2001 From: Giovanni Date: Sat, 9 Nov 2024 18:46:58 +0100 Subject: [PATCH 4/5] Modify students steps background --- .../demo/steps/ModifyStudentStepDefs.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java new file mode 100644 index 0000000..7398ae1 --- /dev/null +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java @@ -0,0 +1,33 @@ +package cat.udl.eps.softarch.demo.steps; + +import cat.udl.eps.softarch.demo.domain.Property; +import cat.udl.eps.softarch.demo.domain.Student; +import cat.udl.eps.softarch.demo.repository.StudentRepository; +import io.cucumber.java.en.Given; +import org.springframework.beans.factory.annotation.Autowired; + +public class ModifyStudentStepDefs { + + @Autowired + StepDefs stepDefs; + + @Autowired + StudentRepository studentRepository; + + Student studentTest; + + + @Given("There is a registered student with username {string} and password {string} and email {string} and phoneNumber {string} and name {string}") + public void there_is_a_student_already_created_with_values(String username, String password, String email, String phoneNumber, String name) { + this.studentTest = new Student(); + studentTest.setUsername(username); + studentTest.setPassword(password); + studentTest.setEmail(email); + studentTest.setPhoneNumber(phoneNumber); + studentTest.setName(name); + + this.studentRepository.save(studentTest); + } + + +} From 74a11c2384773db1014ac7fd1e528a218641029b Mon Sep 17 00:00:00 2001 From: Giovanni Date: Sat, 9 Nov 2024 20:03:18 +0100 Subject: [PATCH 5/5] Modify students steps test --- .../demo/config/WebSecurityConfig.java | 1 + .../demo/repository/StudentRepository.java | 2 +- .../demo/steps/ModifyStudentStepDefs.java | 62 ++++++++++++++++--- .../resources/features/ModifyStudent.feature | 39 ++++-------- 4 files changed, 68 insertions(+), 36 deletions(-) diff --git a/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java b/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java index 2ed14d8..a0426b4 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java +++ b/src/main/java/cat/udl/eps/softarch/demo/config/WebSecurityConfig.java @@ -41,6 +41,7 @@ protected SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exce .requestMatchers(HttpMethod.DELETE, "/properties/*").hasAuthority("ROLE_OWNER") .requestMatchers(HttpMethod.POST, "/students").permitAll() .requestMatchers(HttpMethod.PUT, "/students/*").hasAuthority("ROLE_STUDENT") + .requestMatchers(HttpMethod.DELETE, "/students/*").hasAuthority("ROLE_STUDENT") .requestMatchers(HttpMethod.POST, "/visits").authenticated() .requestMatchers(HttpMethod.DELETE, "/visits/*").authenticated() .requestMatchers(HttpMethod.POST, "/*/*").authenticated() diff --git a/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java b/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java index da5250c..eb2c3a3 100644 --- a/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java +++ b/src/main/java/cat/udl/eps/softarch/demo/repository/StudentRepository.java @@ -7,6 +7,6 @@ import java.util.List; -public interface StudentRepository extends CrudRepository { +public interface StudentRepository extends CrudRepository { Student findByEmail(@Param("email") String email); } diff --git a/src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java b/src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java index 7398ae1..981bf03 100644 --- a/src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java +++ b/src/test/java/cat/udl/eps/softarch/demo/steps/ModifyStudentStepDefs.java @@ -3,8 +3,19 @@ import cat.udl.eps.softarch.demo.domain.Property; import cat.udl.eps.softarch.demo.domain.Student; import cat.udl.eps.softarch.demo.repository.StudentRepository; +import com.fasterxml.jackson.core.JsonProcessingException; import io.cucumber.java.en.Given; +import io.cucumber.java.en.When; +import org.json.JSONException; +import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; + +import java.nio.charset.StandardCharsets; + +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; +import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; +import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; public class ModifyStudentStepDefs { @@ -14,20 +25,53 @@ public class ModifyStudentStepDefs { @Autowired StudentRepository studentRepository; - Student studentTest; + Student student; @Given("There is a registered student with username {string} and password {string} and email {string} and phoneNumber {string} and name {string}") public void there_is_a_student_already_created_with_values(String username, String password, String email, String phoneNumber, String name) { - this.studentTest = new Student(); - studentTest.setUsername(username); - studentTest.setPassword(password); - studentTest.setEmail(email); - studentTest.setPhoneNumber(phoneNumber); - studentTest.setName(name); - - this.studentRepository.save(studentTest); + this.student = new Student(); + student.setUsername(username); + student.setPassword(password); + student.encodePassword(); + student.setEmail(email); + student.setPhoneNumber(phoneNumber); + student.setName(name); + + + this.studentRepository.save(student); + } + + + + @When("I modify student {string} with username {string} and password {string} and email {string} and phoneNumber {string} and name {string}") + public void modify_a_student_with_values(String studentEmail, String username, String password, String email, String phoneNumber, String name) throws Throwable { + Student studentTest = studentRepository.findByEmail(studentEmail); + String id = studentTest.getId(); + + + studentTest.setEmail(assignValueInput(email)); + studentTest.setPhoneNumber(assignValueInput(phoneNumber)); + studentTest.setName(assignValueInput(name)); + stepDefs.result = this.stepDefs.mockMvc.perform( + put("/students/"+id) + .contentType(MediaType.APPLICATION_JSON) + .content(new JSONObject( + stepDefs.mapper.writeValueAsString(studentTest) + ).put("password", assignValueInput(password)).toString()) + .characterEncoding(StandardCharsets.UTF_8) + .with(AuthenticationStepDefs.authenticate())) + .andDo(print()); } + private String assignValueInput(String value) { + if(value.equals("null")){ + return null; + } + else { + return value; + } + } + } diff --git a/src/test/resources/features/ModifyStudent.feature b/src/test/resources/features/ModifyStudent.feature index 1c5ae65..08dc5bd 100644 --- a/src/test/resources/features/ModifyStudent.feature +++ b/src/test/resources/features/ModifyStudent.feature @@ -9,76 +9,63 @@ Feature: Modify Student Scenario: Modify a Student when not logged in Given I'm not logged in - When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + When I modify student "student@student.app" with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" Then The response code is 401 And The error message is "Unauthorized" - And The student has not been modified to username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a Student with valid data Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "passwordModified" and email "studentModified@student.app" and phoneNumber "111222333" and name "StudentModified" - Then The response code is 201 - And There is 1 Student created with username "studentModified" and email "studentModified@student.app" and phoneNumber "111222333" and name "StudentModified" + When I modify student "student@student.app" with username "student" and password "passwordModified" and email "studentModified@student.app" and phoneNumber "111222333" and name "StudentModified" + Then The response code is 204 + And There is 1 Student created with username "student" and email "studentModified@student.app" and phoneNumber "111222333" and name "StudentModified" Scenario: Modify a student with a blank email: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "password" and email "" and phoneNumber "123123123" and name "Student" + When I modify student "student@student.app" with username "student" and password "password" and email "" and phoneNumber "123123123" and name "Student" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a student with a blank password: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "" and email "student@student.app" and phoneNumber "123123123" and name "Student" + When I modify student "student@student.app" with username "student" and password "" and email "student@student.app" and phoneNumber "123123123" and name "Student" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a student with an empty phoneNumber: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "passwordModified" and email "studentModified@student.app" and phoneNumber "" and name "StudentModified" + When I modify student "student@student.app" with username "student" and password "passwordModified" and email "studentModified@student.app" and phoneNumber "" and name "StudentModified" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a student with an empty name: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "" - Then The response code is 400 - And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" - - Scenario: Modify a student with an empty username: - Given I login as "student" with password "password" - When I modify a student with username "" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" + When I modify student "student@student.app" with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a student with a null email: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "passwordModified" and email "null" and phoneNumber "111222333" and name "StudentModified" + When I modify student "student@student.app" with username "student" and password "passwordModified" and email "null" and phoneNumber "111222333" and name "StudentModified" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a student with a null password: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "null" and email "student@student.app" and phoneNumber "123123123" and name "Student" + When I modify student "student@student.app" with username "student" and password "null" and email "student@student.app" and phoneNumber "123123123" and name "Student" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a student with an null phoneNumber: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "null" and name "Student" + When I modify student "student@student.app" with username "student" and password "password" and email "student@student.app" and phoneNumber "null" and name "Student" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" Scenario: Modify a student with an null name: Given I login as "student" with password "password" - When I modify a student with username "studentModified" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "null" + When I modify student "student@student.app" with username "student" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "null" Then The response code is 400 And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" - - - Scenario: Modify a student with a null username: - Given I login as "student" with password "password" - When I modify a student with username "null" and password "password" and email "student@student.app" and phoneNumber "123123123" and name "Student" - Then The response code is 400 - And There is 1 Student created with username "student" and email "student@student.app" and phoneNumber "123123123" and name "Student" \ No newline at end of file