Cucmber generator
Для формирования .feature файлов на основе html tags. Необходимую информацию для .feature файлов берем из epic/issue GitLab и GitHub.
Установка
Вводим в терминал следующую команду
pip install generator-cucumber
или вносим в requirements.txt
generator-cucumber==<version>
Пример работы generator-cucumber
- Создаем epic и добавляем специальные tags (дублирующие ключевые слова языка Gherkin)
<src-1>
<src-1-1>
<scenario>Напишем сценарий</scenario>
<given>Здесь добавим given</given>
<when>Здесь добавим when</when>
<then>Здесь добавим then</then>
<group>
<then>Таблица THEN<groupin> </groupin> </then>
| Наименование | Что-то |
|---|---|
<examples>Первый</examples> |
1 |
<examples>Второй</examples> |
2 |
<examples>Третий</examples> |
3 |
</group>
</src-1-1>
</src-1>
- В GitLab Epic будет выглядить следующим образом
Напишем сценарий
Здесь добавим given
Здесь добавим when
Здесь добавим then
| Наименование | Что-то |
|---|---|
| Первый | 1 |
| Второй | 2 |
| Третий | 3 |
- После установки generator-cucumber создаем тест (например test_example.py)
from generator_cucumber import Generator
Generator.URL_GIT = 'https://gitlab.com/' # url развернутого gitlab
Generator.PRIVATE_TOKEN_GIT = 'gsdff-sdx5DkswkqSDFSSQnVL' #'здесь необходим ваш access token (для примeра)
Generator.create_cucumber(
group_id=100, # номер группы в которой написан epic
epi_iid=1, # номер epic
name_file='test_lib', # наименование файла .feature (любое удобное)
scenario_number='src-1-1', # текст к которому относиться тест
ssl_verify=True # если все ок с ssl, по умолчанию false
)
- После запуска теста сформируется .feature файл и папка featurecache для контроля изменений в тексте
# https://gitlab.com/python_epic/test_pr/-/epic/1
# Di
# 2024-08-01T01:48:53.366Z
Feature: Тестируем lib
Scenario: Напишем сценарий
Given Здесь добавим given
When Здесь добавим when
Then Таблица THEN "<col_1>", "<col_2>", "<col_3>"
Examples: col_1, col_2, col_3
| col_1 | col_2 | col_3 |
| Первый | Второй | Третий |
Html tags
| gherkin equivalent | HTML equivalent |
|---|---|
| "and" | <and></and> |
| "background" | <background></background> |
| "but" | <but></but> |
| "examples" | <examples></examples> |
| "feature" | <feature></feature> |
| "given" | <given></given> |
| "scenario" | <scenario></scenario> |
| "scenarioOutline" | <scenariooutline></scenariooutline> |
| "then" | <then></then> |
| "when" | <when></when> |
Html tags ➕
| gherkin equivalent | HTML equivalent (tags) | Описание |
|---|---|---|
| "groupin" | <groupin></groupin> |
Место куда поставиться examples |
| "scr-1-1" | <scr-1-1></scr-1-1> |
Для ограничения места для генерации (номер условный) |
Стуктура проекта
# Проект по генерации .feature
├── 📁 generator_cucumber/
| ├── 🐍 api_github.py # для работы с github (не реализован)
| ├── 🐍 api_gitlab.py # Для работы с gitlab
| ├── 🐍 bdd_generator.py # Для работы с .py и подготовка шаблона bdd
| ├── 🐍 cache_file.py # создание файлов cache
| ├── 🐍 create_file.py # Обработка файлов cache и .feature
| ├── 🐍 cucumber_text.py # Формирование .feature текст
| └── 🐍 generator.py # входная точка
└── ...
Metadata
Release files for generator-cucumber 0.0.23
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| generator_cucumber-0.0.23.tar.gz | 69.6 kB | Without provenance | Details for generator_cucumber-0.0.23.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| generator_cucumber-0.0.23-py3-none-any.whl | Python 3 | none | any | Details for generator_cucumber-0.0.23-py3-none-any.whl |
Total release size: 83.8 kB
Release files / generator_cucumber-0.0.23.tar.gz
| Download URL | generator_cucumber-0.0.23.tar.gz |
|---|---|
| Size | 69.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcf6aceed560324b6dd69454f79ab28b2e8b9c1c85868088df54d881f7c673e8
|
|
BLAKE2b-256 checksum How to use checksums |
8acd520b974df823a6425b1811758830c331f1d37ce166c2921b900d16e63ac3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.19
|
Release files / generator_cucumber-0.0.23-py3-none-any.whl
| Download URL | generator_cucumber-0.0.23-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5358d04ff11de68b86656ad4822baa6e962afa00ab0eb4c88928168cb769905c
|
|
BLAKE2b-256 checksum How to use checksums |
72747f1ea2090b5372bed3797ed6b4c7a2fc36f27e3d70e924b5254068108809
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.19
|
Security for generator-cucumber 0.0.23
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.