Skip to content

Commit

Permalink
Rework documentation structure
Browse files Browse the repository at this point in the history
  • Loading branch information
elchupanebrej committed Oct 6, 2024
1 parent cc342ee commit db0d4cc
Show file tree
Hide file tree
Showing 46 changed files with 251 additions and 283 deletions.
158 changes: 79 additions & 79 deletions CHANGES.rst

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions Features/Feature/Description.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Feature: Descriptions
Free-form descriptions can be placed underneath Feature, Example/Scenario, Background, Scenario Outline and Rule.
You can write anything you like, as long as no line starts with a keyword.
Descriptions can be in the form of Markdown - formatters including the official HTML formatter support this.

Scenario:
Given File "Description.feature" with content:
"""gherkin
Feature:
My Feature description
Scenario:
Given I check feature description
"""
And File "conftest.py" with content:
"""python
from pytest_bdd import given
@given('I check feature description')
def step(feature):
assert feature.description == "My Feature description"
"""
When run pytest
Then pytest outcome must contain tests with statuses:
|passed|failed|
| 1| 0|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,15 @@ Feature: Descriptions
Given File "Description.feature" with content:
"""gherkin
Feature:
My Feature description
Scenario:
My Scenario description
Given I check feature description
Given I check scenario description
"""
And File "conftest.py" with content:
"""python
from pytest_bdd import given
@given('I check feature description')
def step(feature):
assert feature.description == "My Feature description"
@given('I check scenario description')
def step(scenario):
assert "My Scenario description" in scenario.description
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
264 changes: 135 additions & 129 deletions docs/features.rst
Original file line number Diff line number Diff line change
@@ -1,129 +1,135 @@
.. NOTE:: Features below are part of end-to-end test suite; You always could find most specific
use cases of **pytest-bdd-ng** by investigation of its regression
test suite https://github.com/elchupanebrej/pytest-bdd-ng/tree/default/tests

Feature tags.feature
!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Feature tags.feature
:code: gherkin

Feature and scenario could have descriptions.feature
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Feature and scenario could have descriptions.feature
:code: gherkin

Tutorial launch.feature
!!!!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Tutorial launch.feature
:code: gherkin

Feature tag conversion.feature
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Feature tag conversion.feature
:code: gherkin

Steps could have data tables.feature
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Steps could have data tables.feature
:code: gherkin

Feature localization.feature
!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Feature localization.feature
:code: gherkin

Steps to step definition bounding.feature
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Steps to step definition bounding.feature
:code: gherkin

Steps could have doc strings.feature
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. include:: ../Features/Steps could have doc strings.feature
:code: gherkin

Step define target fixtures.feature
"""""""""""""""""""""""""""""""""""

.. include:: ../Features/Step definition/Step define target fixtures.feature
:code: gherkin

Step utilize fixtures.feature
"""""""""""""""""""""""""""""

.. include:: ../Features/Step definition/Step utilize fixtures.feature
:code: gherkin

Scenario search from base url.feature
"""""""""""""""""""""""""""""""""""""

.. include:: ../Features/Load/Scenario search from base url.feature
:code: gherkin

Autoload.feature
""""""""""""""""

.. include:: ../Features/Load/Autoload.feature
:code: gherkin

Scenario function loader.feature
""""""""""""""""""""""""""""""""

.. include:: ../Features/Load/Scenario function loader.feature
:code: gherkin

Scenario search from base directory.feature
"""""""""""""""""""""""""""""""""""""""""""

.. include:: ../Features/Load/Scenario search from base directory.feature
:code: gherkin

Scenario tags.feature
"""""""""""""""""""""

.. include:: ../Features/Scenario/Scenario tags.feature
:code: gherkin

Defaults.feature
################

.. include:: ../Features/Step definition/Parameters/Defaults.feature
:code: gherkin

Injection as fixtures.feature
#############################

.. include:: ../Features/Step definition/Parameters/Injection as fixtures.feature
:code: gherkin

Conversion.feature
##################

.. include:: ../Features/Step definition/Parameters/Conversion.feature
:code: gherkin

Parsing by custom parser.feature
################################

.. include:: ../Features/Step definition/Parameters/Parsing by custom parser.feature
:code: gherkin

Parsing.feature
###############

.. include:: ../Features/Step definition/Parameters/Parsing.feature
:code: gherkin

Tags for Scenario Outlines examples.feature
###########################################

.. include:: ../Features/Scenario/Outline/Tags for Scenario Outlines examples.feature
:code: gherkin
.. NOTE:: Features below are part of end-to-end test suite; You always could find most specific
use cases of **pytest-bdd-ng** by investigation of its regression
test suite https://github.com/elchupanebrej/pytest-bdd-ng/tree/default/tests

Feature\Description.feature
"""""""""""""""""""""""""""

.. include:: ../Features/Feature/Description.feature
:code: gherkin

Feature\Localization.feature
""""""""""""""""""""""""""""

.. include:: ../Features/Feature/Localization.feature
:code: gherkin

Feature\Tag conversion.feature
""""""""""""""""""""""""""""""

.. include:: ../Features/Feature/Tag conversion.feature
:code: gherkin

Feature\Tag.feature
"""""""""""""""""""

.. include:: ../Features/Feature/Tag.feature
:code: gherkin

Scenario\Description.feature
""""""""""""""""""""""""""""

