Review feature and scenario definitions. Removing unnecesary and redundant steps.

This commit is contained in:
Roberto Abdelkader Martínez Pérez
2019-08-23 12:46:10 +02:00
parent 8752f419b5
commit 991ae618bb
13 changed files with 62 additions and 150 deletions
@@ -1,9 +1,9 @@
Feature: Kapow! server reject insert requests with malformed JSON bodies.
Feature: Kapow! server rejects insertion requests with malformed JSON bodies.
Kapow! server will reject to insert a route when
it receives a malformed json document in the
it receives a malformed JSON document in the
request body.
Scenario: Error because a malformed JSON document.
Scenario: Error because of malformed JSON document.
If a request comes with an invalid JSON document
the server will respond with a bad request error.
@@ -1,11 +1,10 @@
Feature: Kapow! server reject insert responses with semantic errors.
Feature: Kapow! server rejects insertion responses with semantic errors.
Kapow! server will reject to insert routes when
it receives a valid json but not conforming document.
it receives a valid JSON but not conforming document.
Scenario: Error because of lack of mandatory fields.
If a request lacks of any of the mandatory fields
the server responds with an error indicating the
missing fields.
Scenario: Error because lacking mandatory fields.
If a request lacks any mandatory fields the server
responds with an error.
Given I have a running Kapow! server
When I insert the route:
@@ -18,7 +17,7 @@ Feature: Kapow! server reject insert responses with semantic errors.
Then I get 422 as response code
And I get "Invalid Route" as response reason phrase
Scenario: Error because of wrong route specification.
Scenario: Error because wrong route specification.
If a request contains an invalid expression in the
url_pattern field the server responds with an error.
@@ -1,10 +1,9 @@
Feature: Routes auto-ordering after inserting in a Kapow! server.
Feature: Consistent route ordering after inserting a route in a Kapow! server.
When inserting routes the server will mantain the
whole set of routes ordered an with consecutive indexes.
whole set of routes ordered and with consecutive indexes.
Background:
Given I have a Kapow! server whith the following routes:
Given I have a Kapow! server with the following routes:
| method | url_pattern | entrypoint | command |
| GET | /listRootDir | /bin/sh -c | ls -la / \| response /body |
| GET | /listDir/{dirname} | /bin/sh -c | ls -la /request/params/dirname \| response /body |
@@ -24,23 +23,8 @@ Feature: Routes auto-ordering after inserting in a Kapow! server.
"index": 0
}
"""
Then I get 201 as response code
And I get "Created" as response reason phrase
And I get the following response body:
"""
{
"method": "GET",
"url_pattern": "/listVarDir",
"entrypoint": "/bin/sh -c",
"command": "ls -la /var | response /body",
"index": 0,
"id": ANY
}
"""
When I request a routes listing
Then I get 200 as response code
And I get "OK" as response reason phrase
And I get a list with the following elements:
And I request a routes listing
Then I get the following response body:
"""
[
{
@@ -84,23 +68,8 @@ Feature: Routes auto-ordering after inserting in a Kapow! server.
"index": 2
}
"""
Then I get 201 as response code
And I get "Created" as response reason phrase
And I get the following response body:
"""
{
"method": "GET",
"url_pattern": "/listVarDir",
"entrypoint": "/bin/sh -c",
"command": "ls -la /var | response /body",
"index": 2,
"id": ANY
}
"""
When I request a routes listing
Then I get 200 as response code
And I get "OK" as response reason phrase
And I get a list with the following elements:
And I request a routes listing
Then I get the following response body:
"""
[
{
@@ -145,23 +114,8 @@ Feature: Routes auto-ordering after inserting in a Kapow! server.
"index": 1
}
"""
Then I get 201 as response code
And I get "Created" as response reason phrase
And I get the following response body:
"""
{
"method": "GET",
"url_pattern": "/listVarDir",
"entrypoint": "/bin/sh -c",
"command": "ls -la /var | response /body",
"index": 1,
"id": ANY
}
"""
When I request a routes listing
Then I get 200 as response code
And I get "OK" as response reason phrase
And I get a list with the following elements:
And I request a routes listing
Then I get the following response body:
"""
[
{
@@ -1,16 +1,16 @@
Feature: Insert new routes in Kapow! server.
Insert routes allow users to configure the server. New
routes could be inserted at the begining or before any
Inserting routes allows users to configure the server. New
routes could be inserted at the beginning or before any
existing route of the routes list.
Background:
Given I have a Kapow! server whith the following routes:
Given I have a Kapow! server with the following routes:
| method | url_pattern | entrypoint | command |
| GET | /listRootDir | /bin/sh -c | ls -la / \| response /body |
| GET | /listDir/{dirname} | /bin/sh -c | ls -la /request/params/dirname \| response /body |
Scenario: Insert a route at the beginning.
A route can be inserted at the begining of the list
A route can be inserted at the beginning of the list
by specifying an index 0 in the request.
When I insert the route: