behave-gen 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- behave_gen-0.1.0/.gitignore +85 -0
- behave_gen-0.1.0/CHANGELOG.md +48 -0
- behave_gen-0.1.0/LICENSE +21 -0
- behave_gen-0.1.0/PKG-INFO +233 -0
- behave_gen-0.1.0/README.md +168 -0
- behave_gen-0.1.0/behave_gen/__init__.py +7 -0
- behave_gen-0.1.0/behave_gen/__main__.py +13 -0
- behave_gen-0.1.0/behave_gen/cli/__init__.py +1 -0
- behave_gen-0.1.0/behave_gen/cli/app.py +363 -0
- behave_gen-0.1.0/behave_gen/commands/__init__.py +1 -0
- behave_gen-0.1.0/behave_gen/commands/add.py +135 -0
- behave_gen-0.1.0/behave_gen/commands/check.py +177 -0
- behave_gen-0.1.0/behave_gen/commands/environment.py +251 -0
- behave_gen-0.1.0/behave_gen/commands/format.py +48 -0
- behave_gen-0.1.0/behave_gen/commands/from_openapi.py +62 -0
- behave_gen-0.1.0/behave_gen/commands/from_postman.py +55 -0
- behave_gen-0.1.0/behave_gen/commands/from_swagger.py +78 -0
- behave_gen-0.1.0/behave_gen/commands/init.py +130 -0
- behave_gen-0.1.0/behave_gen/commands/lint.py +48 -0
- behave_gen-0.1.0/behave_gen/commands/migrate.py +56 -0
- behave_gen-0.1.0/behave_gen/commands/preview.py +131 -0
- behave_gen-0.1.0/behave_gen/commands/stats.py +122 -0
- behave_gen-0.1.0/behave_gen/commands/steps.py +111 -0
- behave_gen-0.1.0/behave_gen/commands/update.py +138 -0
- behave_gen-0.1.0/behave_gen/config.py +138 -0
- behave_gen-0.1.0/behave_gen/diagnostics.py +60 -0
- behave_gen-0.1.0/behave_gen/generators/__init__.py +11 -0
- behave_gen-0.1.0/behave_gen/generators/base.py +48 -0
- behave_gen-0.1.0/behave_gen/generators/openapi.py +74 -0
- behave_gen-0.1.0/behave_gen/generators/postman.py +80 -0
- behave_gen-0.1.0/behave_gen/paths.py +52 -0
- behave_gen-0.1.0/behave_gen/plugins/__init__.py +1 -0
- behave_gen-0.1.0/behave_gen/plugins/cucumber/__init__.py +22 -0
- behave_gen-0.1.0/behave_gen/plugins/cucumber/migrator.py +122 -0
- behave_gen-0.1.0/behave_gen/plugins/openapi/__init__.py +25 -0
- behave_gen-0.1.0/behave_gen/plugins/openapi/feature_builder.py +105 -0
- behave_gen-0.1.0/behave_gen/plugins/openapi/parser.py +147 -0
- behave_gen-0.1.0/behave_gen/plugins/openapi/step_builder.py +35 -0
- behave_gen-0.1.0/behave_gen/plugins/postman/__init__.py +22 -0
- behave_gen-0.1.0/behave_gen/plugins/postman/feature_builder.py +77 -0
- behave_gen-0.1.0/behave_gen/plugins/postman/parser.py +128 -0
- behave_gen-0.1.0/behave_gen/plugins/swagger/__init__.py +87 -0
- behave_gen-0.1.0/behave_gen/project.py +88 -0
- behave_gen-0.1.0/behave_gen/step_libraries/__init__.py +7 -0
- behave_gen-0.1.0/behave_gen/step_libraries/auth_steps.py.tpl +85 -0
- behave_gen-0.1.0/behave_gen/step_libraries/http_steps.py.tpl +130 -0
- behave_gen-0.1.0/behave_gen/templates/__init__.py +1 -0
- behave_gen-0.1.0/behave_gen/templates/default/README.md +29 -0
- behave_gen-0.1.0/behave_gen/templates/default/behave.toml +6 -0
- behave_gen-0.1.0/behave_gen/templates/default/environment.py +31 -0
- behave_gen-0.1.0/behave_gen/templates/default/environment_with_data.py +34 -0
- behave_gen-0.1.0/behave_gen/templates/default/environment_with_kit.py +34 -0
- behave_gen-0.1.0/behave_gen/templates/default/environment_with_kit_data.py +36 -0
- behave_gen-0.1.0/behave_gen/templates/default/features/.gitkeep +0 -0
- behave_gen-0.1.0/behave_gen/templates/default/features/sample.feature +3 -0
- behave_gen-0.1.0/behave_gen/templates/default/features/steps/.gitkeep +0 -0
- behave_gen-0.1.0/behave_gen/templates/default/pyproject.toml +14 -0
- behave_gen-0.1.0/behave_gen/templates/discovery.py +92 -0
- behave_gen-0.1.0/behave_gen/templates/engine.py +125 -0
- behave_gen-0.1.0/behave_gen/templates/features/crud.feature +18 -0
- behave_gen-0.1.0/behave_gen/templates/features/default.feature +7 -0
- behave_gen-0.1.0/behave_gen/templates/registry.py +65 -0
- behave_gen-0.1.0/examples/README.md +66 -0
- behave_gen-0.1.0/examples/basic-project/README.md +29 -0
- behave_gen-0.1.0/examples/migrated-project/README.md +29 -0
- behave_gen-0.1.0/examples/openapi-project/README.md +29 -0
- behave_gen-0.1.0/pyproject.toml +117 -0
- behave_gen-0.1.0/tests/__init__.py +1 -0
- behave_gen-0.1.0/tests/cli/__init__.py +1 -0
- behave_gen-0.1.0/tests/cli/test_app.py +70 -0
- behave_gen-0.1.0/tests/commands/__init__.py +1 -0
- behave_gen-0.1.0/tests/commands/test_add_feature.py +126 -0
- behave_gen-0.1.0/tests/commands/test_add_steps.py +142 -0
- behave_gen-0.1.0/tests/commands/test_check.py +136 -0
- behave_gen-0.1.0/tests/commands/test_environment.py +162 -0
- behave_gen-0.1.0/tests/commands/test_format.py +72 -0
- behave_gen-0.1.0/tests/commands/test_init.py +123 -0
- behave_gen-0.1.0/tests/commands/test_lint.py +66 -0
- behave_gen-0.1.0/tests/commands/test_migrate.py +36 -0
- behave_gen-0.1.0/tests/commands/test_preview.py +66 -0
- behave_gen-0.1.0/tests/commands/test_stats.py +106 -0
- behave_gen-0.1.0/tests/commands/test_update.py +102 -0
- behave_gen-0.1.0/tests/e2e/__init__.py +7 -0
- behave_gen-0.1.0/tests/e2e/conftest.py +123 -0
- behave_gen-0.1.0/tests/e2e/test_workflow_check_stats_preview.py +62 -0
- behave_gen-0.1.0/tests/e2e/test_workflow_environment_update.py +111 -0
- behave_gen-0.1.0/tests/e2e/test_workflow_from_openapi.py +102 -0
- behave_gen-0.1.0/tests/e2e/test_workflow_from_postman_swagger.py +105 -0
- behave_gen-0.1.0/tests/e2e/test_workflow_init_add_steps.py +155 -0
- behave_gen-0.1.0/tests/e2e/test_workflow_migrate.py +51 -0
- behave_gen-0.1.0/tests/fixtures/cucumber/src/test/java/com/example/LoginSteps.java +12 -0
- behave_gen-0.1.0/tests/fixtures/cucumber/src/test/resources/features/checkout.feature +6 -0
- behave_gen-0.1.0/tests/fixtures/cucumber/src/test/resources/features/login.feature +7 -0
- behave_gen-0.1.0/tests/fixtures/openapi/invalid.txt +1 -0
- behave_gen-0.1.0/tests/fixtures/openapi/petstore.json +39 -0
- behave_gen-0.1.0/tests/fixtures/openapi/petstore.yaml +22 -0
- behave_gen-0.1.0/tests/fixtures/openapi/swagger2.json +8 -0
- behave_gen-0.1.0/tests/fixtures/postman/invalid.json +1 -0
- behave_gen-0.1.0/tests/fixtures/postman/sample_collection.json +38 -0
- behave_gen-0.1.0/tests/fixtures/swagger/petstore_swagger2.json +28 -0
- behave_gen-0.1.0/tests/generators/__init__.py +1 -0
- behave_gen-0.1.0/tests/generators/test_openapi_generator.py +153 -0
- behave_gen-0.1.0/tests/generators/test_postman_generator.py +105 -0
- behave_gen-0.1.0/tests/generators/test_swagger_generator.py +102 -0
- behave_gen-0.1.0/tests/plugins/__init__.py +1 -0
- behave_gen-0.1.0/tests/plugins/cucumber/__init__.py +1 -0
- behave_gen-0.1.0/tests/plugins/cucumber/test_migrator.py +70 -0
- behave_gen-0.1.0/tests/plugins/openapi/__init__.py +1 -0
- behave_gen-0.1.0/tests/plugins/openapi/test_feature_builder.py +67 -0
- behave_gen-0.1.0/tests/plugins/openapi/test_parser.py +63 -0
- behave_gen-0.1.0/tests/plugins/openapi/test_step_builder.py +25 -0
- behave_gen-0.1.0/tests/plugins/postman/__init__.py +1 -0
- behave_gen-0.1.0/tests/plugins/postman/test_feature_builder.py +47 -0
- behave_gen-0.1.0/tests/plugins/postman/test_parser.py +61 -0
- behave_gen-0.1.0/tests/step_libraries/__init__.py +1 -0
- behave_gen-0.1.0/tests/step_libraries/test_http_steps.py +123 -0
- behave_gen-0.1.0/tests/templates/__init__.py +1 -0
- behave_gen-0.1.0/tests/templates/test_engine.py +149 -0
- behave_gen-0.1.0/tests/test_config.py +82 -0
- behave_gen-0.1.0/tests/test_project.py +82 -0
- behave_gen-0.1.0/tests/test_smoke.py +17 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# MkDocs build output
|
|
10
|
+
site/
|
|
11
|
+
|
|
12
|
+
# Distribution / packaging
|
|
13
|
+
.Python
|
|
14
|
+
build/
|
|
15
|
+
develop-eggs/
|
|
16
|
+
dist/
|
|
17
|
+
downloads/
|
|
18
|
+
eggs/
|
|
19
|
+
.eggs/
|
|
20
|
+
lib/
|
|
21
|
+
lib64/
|
|
22
|
+
parts/
|
|
23
|
+
sdist/
|
|
24
|
+
var/
|
|
25
|
+
wheels/
|
|
26
|
+
share/python-wheels/
|
|
27
|
+
*.egg-info/
|
|
28
|
+
.installed.cfg
|
|
29
|
+
*.egg
|
|
30
|
+
MANIFEST
|
|
31
|
+
|
|
32
|
+
# PyInstaller
|
|
33
|
+
*.manifest
|
|
34
|
+
*.spec
|
|
35
|
+
|
|
36
|
+
# Installer logs
|
|
37
|
+
pip-log.txt
|
|
38
|
+
pip-delete-this-directory.txt
|
|
39
|
+
|
|
40
|
+
# Unit test / coverage reports
|
|
41
|
+
htmlcov/
|
|
42
|
+
.tox/
|
|
43
|
+
.nox/
|
|
44
|
+
.coverage
|
|
45
|
+
.coverage.*
|
|
46
|
+
.cache
|
|
47
|
+
nosetests.xml
|
|
48
|
+
coverage.xml
|
|
49
|
+
*.cover
|
|
50
|
+
*.py,cover
|
|
51
|
+
.hypothesis/
|
|
52
|
+
.pytest_cache/
|
|
53
|
+
cover/
|
|
54
|
+
|
|
55
|
+
# Virtual environments
|
|
56
|
+
.env
|
|
57
|
+
.venv
|
|
58
|
+
env/
|
|
59
|
+
venv/
|
|
60
|
+
ENV/
|
|
61
|
+
env.bak/
|
|
62
|
+
venv.bak/
|
|
63
|
+
|
|
64
|
+
# IDEs
|
|
65
|
+
.idea/
|
|
66
|
+
.vscode/
|
|
67
|
+
*.swp
|
|
68
|
+
*.swo
|
|
69
|
+
*~
|
|
70
|
+
|
|
71
|
+
# OS
|
|
72
|
+
.DS_Store
|
|
73
|
+
Thumbs.db
|
|
74
|
+
|
|
75
|
+
# Project-specific reference folder (not for public release)
|
|
76
|
+
ref/
|
|
77
|
+
|
|
78
|
+
# Generated test projects (from manual smoke tests at repo root)
|
|
79
|
+
/my-project/
|
|
80
|
+
/demo/
|
|
81
|
+
/test-project/
|
|
82
|
+
/sandbox/
|
|
83
|
+
/features/
|
|
84
|
+
/environment.py
|
|
85
|
+
/behave.toml
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to behave-gen are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2026-07-24
|
|
11
|
+
|
|
12
|
+
### Tests
|
|
13
|
+
|
|
14
|
+
- 58 end-to-end integration tests in `tests/e2e/` covering full workflows:
|
|
15
|
+
`init` → `add feature` → `add steps` → `behave --dry-run`,
|
|
16
|
+
`from-openapi` (YAML + JSON), `from-postman`, `from-swagger`,
|
|
17
|
+
`migrate` (Cucumber), `check`/`stats`/`preview`, `add environment`/
|
|
18
|
+
`add config`/`update`, and generated code quality (ruff, behave-model parse).
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `init` command: scaffolds a new Behave project from templates.
|
|
23
|
+
- `add feature` command: generates `.feature` files (default, CRUD templates).
|
|
24
|
+
- `add steps` command: adds real, runnable step libraries (HTTP, auth).
|
|
25
|
+
- `add environment` command: rewrites `environment.py` with kit/data wiring.
|
|
26
|
+
- `add config` command: adds ecosystem packages to `pyproject.toml`.
|
|
27
|
+
- `check` command: runs behave-doctor diagnostics with actionable suggestions.
|
|
28
|
+
- `doctor` command: alias for `check`.
|
|
29
|
+
- `lint` command: delegates to behave-lint CLI.
|
|
30
|
+
- `format` command: delegates to behave-format CLI.
|
|
31
|
+
- `from-openapi` command: generates features and HTTP steps from OpenAPI 3.x.
|
|
32
|
+
- `from-postman` command: generates features from Postman Collection v2.1.
|
|
33
|
+
- `from-swagger` command: converts Swagger 2.0 to OpenAPI 3.x and generates.
|
|
34
|
+
- `migrate` command: migrates Cucumber (Java) projects to Behave layout.
|
|
35
|
+
- `preview` command: pretty-prints `.feature` files.
|
|
36
|
+
- `stats` command: reports project statistics (features, scenarios, steps, tags).
|
|
37
|
+
- `update` command: upgrades generated files to latest behave-gen versions.
|
|
38
|
+
- Pluggable template engine with string and Jinja2 backends.
|
|
39
|
+
- Pluggable generator architecture (OpenAPI, Postman plugins).
|
|
40
|
+
- Optional dependency strategy via extras (doctor, lint, format, openapi, etc.).
|
|
41
|
+
- Example projects in `examples/` demonstrating init, from-openapi, and migrate.
|
|
42
|
+
- GitHub community files: issue templates, PR template, dependabot, contributing
|
|
43
|
+
guide, code of conduct, security policy.
|
|
44
|
+
- Trusted Publishing (OIDC) release workflow to PyPI.
|
|
45
|
+
- ADR-0001: no empty step-definition skeletons.
|
|
46
|
+
- ADR-0002: modular monolith with plugin generators.
|
|
47
|
+
- ADR-0003: template engine design.
|
|
48
|
+
- ADR-0004: optional dependency strategy.
|
behave_gen-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 behave-gen contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: behave-gen
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CLI toolkit for scaffolding and evolving Behave BDD projects.
|
|
5
|
+
Project-URL: Homepage, https://github.com/behave-gen/behave-gen
|
|
6
|
+
Project-URL: Documentation, https://behave-gen.github.io/behave-gen/
|
|
7
|
+
Project-URL: Repository, https://github.com/behave-gen/behave-gen
|
|
8
|
+
Project-URL: Issues, https://github.com/behave-gen/behave-gen/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/behave-gen/behave-gen/blob/main/CHANGELOG.md
|
|
10
|
+
Author: Mathias Paulenko
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: bdd,behave,codegen,cucumber,gherkin,openapi,scaffolding
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Requires-Dist: behave-model>=1.0
|
|
26
|
+
Requires-Dist: behave>=1.2.6
|
|
27
|
+
Requires-Dist: typer>=0.12
|
|
28
|
+
Provides-Extra: all
|
|
29
|
+
Requires-Dist: behave-data>=1.0; extra == 'all'
|
|
30
|
+
Requires-Dist: behave-doctor>=1.0; extra == 'all'
|
|
31
|
+
Requires-Dist: behave-format>=1.0; extra == 'all'
|
|
32
|
+
Requires-Dist: behave-kit>=1.0; extra == 'all'
|
|
33
|
+
Requires-Dist: behave-lint>=1.0; extra == 'all'
|
|
34
|
+
Requires-Dist: jinja2>=3.1; extra == 'all'
|
|
35
|
+
Requires-Dist: pyyaml>=6.0; extra == 'all'
|
|
36
|
+
Provides-Extra: data
|
|
37
|
+
Requires-Dist: behave-data>=1.0; extra == 'data'
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: build>=1.2; extra == 'dev'
|
|
40
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
41
|
+
Requires-Dist: pre-commit>=3.7; extra == 'dev'
|
|
42
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
43
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
45
|
+
Provides-Extra: docs
|
|
46
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
47
|
+
Requires-Dist: mkdocs>=1.6; extra == 'docs'
|
|
48
|
+
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'docs'
|
|
49
|
+
Provides-Extra: doctor
|
|
50
|
+
Requires-Dist: behave-doctor>=1.0; extra == 'doctor'
|
|
51
|
+
Provides-Extra: format
|
|
52
|
+
Requires-Dist: behave-format>=1.0; extra == 'format'
|
|
53
|
+
Provides-Extra: jinja2
|
|
54
|
+
Requires-Dist: jinja2>=3.1; extra == 'jinja2'
|
|
55
|
+
Provides-Extra: kit
|
|
56
|
+
Requires-Dist: behave-kit>=1.0; extra == 'kit'
|
|
57
|
+
Provides-Extra: lint
|
|
58
|
+
Requires-Dist: behave-lint>=1.0; extra == 'lint'
|
|
59
|
+
Provides-Extra: openapi
|
|
60
|
+
Requires-Dist: pyyaml>=6.0; extra == 'openapi'
|
|
61
|
+
Provides-Extra: postman
|
|
62
|
+
Provides-Extra: swagger
|
|
63
|
+
Requires-Dist: pyyaml>=6.0; extra == 'swagger'
|
|
64
|
+
Description-Content-Type: text/markdown
|
|
65
|
+
|
|
66
|
+
# behave-gen
|
|
67
|
+
|
|
68
|
+
A CLI toolkit for scaffolding and evolving Behave BDD projects.
|
|
69
|
+
|
|
70
|
+
[](https://github.com/behave-gen/behave-gen/actions/workflows/ci.yml)
|
|
71
|
+
[](https://behave-gen.github.io/behave-gen/)
|
|
72
|
+
[](https://pypi.org/project/behave-gen/)
|
|
73
|
+
[](https://www.python.org/downloads/)
|
|
74
|
+
[](LICENSE)
|
|
75
|
+
[](https://docs.astral.sh/ruff/)
|
|
76
|
+
[](https://mypy-lang.org/)
|
|
77
|
+
|
|
78
|
+
`behave-gen` helps you create, extend, and maintain Behave (Python BDD)
|
|
79
|
+
projects. It scaffolds new projects, generates `.feature` files and concrete
|
|
80
|
+
step definitions, integrates ecosystem tools (behave-doctor, behave-lint,
|
|
81
|
+
behave-format), and migrates Cucumber projects to Behave.
|
|
82
|
+
|
|
83
|
+
## Features
|
|
84
|
+
|
|
85
|
+
| Command | Description |
|
|
86
|
+
| ------- | ----------- |
|
|
87
|
+
| `init` | Scaffold a new Behave project with sensible defaults. |
|
|
88
|
+
| `add feature` | Generate `.feature` files from templates (default, CRUD). |
|
|
89
|
+
| `add steps` | Add real, runnable step libraries (HTTP, auth). No empty skeletons. |
|
|
90
|
+
| `add environment` | Rewrite `environment.py` with behave-kit/behave-data wiring. |
|
|
91
|
+
| `add config` | Add ecosystem packages to `pyproject.toml` idempotently. |
|
|
92
|
+
| `check` | Run behave-doctor diagnostics with actionable suggestions. |
|
|
93
|
+
| `doctor` | Alias for `check`. |
|
|
94
|
+
| `lint` | Lint `.feature` files via behave-lint. |
|
|
95
|
+
| `format` | Format `.feature` files via behave-format. |
|
|
96
|
+
| `from-openapi` | Generate features and HTTP steps from an OpenAPI 3.x spec. |
|
|
97
|
+
| `from-postman` | Generate features from a Postman Collection v2.1. |
|
|
98
|
+
| `from-swagger` | Convert Swagger 2.0 to OpenAPI 3.x and generate features. |
|
|
99
|
+
| `migrate` | Migrate a Cucumber (Java) project to Behave. |
|
|
100
|
+
| `preview` | Pretty-print a `.feature` file. |
|
|
101
|
+
| `stats` | Report project statistics (features, scenarios, steps, tags). |
|
|
102
|
+
| `update` | Upgrade generated files to the latest behave-gen versions. |
|
|
103
|
+
|
|
104
|
+
## Installation
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pip install behave-gen
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
With optional extras:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pip install behave-gen[doctor,lint,format,openapi]
|
|
114
|
+
pip install behave-gen[all]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| Extra | Provides |
|
|
118
|
+
| ----- | -------- |
|
|
119
|
+
| `doctor` | `behave-doctor` — static analysis for `check`/`doctor`. |
|
|
120
|
+
| `lint` | `behave-lint` — Gherkin linting for `lint`. |
|
|
121
|
+
| `format` | `behave-format` — Gherkin formatting for `format`. |
|
|
122
|
+
| `openapi` | `pyyaml` — YAML parsing for `from-openapi`/`from-swagger`. |
|
|
123
|
+
| `jinja2` | `jinja2` — alternative template engine. |
|
|
124
|
+
| `kit` | `behave-kit` — environment hooks. |
|
|
125
|
+
| `data` | `behave-data` — test data fixtures. |
|
|
126
|
+
| `all` | All of the above. |
|
|
127
|
+
|
|
128
|
+
## Quick start
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Create a new Behave project
|
|
132
|
+
behave-gen init my-project
|
|
133
|
+
cd my-project
|
|
134
|
+
|
|
135
|
+
# Add a feature file
|
|
136
|
+
behave-gen add feature login
|
|
137
|
+
|
|
138
|
+
# Add HTTP step definitions
|
|
139
|
+
behave-gen add steps --lib http
|
|
140
|
+
|
|
141
|
+
# Check project health
|
|
142
|
+
behave-gen check
|
|
143
|
+
|
|
144
|
+
# Run tests
|
|
145
|
+
behave
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Generating from an OpenAPI spec
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
behave-gen from-openapi spec.yaml --out-dir gen --step-lib http --tag api
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
This produces `.feature` files grouped by path, each with scenarios that use
|
|
155
|
+
the HTTP step library syntax. The `--step-lib http` flag also generates a
|
|
156
|
+
concrete, runnable `http_steps.py` module.
|
|
157
|
+
|
|
158
|
+
## Migrating from Cucumber
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
behave-gen migrate path/to/cucumber-project --out-dir migrated
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Feature files are copied into a Behave `features/` layout. Java step
|
|
165
|
+
definitions are not auto-translated; use `behave-gen add steps` to generate
|
|
166
|
+
Python equivalents.
|
|
167
|
+
|
|
168
|
+
## Examples
|
|
169
|
+
|
|
170
|
+
The [`examples/`](examples/) directory contains ready-to-run projects that
|
|
171
|
+
demonstrate each workflow:
|
|
172
|
+
|
|
173
|
+
- **[`basic-project`](examples/basic-project/)** — `init` + `add feature` +
|
|
174
|
+
`add steps` with HTTP and auth step libraries.
|
|
175
|
+
- **[`openapi-project`](examples/openapi-project/)** — `from-openapi` generating
|
|
176
|
+
features and HTTP steps from a Petstore OpenAPI 3.0 spec.
|
|
177
|
+
- **[`migrated-project`](examples/migrated-project/)** — `migrate` converting a
|
|
178
|
+
Cucumber (Java) project to Behave feature files.
|
|
179
|
+
|
|
180
|
+
See [`examples/README.md`](examples/README.md) for details.
|
|
181
|
+
|
|
182
|
+
## Architecture
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
behave_gen/
|
|
186
|
+
cli/ Typer CLI application
|
|
187
|
+
commands/ One module per CLI command
|
|
188
|
+
generators/ Pluggable code generators (OpenAPI, Postman)
|
|
189
|
+
plugins/ Source-specific parsers and builders
|
|
190
|
+
step_libraries/ Built-in step library templates (HTTP, auth)
|
|
191
|
+
templates/ Project and feature templates
|
|
192
|
+
diagnostics.py Optional-dependency handling
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Supply chain & trust
|
|
196
|
+
|
|
197
|
+
- **Trusted Publishing (OIDC)** — releases to PyPI use
|
|
198
|
+
[Trusted Publishing](https://docs.pypi.org/trusted-publishers/) via GitHub
|
|
199
|
+
Actions OIDC. No long-lived API tokens are stored in secrets.
|
|
200
|
+
- **Pinned actions** — all GitHub Actions are pinned to specific versions
|
|
201
|
+
(e.g. `@v4`, `@v1.12.4`).
|
|
202
|
+
- **Minimal dependencies** — only `behave`, `behave-model`, and `typer` at
|
|
203
|
+
runtime. All other dependencies are optional extras.
|
|
204
|
+
- **`py.typed` marker** — the package ships with inline type hints.
|
|
205
|
+
- **Reproducible builds** — `hatchling` build backend with no dynamic metadata.
|
|
206
|
+
|
|
207
|
+
## Development
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
git clone https://github.com/behave-gen/behave-gen.git
|
|
211
|
+
cd behave-gen
|
|
212
|
+
pip install -e ".[dev]"
|
|
213
|
+
pre-commit install
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
| Command | Description |
|
|
217
|
+
| ------- | ----------- |
|
|
218
|
+
| `make help` | Show all available targets. |
|
|
219
|
+
| `make dev` | Install with dev extras. |
|
|
220
|
+
| `make lint` | Run `ruff check` + `mypy --strict`. |
|
|
221
|
+
| `make lint-fix` | Auto-fix lint issues. |
|
|
222
|
+
| `make format` | Format the code with `ruff format`. |
|
|
223
|
+
| `make format-check` | Verify formatting without changes. |
|
|
224
|
+
| `make test` | Run the test suite. |
|
|
225
|
+
| `make test-cov` | Run tests with coverage. |
|
|
226
|
+
| `make build` | Build sdist + wheel into `dist/`. |
|
|
227
|
+
| `make clean` | Remove build artifacts and caches. |
|
|
228
|
+
|
|
229
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
|
|
230
|
+
|
|
231
|
+
## License
|
|
232
|
+
|
|
233
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# behave-gen
|
|
2
|
+
|
|
3
|
+
A CLI toolkit for scaffolding and evolving Behave BDD projects.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/behave-gen/behave-gen/actions/workflows/ci.yml)
|
|
6
|
+
[](https://behave-gen.github.io/behave-gen/)
|
|
7
|
+
[](https://pypi.org/project/behave-gen/)
|
|
8
|
+
[](https://www.python.org/downloads/)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](https://docs.astral.sh/ruff/)
|
|
11
|
+
[](https://mypy-lang.org/)
|
|
12
|
+
|
|
13
|
+
`behave-gen` helps you create, extend, and maintain Behave (Python BDD)
|
|
14
|
+
projects. It scaffolds new projects, generates `.feature` files and concrete
|
|
15
|
+
step definitions, integrates ecosystem tools (behave-doctor, behave-lint,
|
|
16
|
+
behave-format), and migrates Cucumber projects to Behave.
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
| Command | Description |
|
|
21
|
+
| ------- | ----------- |
|
|
22
|
+
| `init` | Scaffold a new Behave project with sensible defaults. |
|
|
23
|
+
| `add feature` | Generate `.feature` files from templates (default, CRUD). |
|
|
24
|
+
| `add steps` | Add real, runnable step libraries (HTTP, auth). No empty skeletons. |
|
|
25
|
+
| `add environment` | Rewrite `environment.py` with behave-kit/behave-data wiring. |
|
|
26
|
+
| `add config` | Add ecosystem packages to `pyproject.toml` idempotently. |
|
|
27
|
+
| `check` | Run behave-doctor diagnostics with actionable suggestions. |
|
|
28
|
+
| `doctor` | Alias for `check`. |
|
|
29
|
+
| `lint` | Lint `.feature` files via behave-lint. |
|
|
30
|
+
| `format` | Format `.feature` files via behave-format. |
|
|
31
|
+
| `from-openapi` | Generate features and HTTP steps from an OpenAPI 3.x spec. |
|
|
32
|
+
| `from-postman` | Generate features from a Postman Collection v2.1. |
|
|
33
|
+
| `from-swagger` | Convert Swagger 2.0 to OpenAPI 3.x and generate features. |
|
|
34
|
+
| `migrate` | Migrate a Cucumber (Java) project to Behave. |
|
|
35
|
+
| `preview` | Pretty-print a `.feature` file. |
|
|
36
|
+
| `stats` | Report project statistics (features, scenarios, steps, tags). |
|
|
37
|
+
| `update` | Upgrade generated files to the latest behave-gen versions. |
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install behave-gen
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
With optional extras:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install behave-gen[doctor,lint,format,openapi]
|
|
49
|
+
pip install behave-gen[all]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
| Extra | Provides |
|
|
53
|
+
| ----- | -------- |
|
|
54
|
+
| `doctor` | `behave-doctor` — static analysis for `check`/`doctor`. |
|
|
55
|
+
| `lint` | `behave-lint` — Gherkin linting for `lint`. |
|
|
56
|
+
| `format` | `behave-format` — Gherkin formatting for `format`. |
|
|
57
|
+
| `openapi` | `pyyaml` — YAML parsing for `from-openapi`/`from-swagger`. |
|
|
58
|
+
| `jinja2` | `jinja2` — alternative template engine. |
|
|
59
|
+
| `kit` | `behave-kit` — environment hooks. |
|
|
60
|
+
| `data` | `behave-data` — test data fixtures. |
|
|
61
|
+
| `all` | All of the above. |
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Create a new Behave project
|
|
67
|
+
behave-gen init my-project
|
|
68
|
+
cd my-project
|
|
69
|
+
|
|
70
|
+
# Add a feature file
|
|
71
|
+
behave-gen add feature login
|
|
72
|
+
|
|
73
|
+
# Add HTTP step definitions
|
|
74
|
+
behave-gen add steps --lib http
|
|
75
|
+
|
|
76
|
+
# Check project health
|
|
77
|
+
behave-gen check
|
|
78
|
+
|
|
79
|
+
# Run tests
|
|
80
|
+
behave
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Generating from an OpenAPI spec
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
behave-gen from-openapi spec.yaml --out-dir gen --step-lib http --tag api
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
This produces `.feature` files grouped by path, each with scenarios that use
|
|
90
|
+
the HTTP step library syntax. The `--step-lib http` flag also generates a
|
|
91
|
+
concrete, runnable `http_steps.py` module.
|
|
92
|
+
|
|
93
|
+
## Migrating from Cucumber
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
behave-gen migrate path/to/cucumber-project --out-dir migrated
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Feature files are copied into a Behave `features/` layout. Java step
|
|
100
|
+
definitions are not auto-translated; use `behave-gen add steps` to generate
|
|
101
|
+
Python equivalents.
|
|
102
|
+
|
|
103
|
+
## Examples
|
|
104
|
+
|
|
105
|
+
The [`examples/`](examples/) directory contains ready-to-run projects that
|
|
106
|
+
demonstrate each workflow:
|
|
107
|
+
|
|
108
|
+
- **[`basic-project`](examples/basic-project/)** — `init` + `add feature` +
|
|
109
|
+
`add steps` with HTTP and auth step libraries.
|
|
110
|
+
- **[`openapi-project`](examples/openapi-project/)** — `from-openapi` generating
|
|
111
|
+
features and HTTP steps from a Petstore OpenAPI 3.0 spec.
|
|
112
|
+
- **[`migrated-project`](examples/migrated-project/)** — `migrate` converting a
|
|
113
|
+
Cucumber (Java) project to Behave feature files.
|
|
114
|
+
|
|
115
|
+
See [`examples/README.md`](examples/README.md) for details.
|
|
116
|
+
|
|
117
|
+
## Architecture
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
behave_gen/
|
|
121
|
+
cli/ Typer CLI application
|
|
122
|
+
commands/ One module per CLI command
|
|
123
|
+
generators/ Pluggable code generators (OpenAPI, Postman)
|
|
124
|
+
plugins/ Source-specific parsers and builders
|
|
125
|
+
step_libraries/ Built-in step library templates (HTTP, auth)
|
|
126
|
+
templates/ Project and feature templates
|
|
127
|
+
diagnostics.py Optional-dependency handling
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Supply chain & trust
|
|
131
|
+
|
|
132
|
+
- **Trusted Publishing (OIDC)** — releases to PyPI use
|
|
133
|
+
[Trusted Publishing](https://docs.pypi.org/trusted-publishers/) via GitHub
|
|
134
|
+
Actions OIDC. No long-lived API tokens are stored in secrets.
|
|
135
|
+
- **Pinned actions** — all GitHub Actions are pinned to specific versions
|
|
136
|
+
(e.g. `@v4`, `@v1.12.4`).
|
|
137
|
+
- **Minimal dependencies** — only `behave`, `behave-model`, and `typer` at
|
|
138
|
+
runtime. All other dependencies are optional extras.
|
|
139
|
+
- **`py.typed` marker** — the package ships with inline type hints.
|
|
140
|
+
- **Reproducible builds** — `hatchling` build backend with no dynamic metadata.
|
|
141
|
+
|
|
142
|
+
## Development
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
git clone https://github.com/behave-gen/behave-gen.git
|
|
146
|
+
cd behave-gen
|
|
147
|
+
pip install -e ".[dev]"
|
|
148
|
+
pre-commit install
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
| Command | Description |
|
|
152
|
+
| ------- | ----------- |
|
|
153
|
+
| `make help` | Show all available targets. |
|
|
154
|
+
| `make dev` | Install with dev extras. |
|
|
155
|
+
| `make lint` | Run `ruff check` + `mypy --strict`. |
|
|
156
|
+
| `make lint-fix` | Auto-fix lint issues. |
|
|
157
|
+
| `make format` | Format the code with `ruff format`. |
|
|
158
|
+
| `make format-check` | Verify formatting without changes. |
|
|
159
|
+
| `make test` | Run the test suite. |
|
|
160
|
+
| `make test-cov` | Run tests with coverage. |
|
|
161
|
+
| `make build` | Build sdist + wheel into `dist/`. |
|
|
162
|
+
| `make clean` | Remove build artifacts and caches. |
|
|
163
|
+
|
|
164
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full guidelines.
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"""Entry point for ``python -m behave_gen``.
|
|
2
|
+
|
|
3
|
+
Delegates to the Typer CLI defined in :mod:`behave_gen.cli.app`.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import sys
|
|
9
|
+
|
|
10
|
+
from behave_gen.cli.app import run
|
|
11
|
+
|
|
12
|
+
if __name__ == "__main__":
|
|
13
|
+
sys.exit(run(sys.argv[1:]))
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CLI package for behave-gen."""
|