From 513f12e2e48299633f5bf58a84248eaf060166e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Hurtado?= Date: Thu, 29 Aug 2019 14:44:45 +0200 Subject: [PATCH] Rewritten data/request and data/response features. Bigger size for scenarios and steps in gherkin-lint --- spec/test/.gherkin-lintrc | 2 +- .../features/data/request/success.feature | 32 ++++++++------- .../features/data/response/success.feature | 40 ++++++++++--------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/spec/test/.gherkin-lintrc b/spec/test/.gherkin-lintrc index 7944f61..1243a2e 100644 --- a/spec/test/.gherkin-lintrc +++ b/spec/test/.gherkin-lintrc @@ -24,7 +24,7 @@ "new-line-at-eof": ["on", "yes"], "no-multiple-empty-lines": "on", "no-scenario-outlines-without-examples": "on", - "name-length": ["on", {"Feature": 80}], + "name-length": ["on", {"Feature": 80, "Step": 80, "Scenario": 80}], "no-restricted-tags": ["on", {"tags": ["@watch", "@wip"]}], "use-and": "on", "no-duplicate-tags": "on", diff --git a/spec/test/features/data/request/success.feature b/spec/test/features/data/request/success.feature index c929930..dd46dd4 100644 --- a/spec/test/features/data/request/success.feature +++ b/spec/test/features/data/request/success.feature @@ -1,26 +1,28 @@ Feature: Retrieve request resources from a handler in Kapow! server. - Users can retrieve request handler resources - from the server by specifying the handler id - and the resource path. + Users can retrieve request resources by + specifying the handler id and the + resource path. - Scenario Outline: Retrieve all defined resources for the current request. - Get the following resources for the current - request through the current handler. + Scenario Outline: Retrieve different resources for the current request. + Get the following resources for the + current request through the current + handler. - Given I have a Kapow! server with the following routes: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir/{path} | /bin/sh -c | ls -la / \| response /body | - - When I send a request to the route "/listRootDir/otro" setting this values: - | type | name | value | + Given I have a Kapow! server with the following testing routes: + | method | url_pattern | + | GET | /listRootDir/{path} | + When I send a request to the testing route "/listRootDir/otro" adding: + | fieldType | name | value | | parameter | "par1" | "paramVal1" | | header | "head1" | "headVal1" | | cookie | "cook1" | "cookieVal1" | - - And I get the resource for the current request handler + And I get the resource Then I get 200 as response code And I get "OK" as response reason phrase - And I get the following response body + And I get the following response raw body: + """ + + """ Examples: | resourcePath | value | diff --git a/spec/test/features/data/response/success.feature b/spec/test/features/data/response/success.feature index a95cc90..e2006f2 100644 --- a/spec/test/features/data/response/success.feature +++ b/spec/test/features/data/response/success.feature @@ -1,34 +1,38 @@ -Feature: Setting response values for handler resources in Kapow! server. +Feature: Setting values for handler response resources in Kapow! server. Users can set the values in the response resources by specifying the handler id and the resource path. Scenario: Set status code for the current response. - Set the status code for the current - response through the current handler. + Set the status code through the current + handler. - Given I have a Kapow! server with the following routes: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir | /bin/sh -c | echo 666 \| response /status | - When I send a request to the route "/listRootDir" + Given I have a Kapow! server with the following testing routes: + | method | url_pattern | + | GET | /listRootDir | + When I send a request to the testing route "/listRootDir" + And I set the resource "response/status" with value 666 + And I release the testing request Then I get 666 as response code And I get "OK" as response reason phrase - Scenario Outline: Set all defined resources for the current response. + Scenario Outline: Set different resources for the current response. Set the following resources for the current response through the current handler. - Given I have a Kapow! server with the following routes: - | method | url_pattern | entrypoint | command | - | GET | /listRootDir | /bin/sh -c | echo \| response | - When I send a request to the route "/listRootDir" + Given I have a Kapow! server with the following testing routes: + | method | url_pattern | + | GET | /listRootDir | + When I send a request to the testing route "/listRootDir" + And I set the resource with value + And I release the testing request Then I get 200 as response code And I get "OK" as response reason phrase - And I get the value for the response named + And I get the value for the response named Examples: - | resourcePath | value | type | elementName | - | /headers/head1 | "headVal1" | header | "head1" | - | /cookies/cook1 | "cookVal1" | cookie | "cook1" | - | /body | "bodyValue1" | body | "" | - | /stream | "bodyValue2" | body | "" | + | resourcePath | value | fieldType | elementName | + | /headers/head1 | "headVal1" | header | "head1" | + | /cookies/cook1 | "cookVal1" | cookie | "cook1" | + | /body | "bodyValue1" | body | "" | + | /stream | "bodyValue2" | body | "" |