Rewritten data/request and data/response features. Bigger size for scenarios and steps in gherkin-lint

This commit is contained in:
Héctor Hurtado
2019-08-29 14:44:45 +02:00
parent 48ab14d49d
commit 513f12e2e4
3 changed files with 40 additions and 34 deletions
+1 -1
View File
@@ -24,7 +24,7 @@
"new-line-at-eof": ["on", "yes"], "new-line-at-eof": ["on", "yes"],
"no-multiple-empty-lines": "on", "no-multiple-empty-lines": "on",
"no-scenario-outlines-without-examples": "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"]}], "no-restricted-tags": ["on", {"tags": ["@watch", "@wip"]}],
"use-and": "on", "use-and": "on",
"no-duplicate-tags": "on", "no-duplicate-tags": "on",
+17 -15
View File
@@ -1,26 +1,28 @@
Feature: Retrieve request resources from a handler in Kapow! server. Feature: Retrieve request resources from a handler in Kapow! server.
Users can retrieve request handler resources Users can retrieve request resources by
from the server by specifying the handler id specifying the handler id and the
and the resource path. resource path.
Scenario Outline: Retrieve all defined resources for the current request. Scenario Outline: Retrieve different resources for the current request.
Get the following resources for the current Get the following resources for the
request through the current handler. current request through the current
handler.
Given I have a Kapow! server with the following routes: Given I have a Kapow! server with the following testing routes:
| method | url_pattern | entrypoint | command | | method | url_pattern |
| GET | /listRootDir/{path} | /bin/sh -c | ls -la / \| response /body | | GET | /listRootDir/{path} |
When I send a request to the testing route "/listRootDir/otro" adding:
When I send a request to the route "/listRootDir/otro" setting this values: | fieldType | name | value |
| type | name | value |
| parameter | "par1" | "paramVal1" | | parameter | "par1" | "paramVal1" |
| header | "head1" | "headVal1" | | header | "head1" | "headVal1" |
| cookie | "cook1" | "cookieVal1" | | cookie | "cook1" | "cookieVal1" |
And I get the resource <resourcePath>
And I get the resource <resourcePath> for the current request handler
Then I get 200 as response code Then I get 200 as response code
And I get "OK" as response reason phrase And I get "OK" as response reason phrase
And I get the following response body <value> And I get the following response raw body:
"""
<value>
"""
Examples: Examples:
| resourcePath | value | | resourcePath | value |
@@ -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 Users can set the values in the response
resources by specifying the handler id resources by specifying the handler id
and the resource path. and the resource path.
Scenario: Set status code for the current response. Scenario: Set status code for the current response.
Set the status code for the current Set the status code through the current
response through the current handler. handler.
Given I have a Kapow! server with the following routes: Given I have a Kapow! server with the following testing routes:
| method | url_pattern | entrypoint | command | | method | url_pattern |
| GET | /listRootDir | /bin/sh -c | echo 666 \| response /status | | GET | /listRootDir |
When I send a request to the route "/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 Then I get 666 as response code
And I get "OK" as response reason phrase 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 Set the following resources for the current
response through the current handler. response through the current handler.
Given I have a Kapow! server with the following routes: Given I have a Kapow! server with the following testing routes:
| method | url_pattern | entrypoint | command | | method | url_pattern |
| GET | /listRootDir | /bin/sh -c | echo <value> \| response <resourcePath> | | GET | /listRootDir |
When I send a request to the route "/listRootDir" When I send a request to the testing route "/listRootDir"
And I set the resource <resourcePath> with value <value>
And I release the testing request
Then I get 200 as response code Then I get 200 as response code
And I get "OK" as response reason phrase And I get "OK" as response reason phrase
And I get the value <value> for the response <type> named <elementName> And I get the value <value> for the response <fieldType> named <elementName>
Examples: Examples:
| resourcePath | value | type | elementName | | resourcePath | value | fieldType | elementName |
| /headers/head1 | "headVal1" | header | "head1" | | /headers/head1 | "headVal1" | header | "head1" |
| /cookies/cook1 | "cookVal1" | cookie | "cook1" | | /cookies/cook1 | "cookVal1" | cookie | "cook1" |
| /body | "bodyValue1" | body | "" | | /body | "bodyValue1" | body | "" |
| /stream | "bodyValue2" | body | "" | | /stream | "bodyValue2" | body | "" |