Skip to main content

Awesome universal-test-tool to make tests configurable with a yaml file.

Project description

universal-test-tool

codecov CI

Awesome universal-test-tool to make tests configurable with a yaml file.

Install the repository

pip install universal-test-tool

Run the tests

test-tool

# This programm is a tool for running tests.

# options:
#   -h, --help            show this help message and exit
#   -p PROJECT, --project PROJECT
#                         The path to the project.
#   -ca CALLS, --calls CALLS
#                         The filename of the calls configuration.
#   -d DATA, --data DATA  The filename of the data configuration.
#   -X, --debug           Activate debugging.

Calls File

Per default a file calls.yaml is searched in the project folder, which is by default the current working directory.

It is a list where every entry is one step to test.

The tests are done in the following available plugins:

  • Bash Cmd (test_tool_bash_cmd_plugin)
  • Copy Files SSH (test_tool_copy_files_ssh_plugin)
  • JDBC SQL (test_tool_jdbc_sql_plugin)
  • Rest (test_tool_rest_plugin)
  • SSH Cmd (test_tool_ssh_cmd_plugin)

Bash Cmd (test_tool_bash_cmd_plugin)

Runs a command on the local machine.

Call:
- type: BASH_CMD
    call:
        cmd: None
        timeout: None
        save: None

Object for save:

save:
    name: None
    type: None
Parameters:
Parameter Default Description
cmd None The command to run.
timeout None The timeout for the command.
save None Save the result to value.

Parameters for save:

Parameter Default Description
name None The name for the variable to save the result in.
type None The type for how to treat the result (STRING, JSON).

Copy Files SSH (test_tool_copy_files_ssh_plugin)

Copies files and folders between local machine and remote machine via ssh.

Call:
- type: COPY_FILES_SSH
    call:
        user: ${REMOTE_CMD_USER}
        password: ${REMOTE_CMD_PASSWORD}
        host: ${REMOTE_CMD_HOST}
        local_path: None
        remote_path: None
        download: False
Parameters:
Parameter Default Description
user ${REMOTE_CMD_USER} The user for the ssh connection.
password ${REMOTE_CMD_PASSWORD} The password for the ssh connection.
host ${REMOTE_CMD_HOST} The host for the ssh connection.
local_path None The local file or folder for the transfer.
remote_path None The remote file or folder for the transfer.
download False If this flag is set to true, the file transfer is a download, otherwise it is an upload.

JDBC SQL (test_tool_jdbc_sql_plugin)

Runs SQL Statements with JayDeBeApi.

Call:
- type: JDBC_SQL
    call:
    query: None,
    save: [],
    validate: [],
    driver: ${DB_DRIVER},
    driver_path: ${DB_DRIVER_PATH},
    url: ${DB_URL},
    username: ${DB_USERNAME},
    password: ${DB_PASSWORD}

Object for save:

save:
    raw: None
    column: None
    name: None

Object for validate:

save:
    raw: None
    column: None
    value: None
Parameters:
Parameter Default Description
query None The SQL statement to run
save [] Save a entry of a cell to a variable
vaidate [] Validate the entry of a cell
driver ${DB_DRIVER} The Class of the driver
driver_path ${DB_DRIVER_PATH} The Path of the jar file
url ${DB_URL} The jdbc connection string
username ${DB_USERNAME} The username of the db
password ${DB_PASSWORD} The password of the db

Rest (test_tool_rest_plugin)

Tests REST endpoints.

Call:
- type: REST
    call:
        base_url: ${REST_BASE_URL}
        path: ${REST_PATH}
        url: None
        method: GET
        data: None
        files: None
        payload: None
        headers: {}
        response_type: JSON
        assertion: None
        hide_logs: False
        status_codes: [200]
Parameters:
Parameter Default Description
base_url ${REST_BASE_URL} The base url of the service to test.
path ${REST_PATH} The path of the endpoint to test.
url None The url value is built dynamically from ${base_url}/${path} if not set. Otherwiese the oder values are ignored.
method GET The method of the call. (GET, POST, DELETE, PUT)
data None The data of the http call, an object is used as json.
files None Path of files to send.
payload None Payload for multipart request.
header {} Headers to use for request.
response_type JSON How to pasrse the response. (JSON, XML, TEXT)
assertion NONE The assertion how the response should look like
hide_log False Don't print the reply in the logs.
status_codes [200] The status codes to accept.

SSH Cmd (test_tool_ssh_cmd_plugin)

Runs a command on a remote machine via ssh.

Call:
- type: SSH_CMD
    call:
        user: ${REMOTE_CMD_USER}
        password: ${REMOTE_CMD_PASSWORD}
        host: ${REMOTE_CMD_HOST}
        cmd: None
Parameters:
Parameter Default Description
user ${REMOTE_CMD_USER} The user for the ssh connection.
password ${REMOTE_CMD_PASSWORD} The password for the ssh connection.
host ${REMOTE_CMD_HOST} The host for the ssh connection.
cmd None The command to run.

Other available plugins:

This project can handle other plugins as well. There just need to be a installed module with the name test_tool_example_name_plugin with the following methods.

# The default values of the plugin
default_example_name_call: dict,

# Change the values before the tests are run
augment_example_name_call: FunctionType

# Make the call
make_example_name_call: FunctionType

In case of an error, there should be thrown an AssertionError

The test type is then EXAMPLE_NAME

Development

Read the CONTRIBUTING.md file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

universal-test-tool-0.1.1.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

universal_test_tool-0.1.1-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

Details for the file universal-test-tool-0.1.1.tar.gz.

File metadata

  • Download URL: universal-test-tool-0.1.1.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for universal-test-tool-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b70348c44d341da17944032124ceba3467a743f8e277ad8da5cdb32db8957b64
MD5 8b55c558e3608abc3786e8ae341496a6
BLAKE2b-256 e99ff36422369d31ce2a2b3d5ff3fd94ff222b9852a1d6f1cdbe4939a2ec506d

See more details on using hashes here.

Provenance

File details

Details for the file universal_test_tool-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for universal_test_tool-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7f5dc90851fdc90bd03ae60433b3452abf74b25bb66a917d73bce446e694b55a
MD5 ce1399702ffe87556cc21f2bec442ce6
BLAKE2b-256 93490c1b5fe6e4612ef3bd432b65c447d9eb610794513d9895ee4be8cf3c72e4

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page