Metadata-Version: 2.1
Name: tursu
Version: 0.10.1
Summary: A gherkin tests runner
Author-Email: Guillaume Gauvrit <guillaume@gauvr.it>
License: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Topic :: Utilities
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Project-URL: Homepage, https://mardiros.github.io/tursu
Project-URL: Documentation, https://mardiros.github.io/tursu
Project-URL: Repository, https://github.com/mardiros/tursu.git
Project-URL: Issues, https://github.com/mardiros/tursu/issues
Project-URL: Changelog, https://mardiros.github.io/tursu/user/changelog.html
Requires-Python: >=3.10
Requires-Dist: gherkin-official>=32.0.0
Requires-Dist: pydantic>=2.10.6
Requires-Dist: pytest>=8.3.5
Requires-Dist: venusian<4,>=3.1.1
Provides-Extra: docs
Requires-Dist: furo>=2024.5.6; extra == "docs"
Requires-Dist: linkify-it-py<3,>=2.0.3; extra == "docs"
Requires-Dist: myst-parser<4,>=3.0.0; python_version < "3.10" and extra == "docs"
Requires-Dist: myst-parser<5,>=4.0.0; python_version >= "3.10" and extra == "docs"
Requires-Dist: sphinx<8,>=7.0.1; extra == "docs"
Requires-Dist: sphinx-autodoc2<1,>=0.5.0; extra == "docs"
Description-Content-Type: text/markdown

# Turşu

This project allows you to write **Gherkin**-based behavior-driven development (BDD) tests
and execute them using **pytest**.

It compiles Gherkin syntax into Python code using **Abstract Syntax Tree (AST)** manipulation,
enabling seamless integration with pytest for running your tests.

## Features

- Write tests using **Gherkin syntax**.
- Write **step definitions** in Python for with type hinting to cast Gherkin parameters.
- Execute tests directly with **pytest**.
- Compile Gherkin scenarios to Python code using **AST**.

## Getting started

### Installation using uv

```bash
uv add --group dev tursu
```

### Creating a new test suite

The simplest way to initialize a test suite is to run the tursu cli.

```
uv run tursu init
```

### Discover your tests.

```bash
𝝿 uv run pytest --collect-only tests/functionals
========================== test session starts ==========================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
configfile: pyproject.toml
plugins: cov-6.0.0
collected 3 items

<Dir tursu>
  <Dir tests>
    <Package functionals>
      <Module test_1_As_a_user_I_logged_in_with_my_password.py>
        <Function test_3_I_properly_logged_in>
        <Function test_7_I_hit_the_wrong_password>
        <Function test_14_I_user_another_login>

====================== 3 tests collected in 0.01s =======================
```

### Run the tests.

```bash
𝝿 uv run pytest tests/functionals
========================== test session starts ==========================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
configfile: pyproject.toml
collected 3 items

tests/functionals/test_1_As_a_user_I_logged_in_with_my_password.py . [ 33%]
..                                                                [100%]

=========================== 3 passed in 0.02s ===========================
```

Or run it with the details:

```bash
𝝿 uv run pytest -v tests/functionals
============================= test session starts =============================
platform linux -- Python 3.13.2, pytest-8.3.5, pluggy-1.5.0
configfile: pyproject.toml
collected 3 items


📄 Document: login.feature
🥒 Feature: As a user I logged in with my password
🎬 Scenario: I properly logged in
✅ Given a user Bob with password dumbsecret
✅ When Bob login with password dumbsecret
✅ Then I am connected with username Bob
                                                                         PASSED

📄 Document: login.feature
🥒 Feature: As a user I logged in with my password
🎬 Scenario: I hit the wrong password
✅ Given a user Bob with password dumbsecret
✅ When Bob login with password notthat
✅ Then I am not connected
                                                                         PASSED

📄 Document: login.feature
🥒 Feature: As a user I logged in with my password
🎬 Scenario: I user another login
✅ Given a user Bob with password dumbsecret
✅ Given a user Alice with password anothersecret
✅ When Alice login with password dumbsecret
✅ Then I am not connected
✅ When Bob login with password dumbsecret
✅ Then I am connected with username Bob
                                                                         PASSED

============================== 3 passed in 0.02s ==============================
```


### All Gherkin features are support.

tursu use the gherkin-official package to parse scenario, however,
they must be compiled to pytest tests function, implementation in development.

- ✅ Scenario
- ✅ Scenario Outlines / Examples
- ✅ Background
- ✅ Rule
- ✅ Feature
- ✅ Steps (Given, When, Then, And, But)
- ✅ Tags  (converted as pytest marker)
- ✅ Doc String
- ✅ Datatables
