Merge branch 'master' of ssh://github.com/BBVA/kapow

Merged
This commit is contained in:
Héctor Hurtado
2019-08-26 13:32:17 +02:00
8 changed files with 220 additions and 71 deletions
+4 -2
View File
@@ -1,7 +1,9 @@
.PHONY: lint wip test fix catalog
.PHONY: lint wip test fix catalog sync
all: test
all: sync test
sync:
pipenv sync
lint:
gherkin-lint
wip:
+1
View File
@@ -6,6 +6,7 @@ verify_ssl = true
[dev-packages]
ipython = "*"
ipdb = "*"
rstcheck = "*"
[packages]
behave = "*"
+18 -3
View File
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "203306870267e9afb4beb819586ddc910310d39399cbd7294a6b9148c88dd3b3"
"sha256": "d60d486e13f1ad7384822a59b10f68fa1262dc9b1812d42cbac35ca585a3bb7a"
},
"pipfile-spec": 6,
"requires": {
@@ -54,9 +54,9 @@
},
"parse": {
"hashes": [
"sha256:1b68657434d371e5156048ca4a0c5aea5afc6ca59a2fea4dd1a575354f617142"
"sha256:a5fca7000c6588d77bc65c28f3f21bfce03b5e44daa8f9f07c17fe364990d717"
],
"version": "==1.12.0"
"version": "==1.12.1"
},
"parse-type": {
"hashes": [
@@ -103,6 +103,14 @@
],
"version": "==4.4.0"
},
"docutils": {
"hashes": [
"sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0",
"sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827",
"sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"
],
"version": "==0.15.2"
},
"ipdb": {
"hashes": [
"sha256:473fdd798a099765f093231a8b1fabfa95b0b682fce12de0c74b61a4b4d8ee57"
@@ -176,6 +184,13 @@
],
"version": "==2.4.2"
},
"rstcheck": {
"hashes": [
"sha256:92c4f79256a54270e0402ba16a2f92d0b3c15c8f4410cb9c57127067c215741f"
],
"index": "pypi",
"version": "==3.3.1"
},
"six": {
"hashes": [
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c",
+96
View File
@@ -0,0 +1,96 @@
Kapow Spec Test Suite
=====================
This is a generic test suite to be run against ANY Kapow!
implementation.
Prerequisites
-------------
First of all you need a working ``kapow server`` installed to run the
tests against it:
Check that your installation is correct by typing this in a shell:
.. code-block:: bash
kapow --help
You should see a help screen. If not fix it before continuing.
How to run the test suite?
==========================
With the above requisites in place and with your command shell in this
very directory run:
.. code-block:: bash
make
This should test the current installed kapow implementation and output
something like:
.. code-block:: plain
13 features passed, 0 failed, 0 skipped
23 scenarios passed, 0 failed, 0 skipped
99 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m23.553s
Troubleshooting
---------------
Environment customization
~~~~~~~~~~~~~~~~~~~~~~~~~
You can customize some of the test behavior with the following
environment variables:
* ``KAPOW_SERVER_CMD``: The full command line to start a non-interactive
listening kapow server. By default: ``kapow server``
* ``KAPOW_CONTROLAPI_URL``: URL of the Control API. By default: ``http://localhost:8081``
* ``KAPOW_DATAAPI_URL``: URL of the Data API. By default: ``http://localhost:8080``
Fixing tests one by one
~~~~~~~~~~~~~~~~~~~~~~~
If you use ``make fix`` instead of ``make`` the first failing test will stop
the execution, giving you a chance of inspecting the result. Also the
tests will be in DEBUG mode displaying all requests made to the server.
How to develop new tests?
=========================
Developing new steps
--------------------
First of all execute ``make catalog`` this will display all the existing
steps and associates features. If none of the steps fits your needs
write a new one in your feature and run ``make catalog`` again.
The detected new step will trigger the output of a new section with a
template for the step definition to be implemented (you can copy and
paste it removing the ``u'`` unicode symbol of the strings).
Developing new step definitions
-------------------------------
To make you life easier, mark the feature or scenario you are working on
with the tag ``@wip`` and use ``make wip`` to run only your
scenario/feature.
1. Paste the step definition template you just copied at the end of the
file ``steps/steps.py``.
2. Run ``make wip`` to test that the step is triggered. You should see a
``NotImplementedError`` exception.
3. Implement your step.
4. Run ``make wip`` again.
When you finish implementing your step definitions remove the ``@wip`` of
your feature/scenario and run ``make`` to test everything together.