CAFEX
CAFEX is a Python package that provides tools and utilities for UI, API and DB testing. It is part of the CAFE (Core Automation Framework Enhancements) monorepo.
Features
CAFEX offers four packages:
- cafex-ui
- cafex-api
- cafex-db
- cafex-core
CAFEX-UI Package
- Driver management: Supports various web browsers (Chrome, Firefox, Edge, etc.) and mobile platforms (iOS, Android).
- Element interaction: Provides methods to interact with web elements and mobile app elements, such as clicking, typing, and retrieving text.
- Assertions: Includes assertion methods specifically designed for UI testing, allowing for efficient validation of UI elements and behaviors.
- Data-driven testing: Supports data-driven testing approaches to execute tests with different data sets.
- Reporting: Integrates with CAFE's reporting capabilities to generate comprehensive test reports with screenshots and detailed logs.
CAFEX-API Package
- Request building: Simplifies the creation of API requests with various methods and parameters.
- Response parsing: Provides methods to parse JSON and XML responses and extract relevant data.
- Assertions: Includes assertion methods specifically designed for API testing, allowing for efficient validation of response data.
- Data-driven testing: Supports data-driven testing approaches to execute tests with different data sets.
- Reporting: Integrates with CAFE's reporting capabilities to generate comprehensive test reports.
CAFEX-DB Package
- Database connection: Supports connections to various databases, including MSSQL, MySQL, Oracle, Hive, Postgres, and Cassandra.
- Query execution: Provides methods to execute SQL queries and retrieve data.
- Result set comparison: Offers methods to compare result sets, allowing for efficient validation of database data.
- Data-driven testing: Supports data-driven testing approaches to execute tests with different data sets.
- Reporting: Integrates with CAFE's reporting capabilities to generate comprehensive test reports.
CAFEX-CORE Package
- Reduce code duplication: By providing reusable components and utilities, CAFEX-CORE minimizes the need for repetitive code across test scripts.
- Improve maintainability: The modular design and clear structure of CAFEX-CORE make test scripts easier to understand and maintain.
- Enhance efficiency: CAFEX-CORE offers various features and functionalities that accelerate test development and execution.
- Promote collaboration: The framework facilitates collaboration among team members by providing a standardized approach to automation.
Getting Started
Prerequisites
- Python 3.12 or later
- pip (Python package manager)
Installation
-
Install CAFEX using pip:
pip install cafex
CAFE-UI Usage
CAFE-UI provides a set of intuitive methods and classes to facilitate UI testing. Here's a basic example for web UI testing:
from cafex_ui.web_client import web_client_actions
# Create a web client actions object
web_actions = web_client_actions.WebClientActions()
# Navigate to a website
web_actions.navigate("https://www.example.com")
# Find an element and click on it
element = web_actions.get_web_element("xpath=//button[text()='Submit']")
web_actions.click(element)
# Validate the page title
assert web_actions.get_title() == "Success Page"
CAFE-API Usage
CAFE-API provides a set of intuitive methods and classes to facilitate API testing. Here's a basic example:
from cafex_api import request_builder
from cafex_core.parsers import json_parser
# Build an API request
request = request_builder.RequestBuilder().get(url="https://api.example.com/users")
# Send the request and get the response
response = request.send()
# Parse the JSON response
parsed_response = json_parser.ParseJsonData().get_dict(response.text)
# Validate the response data
assert parsed_response["status"] == "success"
CAFE-DB Usage
CAFE-DB provides a set of intuitive methods and classes to facilitate database testing. Here's a basic example:
from cafex_db import database_handler
# Create a database connection
db_handler = database_handler.DatabaseHandler()
connection = db_handler.create_db_connection(db_type="mssql", server="dbserver", database="testdb")
# Execute a query
result_set = db_handler.execute_statement(connection, "SELECT * FROM users")
# Convert the result set to a list
result_list = db_handler.resultset_to_list(result_set)
# Validate the data
assert result_list[0][1] == "John Doe"
Metadata
Release files for cafex 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cafex-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cafex-1.0.0-py3-none-any.whl |
Release files / cafex-1.0.0-py3-none-any.whl
| Download URL | cafex-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca9d82879a8cf5596a836d1d3c407390d6f82338c3d9b1e2f7fb074fba051514
|
|
BLAKE2b-256 checksum How to use checksums |
d2c4d0b83ee1b2e64a0b796da9246191c2d05d54b1ceb942b2334735a437d450
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.10
|
Security for cafex 1.0.0
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.