.. include:: ../Features/Scenario/Description.feature
:code: gherkin

Scenario\Tag.feature
""""""""""""""""""""

.. include:: ../Features/Scenario/Tag.feature
:code: gherkin

Step\Data table.feature
"""""""""""""""""""""""

.. include:: ../Features/Step/Data table.feature
:code: gherkin

Step\Doc string.feature
"""""""""""""""""""""""

.. include:: ../Features/Step/Doc string.feature
:code: gherkin

Step\Step definition bounding.feature
"""""""""""""""""""""""""""""""""""""

.. include:: ../Features/Step/Step definition bounding.feature
:code: gherkin

Step definition\Pytest fixtures substitution.feature
""""""""""""""""""""""""""""""""""""""""""""""""""""

.. include:: ../Features/Step definition/Pytest fixtures substitution.feature
:code: gherkin

Step definition\Target fixtures specification.feature
"""""""""""""""""""""""""""""""""""""""""""""""""""""

.. include:: ../Features/Step definition/Target fixtures specification.feature
:code: gherkin

Tutrorial\Launch.feature
""""""""""""""""""""""""

.. include:: ../Features/Tutrorial/Launch.feature
:code: gherkin

Feature\Load\Autoload.feature
#############################

.. include:: ../Features/Feature/Load/Autoload.feature
:code: gherkin

Feature\Load\Scenario function loader.feature
#############################################

.. include:: ../Features/Feature/Load/Scenario function loader.feature
:code: gherkin

Feature\Load\Scenario search from base directory.feature
########################################################

.. include:: ../Features/Feature/Load/Scenario search from base directory.feature
:code: gherkin

Feature\Load\Scenario search from base url.feature
##################################################

.. include:: ../Features/Feature/Load/Scenario search from base url.feature
:code: gherkin

Scenario\Outline\Examples Tag.feature
#####################################

.. include:: ../Features/Scenario/Outline/Examples Tag.feature
:code: gherkin

Step definition\Parameters\Conversion.feature
#############################################

.. include:: ../Features/Step definition/Parameters/Conversion.feature
:code: gherkin

Step definition\Parameters\Defaults.feature
###########################################

.. include:: ../Features/Step definition/Parameters/Defaults.feature
:code: gherkin

Step definition\Parameters\Injection as fixtures.feature
########################################################

.. include:: ../Features/Step definition/Parameters/Injection as fixtures.feature
:code: gherkin

Step definition\Parameters\Parsing by custom parser.feature
###########################################################

.. include:: ../Features/Step definition/Parameters/Parsing by custom parser.feature
:code: gherkin

Step definition\Parameters\Parsing.feature
##########################################

.. include:: ../Features/Step definition/Parameters/Parsing.feature
:code: gherkin
10 changes: 6 additions & 4 deletions src/pytest_bdd/script/bdd_tree_to_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ def convert(features_path: Path, output_file_path: Path):
sub_processable_paths = list(filter(methodcaller("is_dir"), processable_path.iterdir()))

for path in gherkin_file_paths:
rel_path = path.relative_to(features_path)
content += dedent(
# language=rst
f"""\
{path.name}
{SECTION_SYMBOLS[len(path.relative_to(features_path).parts)-1]*len(path.name)}
{rel_path}
{SECTION_SYMBOLS[len(rel_path.parts)-1]*len(str(rel_path))}
.. include:: {(output_path_rel_to_features_path / path.relative_to(features_path)).as_posix()}
:code: gherkin
Expand All @@ -61,11 +62,12 @@ def convert(features_path: Path, output_file_path: Path):
)

for path in struct_bdd_file_paths:
rel_path = path.relative_to(features_path)
content += dedent(
# language=rst
f"""\
{path.name}
{SECTION_SYMBOLS[len(path.relative_to(features_path).parts)-1]*len(path.name)}
{rel_path}
{SECTION_SYMBOLS[len(rel_path.parts)-1]*len(str(rel_path))}
.. include:: {(output_path_rel_to_features_path / path.relative_to(features_path)).as_posix()}
:code: yaml
Expand Down
4 changes: 2 additions & 2 deletions tests/doc/test_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def test_doc_generation(testdir: "Testdir"):
.. include:: features/simple.gherkin
:code: gherkin
other_simple.gherkin
""""""""""""""""""""
extra\\other_simple.gherkin
""""""""""""""""""""""""""
.. include:: features/extra/other_simple.gherkin
:code: gherkin
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e/Features/Features could be tagged.desktop

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Features/Features load from base directory.desktop

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Features/Features load from base url.desktop

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Features/Features tags could be converted.desktop

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Features/Gherkin feature description access.desktop

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Features/Gherkin feature localization.desktop

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Features/Gherkin features autoload.desktop

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions tests/e2e/Features/Gherkin steps parameters defaults.desktop

This file was deleted.

Loading

0 comments on commit db0d4cc

Please sign in to comment.