ploosh.
Documentation
PostgreSQL exporter
The PostgreSQL exporter writes test case results into a PostgreSQL database table instead of a file. It reuses the PostgreSQL connector to connect and run the queries.
The exporter automatically creates the destination table if it does not exist, then inserts one row per test case.
Connection configuration
The exporter connects through a dedicated export connection declared in the connections file. The type of this connection must match the exporter name (postgresql).
The connection accepts the same parameters as the PostgreSQL connector.
connections:
export:
type: postgresql
hostname: my-server.postgres.database.azure.com
database: my_database
username: my_user
password: $var.postgresql_password
port: 5432
ssl_context: false
Destination table
The exporter writes results to a table named ploosh_results. The table is created automatically with the following schema:
| Column | Description |
|---|---|
executionid | Unique identifier for the test run |
name | Test case name |
state | Result: passed, failed, error, notExecuted |
sourcestart | Source data loading start time |
sourceend | Source data loading end time |
sourceduration | Source loading duration in seconds |
sourcecount | Number of rows in source dataset |
sourceexecutedaction | Query or path executed for source |
expectedstart | Expected data loading start time |
expectedend | Expected data loading end time |
expectedduration | Expected loading duration in seconds |
expectedcount | Number of rows in expected dataset |
expectedexecutedaction | Query or path executed for expected |
comparestart | Comparison start time |
compareend | Comparison end time |
compareduration | Comparison duration in seconds |
success_rate | Percentage of matching rows (0.0 to 1.0) |
Usage
Command line
ploosh --connections connections.yml --cases testcases --export POSTGRESQL --ppostgresqlpassword "yourpassword"
Python API
from ploosh import execute_casesexecute_cases(
cases="test_cases",
connections="connections.yml",
export="POSTGRESQL",
variables={"postgresqlpassword": "yourpassword"}
)
Requirements
- PostgreSQL optional dependency installed (
pip install ploosh[postgresql]orpip install pg8000) - A
exportconnection of typepostgresqldeclared in the connections file - Network access to the PostgreSQL database server