Cornichon
Introduction
A small Gherkin DSL parser which reads in a feature file and produces stub code against a given test framework. This allows BDD to be integrated into new and existing projects without the need to depend on Cucumber.
The generated code is split into two files - the tests themselves and a set of scenario classes. This is to allow for:
- easier version control of the source code
- re-use of the scenario classes generation between unit test frameworks for the same language
The parser is written in Python and loads plug-ins for the desired output type.
Usage
A very basic test generator might look like
import cornichon
# Read the Gherkin DSL
f = open("example.feature", "r")
gherkin = f.readlines()
f.close()
# Only need to call Settings for the test framework as it builds
# on those settings for the scenarios
settings = cornichon.Settings("cpp/cppunittest")
settings["rootnamespace"] = "Cornichon::"
settings["scenarios file"] = "example.h"
# Generate the tests
fp = open("example.cpp", "w")
fp.write(cornichon.Generate(gherkin, settings, "cpp/cppunittest"))
fp.close()
# Generate the test scenarios
fp = open("example.h", "w")
fp.write(cornichon.Generate(gherkin, settings, "cpp/cppscenarios"))
fp.close()
The values of the settings can be listed,
cornichon.PrintSettings(settings)
An explanation of those values can be printed,
cornichon.HelpSettings("cpp/cppunittest")
The list of available output types can be printed,
cornichon.ListModules()
Test frameworks
C++
The scenario classes are generated using cpp/cppscenarios.
The supported frameworks are:
cpp/cppunittest- Microsoft's Visual C++ test frameworkcpp/googletest- Google Test
C#
The scenario classes are generated using cs/csscenarios.
The supported frameworks are:
cs/nunit- NUnitcs/unittesting- Microsoft's Unit Testing framework
Python
The scenario classes are generated using py/pyscenarios.
The supported frameworks are:
py/pytests- pytest, the pytest frameworkpy/pyunit_tests- unittest, the standard Python unit testing framework
Visual Basic
The scenario classes are generated using vb/vbscenarios.
The supported frameworks are:
vb/nunit- NUnitvb/unittesting- Microsoft's Unit Testing framework
Contributing
Contributions are welcome. Please read the testing documentation.
Release files for cornichon 0.9.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cornichon-0.9.6.tar.gz | 11.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cornichon-0.9.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.2 kB
Release files / cornichon-0.9.6.tar.gz
| Download URL | cornichon-0.9.6.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bf56377a4fcb286397d14ebf4cd41d4bca102afabaff81b293070beaafd4448e
|
|
BLAKE2b-256 checksum How to use checksums |
384bf76c4f9d11e4543c9807b458f50132f95b30d16f15c6f541e724848a2247
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|
Release files / cornichon-0.9.6-py3-none-any.whl
| Download URL | cornichon-0.9.6-py3-none-any.whl |
|---|---|
| Size | 29.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e241caadf7823d7c2a2a702494abbf099f0541296ae4f5d936aeef7e2c030be0
|
|
BLAKE2b-256 checksum How to use checksums |
96579001d4e785ec03f3b6f207377eb0f916333f2d8b0bdb9d49ef9686ad288c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/2.0.0 pkginfo/1.4.2 requests/2.21.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|