From 9ff38a185bd5f850df4dc6140f71cbdead3a8295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Youen=20Ch=C3=A9n=C3=A9?= Date: Thu, 5 Oct 2023 16:58:11 +0200 Subject: [PATCH] fix: swagger + more tolerance --- service/EcobenchmarkBackEnd-0.0.1-swagger.yaml | 16 ++++++++-------- test/check-service-conformity.feature | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/service/EcobenchmarkBackEnd-0.0.1-swagger.yaml b/service/EcobenchmarkBackEnd-0.0.1-swagger.yaml index 4d37536..47c1a20 100644 --- a/service/EcobenchmarkBackEnd-0.0.1-swagger.yaml +++ b/service/EcobenchmarkBackEnd-0.0.1-swagger.yaml @@ -181,13 +181,13 @@ components: type: string format: uuid example: 276f6a6f-0afa-4e50-9e39-7130f5aea9d2 - accountId: + account_id: type: string example: d290f1ee-6c54-4b01-90e6-d701748f0851 name: type: string example: My Task List - creationDate: + creation_date: type: string format: date-time example: '2022-06-29T13:37:00.001Z' @@ -213,7 +213,7 @@ components: type: string format: uuid example: c6516320-e069-4238-a5c3-a57df2c1bc32 - listId: + list_id: type: string example: 276f6a6f-0afa-4e50-9e39-7130f5aea9d2 name: @@ -222,23 +222,23 @@ components: description: type: string example: Just do it ! - creationDate: + creation_date: type: string format: date-time example: '2022-06-29T13:37:00.001Z' AccountStatistic: type: object properties: - accountId: + account_id: type: string format: uuid example: d290f1ee-6c54-4b01-90e6-d701748f0851 - accountLogin: + account_login: type: string example: My Personal Account - listCount: + list_count: type: number example: 42 - taskAvg: + task_avg: type: number example: 1337 \ No newline at end of file diff --git a/test/check-service-conformity.feature b/test/check-service-conformity.feature index 98b079e..ea9b11b 100644 --- a/test/check-service-conformity.feature +++ b/test/check-service-conformity.feature @@ -35,7 +35,7 @@ Scenario: Simple Conformity Scenario - API Behavior and Cache agressive check And request { name: #(task_name), description: #(task_description) } When method post Then match [200, 201, 204] contains responseStatus - Then match response contains { id: #uuid, name: #(task_name), description: #(task_description) , list_id: #(list_id) } + Then match response contains { id: #uuid, name: #(task_name), description: #(task_description)} Then def task_id = response.id # Check current list content Given path 'api/accounts',account_id,'lists' @@ -50,6 +50,7 @@ Scenario: Simple Conformity Scenario - API Behavior and Cache agressive check Given path 'api/stats' And header Content-Type = 'application/json' When method get + Then print response Then match [200, 201, 204] contains responseStatus Then def sub_result = karate.filter(response, x => { return x.account_id == account_id } ) Then match sub_result[0] contains { account_id: #(account_id), account_login: #(account_name), list_count:1, task_avg:1 } @@ -61,7 +62,7 @@ Scenario: Simple Conformity Scenario - API Behavior and Cache agressive check And request { name: #(task_name_2), description: #(task_description_2) } When method post Then match [200, 201, 204] contains responseStatus - Then match response contains { id: #uuid, name: #(task_name_2), description: #(task_description_2) , list_id: #(list_id) } + Then match response contains { id: #uuid, name: #(task_name_2), description: #(task_description_2) } Then def task_id_2 = response.id # Check current list content - should be 2 tasks Given path 'api/accounts',account_id,'lists' @@ -103,7 +104,7 @@ Scenario: Simple Conformity Scenario - API Behavior and Cache agressive check And request { name: #(task_name), description: #(task_description) } When method post Then match [200, 201, 204] contains responseStatus - Then match response contains { id: #uuid, name: #(task_name), description: #(task_description), list_id: #(list_id_2)} + Then match response contains { id: #uuid, name: #(task_name), description: #(task_description)} Then def task_id_1_2 = response.id # Check current lists content - should be 2 tasks Given path 'api/accounts',account_id,'lists'