diff --git a/src/test/resources/features/Clockify.feature b/src/test/resources/features/Clockify.feature new file mode 100644 index 0000000..7b3e833 --- /dev/null +++ b/src/test/resources/features/Clockify.feature @@ -0,0 +1,159 @@ +@Clockify +Feature: Clockify + + Background: + And header Content-Type = application/json + And header Accept = */* + And header x-api-key = NGY2NGQ1N2ItZWY0NC00OWFiLWIzNjktY2ZmMzE3MmU0ZTU0 + + @WS @WorkSpace @Exitoso @200 + Scenario: Traer Workspaces + Given base url env.base_url_clockify + And endpoint /v1/workspaces + When execute method GET + Then the status code should be 200 + * define workspaceId = $.[0].id + + @WS @WorkSpaceErrorHeader @WorkSpaceFallido @401 + Scenario: Traer workspaces con accion no autorizada + Given header x-api-key = /no_header/ + And base url env.base_url_clockify + And endpoint /v1/workspaces + When execute method GET + Then the status code should be 401 + + @WS @WorkSpaceErrorEndpoint @WorkSpaceFallido @404 + Scenario: Traer workspaces con accion no encontrada + Given base url env.base_url_clockify + And endpoint /no_endpoint/ + When execute method GET + Then the status code should be 404 + + @CP @CrearProyecto @Exitoso @201 + Scenario: Crear un proyecto + Given call Clockify.feature@WorkSpace + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects + And set value "ProyectoTest" of key name in body agregarProyecto.json + When execute method POST + Then the status code should be 201 + + @CP @CrearProyectoErrorBody @CrearProyectoFallido @Error @400 + Scenario: Crear un proyecto sin respuesta + Given call Clockify.feature@WorkSpace + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects + And set value "ProyectoTest" of key name in body no json + When execute method POST + Then the status code should be 400 + + @CP @CrearProyectoErrorHeader @CrearProyectoFallido @Error @401 + Scenario: Crear un proyecto con accion no autorizado + Given header x-api-key = /no_header/ + And call Clockify.feature@WorkSpace + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects + And set value "ProyectoTest" of key name in body agregarProyecto.json + When execute method POST + Then the status code should be 401 + + @CP @CrearProyectoErrorEndpoint @CrearProyectoFallido @Error @404 + Scenario: Crear un proyecto con accion no encontrada + Given call Clockify.feature@WorkSpace + And base url env.base_url_clockify + And endpoint /no_endpoint/ + And set value "ProyectoTest" of key name in body agregarProyecto.json + When execute method POST + Then the status code should be 404 + + @TP @TraerProyecto @Exitoso @200 + Scenario: Traer proyecto + Given call Clockify.feature@WorkSpace + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects/ + When execute method GET + Then the status code should be 200 + * define projectId = $.[0].id + + @TP @TraerProyectooErrorHeader @TraerProyectoFallido @Error @401 + Scenario: Traer proyecto con accion no autorizado + Given header x-api-key = /no_header/ + And call Clockify.feature@WorkSpace + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects/ + When execute method GET + Then the status code should be 401 + + @TP @TraerProyectoErrorEndpoint @TraerProyectoFallido @Error @404 + Scenario: Traer proyecto con accion no encontrada + Given call Clockify.feature@WorkSpace + And base url env.base_url_clockify + And endpoint /no_endpoint/ + When execute method GET + Then the status code should be 404 + + @BID @BuscarporID @Exitoso @200 + Scenario: Buscar proyecto por ID + Given call Clockify.feature@TraerProyecto + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects/{{projectId}} + When execute method GET + Then the status code should be 200 + + @BID @BuscarporIDErrorHeader @BuscarporIDFallido @Error @401 + Scenario: Buscar proyecto por ID con accion no autorizado + Given header x-api-key = /no_header/ + And call Clockify.feature@TraerProyecto + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects/{{projectId}} + When execute method GET + Then the status code should be 401 + + @BID @BuscarporIDErrorEndpoint @BuscarporIDFallido @Error @404 + Scenario: Buscar proyecto por ID con accion no encontrada + Given call Clockify.feature@TraerProyecto + And base url env.base_url_clockify + And endpoint /no_endpoint/ + When execute method GET + Then the status code should be 404 + + @RP @RenombrarProyecto @Exitoso @200 + Scenario: Renombrar un proyecto + Given call Clockify.feature@TraerProyecto + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects/{{projectId}} + And set value "ProyectoTestRenombrado" of key name in body agregarProyecto.json + When execute method PUT + Then the status code should be 200 + And response should be name = ProyectoTestRenombrado + + @RP @RenombrarProyectoErrorHeader @RenombrarProyectoFallido @Error @401 + Scenario: Renombrar un proyecto con accion no autorizado + Given header x-api-key = /no_header/ + And call Clockify.feature@TraerProyecto + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects/{{projectId}} + And set value "ProyectoTestRenombrado" of key name in body agregarProyecto.json + When execute method PUT + Then the status code should be 401 + + @RP @RenombrarProyectoErrorBody @RenombrarProyectoFallido @Error @400 + Scenario: Renombrar un proyecto + Given call Clockify.feature@TraerProyecto + And base url env.base_url_clockify + And endpoint /v1/workspaces/{{workspaceId}}/projects/{{projectId}} + And set value "ProyectoTestRenombrado" of key name in body no json + When execute method PUT + Then the status code should be 400 + + @RP @RenombrarProyectoErrorEndpoint @RenombrarProyectoFallido @Error @404 + Scenario: Renombrar un proyecto + Given call Clockify.feature@TraerProyecto + And base url env.base_url_clockify + And endpoint /no_header/ + And set value "ProyectoTestRenombrado" of key name in body agregarProyecto.json + When execute method PUT + Then the status code should be 404 + + + diff --git a/src/test/resources/features/Sample.feature b/src/test/resources/features/Sample.feature deleted file mode 100644 index 46b64f9..0000000 --- a/src/test/resources/features/Sample.feature +++ /dev/null @@ -1,60 +0,0 @@ -@Sample -Feature: Sample - - Background: - And header Content-Type = application/json - And header Accept = */* - - - @RickAndMorty - Scenario Outline: Get character - Given base url env.base_url_rickAndMorty - And endpoint character/ - When execute method GET - Then the status code should be 200 - And response should be $.name = - And response should be $.status = - And validate schema character.json - - Examples: - | id_character | name | status | - | 1 | Rick Sanchez | Alive | - | 2 | Morty Smith | Alive | - - @petstore - Scenario Outline: Add a new pet to the store - Given base url env.base_url_petstore - And endpoint pet - And header accept = application/json - And header Content-Type = application/json - And body body.json - When execute method POST - Then the status code should be 200 - And response should be name = - And validate schema pet.json - - Examples: - | name | - | doggie | - - @petstore - Scenario Outline: Add a new pet to the store - Given base url env.base_url_petstore - And endpoint pet - And header accept = application/json - And header Content-Type = application/json - And delete keyValue tags[0].id in body body.json - And set value 15 of key tags[1].id in body body.json - And set value "tag2" of key tags[1].name in body body.json - When execute method POST - Then the status code should be 200 - And response should be name = - And validate schema pet.json - - Examples: - | name | - | doggie | - - - - diff --git a/src/test/resources/jsons/bodies/agregarProyecto.json b/src/test/resources/jsons/bodies/agregarProyecto.json new file mode 100644 index 0000000..4a60b89 --- /dev/null +++ b/src/test/resources/jsons/bodies/agregarProyecto.json @@ -0,0 +1,3 @@ +{ + "name": "string" +} \ No newline at end of file diff --git a/src/test/resources/lippia.conf b/src/test/resources/lippia.conf index f072a11..26c2e2d 100644 --- a/src/test/resources/lippia.conf +++ b/src/test/resources/lippia.conf @@ -1,17 +1,14 @@ environments { default { - "base_url_rickAndMorty" = "https://rickandmortyapi.com/api/" - "base_url_petstore" = "https://petstore.swagger.io/v2/" + "base_url_clockify" = "https://api.clockify.me/api" } test { - "base_url_rickAndMorty" = "https://rickandmortyapi.com/api/" - "base_url_petstore" = "https://petstore.swagger.io/v2/" + "base_url_clockify" = "https://api.clockify.me/api" } dev { - "base_url_rickAndMorty" = "https://rickandmortyapi.com/api/" - "base_url_petstore" = "https://petstore.swagger.io/v2/" + "base_url_clockify" = "https://api.clockify.me/api" } } \ No newline at end of file