https://github.com/douglasdcm/guara
Python implementation of the Page Transactions pattern for UI test automation.
https://github.com/douglasdcm/guara
patterns python test-automation ui-testing
Last synced: 2 months ago
JSON representation
Python implementation of the Page Transactions pattern for UI test automation.
- Host: GitHub
- URL: https://github.com/douglasdcm/guara
- Owner: douglasdcm
- License: mit
- Created: 2024-12-29T20:12:15.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-11-22T03:27:58.000Z (7 months ago)
- Last Synced: 2026-02-14T03:03:07.386Z (4 months ago)
- Topics: patterns, python, test-automation, ui-testing
- Language: Python
- Homepage: https://pypi.org/project/guara/
- Size: 1.81 MB
- Stars: 80
- Watchers: 7
- Forks: 12
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Contributing: docs/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: docs/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Guará
[](https://pepy.tech/projects/guara)
Guará is a Python framework for **business logic expression**.
It allows you to write production code and tests as **executable domain language**, combining:
* Business Logic Language → expresses domain behavior using Ubiquitous Language (DDD)
* Test Framework → orchestrates scenarios using Given / When / Then
Instead of focusing only on technical assertions, Guará enables you to describe **business scenarios as code**, making production code and tests readable by developers and domain experts.
## Core Idea
Guará turns code into **business narratives**:
* **Transactions** → represent actions (use cases)
* **Assertions (`it`)** → represent business expectations
* **Application DSL** → orchestrates flows in domain language
## Syntax
```python
Application.when(DoSomething [,with_parameter=value, ...]).expects(it.Matches, a_condition)
```
## Example in Action
### Modeling
```python
from guara.transaction import Application
from guara import it
from transactions import HasBalance, BuyAsset, UpdatePortfolio
def main():
finance_app = Application()
(
finance_app
.given(HasBalance)
.when(BuyAsset, symbol="AAPL", amount=2000)
.and_(UpdatePortfolio).expects(it.IsEqualTo, 20)
)
```
### UI Testing
```python
from guara.transaction import Application
from guara import it
from selenium import webdriver
from transactions import OpenApp, ChangeToPortuguese, NavigateToInfoPage, CloseApp
def test_sample_web_page():
app = Application(webdriver.Chrome())
app.given(OpenApp, url="https://anyhost.com/")
app.when(ChangeToPortuguese).expects(it.IsEqualTo, CONTENT_IN_PORTUGUESE)
app.when(NavigateToInfoPage).then(it.Contains, "This project was born")
app.execute(CloseApp)
```
## Documentation
For more information, check:
[https://guara.readthedocs.io/en/latest/](https://guara.readthedocs.io/en/latest/)