Touca SDK for Python

Overview

Touca SDK For Python

PyPI License PyPI - Python Version Build Status Documentation Status Code Quality Codecov

Touca helps you understand the true impact of your day to day code changes on the behavior and performance of your overall software, as you write code.

Touca Server

Touca SDKs let you describe the behavior and performance of your code by capturing values of interesting variables and runtime of important functions. We remotely compare your description against a trusted version of your software, visualize all differences, and report them in near real-time.

🧑‍🔧 Install

You can install Touca with pip:

pip install touca

We formally support Python v3.6 and newer on Linux, macOS, and Windows platforms.

👀 Sneak Peak

For a more thorough guide of how to use Touca SDK for Python, check out the examples directory or visit our documentation website at docs.touca.io.

Let us imagine that we want to test a software workflow that reports whether a given number is prime.

def is_prime(number: int):

We can use unit testing in which we hard-code a set of input numbers and list our expected return value for each input. In this example, the input and output of our code under test are a number and a boolean. If we were testing a video compression algorithm, they may have been video files. In that case:

  • Describing the expected output for a given video file would be difficult.
  • When we make changes to our compression algorithm, accurately reflecting those changes in our expected values would be time-consuming.
  • We would need a large number of input video files to gain confidence that our algorithm works correctly.

Touca makes it easier to continuously test workflows of any complexity and with any number of test cases.

import touca
from code_under_test import is_prime

@touca.Workflow
def test_is_prime(testcase: str):
    touca.check("is_prime", is_prime(int(testcase)))

if __name__ == "__main__":
    touca.run()

Touca tests have two main differences compared to typical unit tests:

  • We have fully decoupled our test inputs from our test logic. We refer to these inputs as "test cases". The SDK retrieves the test cases from the command line, or a file, or a remote Touca server and feeds them one by one to our code under test.
  • We have removed the concept of expected values. With Touca, we only describe the actual behavior and performance of our code under test by capturing values of interesting variables and runtime of important functions, anywhere within our code. For each test case, the SDK submits this description to a remote server which compares it against the description for a trusted version of our code. The server visualizes any differences and reports them in near real-time.

We can run Touca tests with any number of inputs from the command line:

python3 test_prime_app.py
  --api-key <TOUCA_API_KEY>
  --api-url <TOUCA_API_URL>
  --revision v1.0
  --testcase 13 17 51

Where TOUCA_API_KEY and TOUCA_API_URL can be obtained from the Touca server at app.touca.io. This command produces the following output:

Touca Test Framework
Suite: is_prime_test
Revision: v1.0

(  1 of 3  ) 13                   (pass, 127 ms)
(  2 of 3  ) 17                   (pass, 123 ms)
(  3 of 3  ) 51                   (pass, 159 ms)

Processed 3 of 3 testcases
Test completed in 565 ms

Features

Touca is very effective in addressing common problems in the following situations:

  • When we need to test our workflow with a large number of inputs.
  • When the output of our workflow is too complex, or too difficult to describe in our unit tests.
  • When interesting information to check for regression is not exposed through the interface of our workflow.

The fundamental design features of Touca that we highlighted earlier can help us test these workflows at any scale.

  • Decoupling our test input from our test logic, can help us manage our long list of inputs without modifying the test logic. Managing that list on a remote server accessible to all members of our team, can help us add notes to each test case, explain why they are needed and track how their performance changes over time.
  • Submitting our test results to a remote server, instead of storing them in files, can help us avoid the mundane tasks of managing and processing of those results. The Touca server retains test results and makes them accessible to all members of the team. It compares test results using their original data types and reports discovered differences in real-time to all interested members of our team. It allows us to audit how our software evolves over time and provides high-level information about our tests.

📖 Documentation

🙋 Ask for Help

We want Touca to work well for you. If you need help, have any questions, or like to provide feedback, send us a note through the Intercom at touca.io or email us at [email protected].

License

This repository is released under the Apache-2.0 License. See LICENSE.

You might also like...
The Python SDK for the Rackspace Cloud

pyrax Python SDK for OpenStack/Rackspace APIs DEPRECATED: Pyrax is no longer being developed or supported. See openstacksdk and the rackspacesdk plugi

:snake: Python SDK to query Scaleway APIs.

Scaleway SDK Python SDK to query Scaleway's APIs. Stable release: Development: Installation The package is available on pip. To install it in a virtua

Skyscanner Python SDK

Skyscanner Python SDK Important As of May 1st, 2020, the project is deprecated and no longer maintained. The latest update in v1.1.5 includes changing

WeChat SDK for Python
WeChat SDK for Python

___ __ _______ ________ ___ ___ ________ _________ ________ ___ ___ |\ \ |\ \|\ ___ \ |\ ____\|\ \|\ \|\ __ \|\___

Python SDK for the Buycoins API.

This library provides easy access to the Buycoins API using the Python programming language. It provides all the feature of the API so that you don't need to interact with the API directly. This library can be used with Python 3.6+

Graviti TensorBay Python SDK

TensorBay Python SDK is a python library to access TensorBay and manage your datasets. It provides: A pythonic way to access your

A Python script for rendering glTF files with V-Ray App SDK
A Python script for rendering glTF files with V-Ray App SDK

V-Ray glTF viewer Overview The V-Ray glTF viewer is a set of Python scripts for the V-Ray App SDK that allow the parsing and rendering of glTF (.gltf

qualysclient - a python SDK for interacting with the Qualys API

qualysclient - a python SDK for interacting with the Qualys API

A Python SDK for connecting devices to Microsoft Azure IoT services
A Python SDK for connecting devices to Microsoft Azure IoT services

V2 - We are now GA! This repository contains code for the Azure IoT SDKs for Python. This enables python developers to easily create IoT device soluti

Releases(v1.5.2)
Owner
Touca
See side effects of your changes, as you write code.
Touca
This is a script to export logs from AWS CloudTrail to a local file.

cloudtrail-export-logs This is a script to export logs from AWS CloudTrail to a local file. Getting Started Prerequisites python 3 boto3 pip Installin

Claick Assunção de Oliveira 2 Jan 02, 2022
WikipediaBot from mohirdev.uz

wiki-bot WikipediaBot from mohirdev.uz Requirements wikipedia aiogram Installing wiki/aiogram pip install wikipedia pip install aiogram

Muhammad Ali 5 Sep 28, 2022
A Telegram Bot written in Python for mirroring files on the Internet to your Google Drive or Telegram

Original Repo mirror-leech-telegram-bot This is a Telegram Bot written in Python for mirroring files on the Internet to your Google Drive or Telegram.

0 Jan 03, 2022
Trading Strategies (~50%) developed by GreenT on QuantConnect platform over the autumn quarter

Trading Strategies ~50% of codes from the Applied Financial Technology Course. Contributors: Claire W. Derrick T. Frank L. Utkarsh T. Course Leads: Dy

Utkarsh 2 Feb 07, 2022
A simple way to create a request to the coinpayment API with a valid HMAC using your private key and command

Coinpayments Verify TXID Created for Astral Discord bot A simple way to create a request to the coinpayment API with a valid HMAC using your private k

HellSec 1 Nov 07, 2022
Music cog for discord bots. Supports YouTube, YoutubeMusic, SoundCloud and Spotify.

dismusic Music cog for discord bots. Supports YouTube, YoutubeMusic, SoundCloud and Spotify. Installation python3 -m pip install dismusic Usage from d

Md Shahriyar Alam 59 Jan 08, 2023
A simple python discord bot with commands for moderation and utility.

Discord Bot A simple python discord bot with commands for moderation, utility and fun. Moderation $kick user reason - Kick a user from the server

3 Jan 07, 2022
🎄 JustaGrabber - A discord token grabber written in python3

🎄 JustaGrabber - A discord token grabber written in python3 🎇 Made by kldiscord https://github.com/kldiscord 🌟 Please leave a star if you liked Jus

1 Dec 19, 2022
Nautobot-custom-jobs - Custom jobs for Nautobot

nautobot-custom-jobs This repo contains custom jobs for Nautobot. Installation P

Dan Peachey 9 Oct 27, 2022
Discord Account Generator that will create Account with hCaptcha bypass. Using socks4 proxies

Account-Generator [!] This was made for education. Please use socks4 proxies for nice experiences. [!] Please install these modules - "pip3 install ht

RyanzSantos 10 Feb 23, 2022
Backend.AI Client Library for Python

Backend.AI Client The official API client library for Backend.AI Usage (KeyPair mode) You should set the access key and secret key as environment vari

Lablup 10 Feb 10, 2022
API generated by OpenAPI for nhentai.net

nhentai-api No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) This Python package is automati

Shikanime Deva 1 Nov 01, 2021
This Server Cloner can clone the server you want with all the perms of roles in every particular channel.

Server-Cloner-with-perms 🚀 This Server Cloner can clone the server you want with all the perms of roles in every particular channel. Features Clone C

Gripz 0 Feb 17, 2022
Isobot is originally made by notsniped. This is a remix of iso.bot by archisha.

iso6.9-08122021b-1.2beta Isobot is originally made by notsniped#0002. This is a remix of iso.bot by αrchιshα#5518. isobot6.9 is a Discord bot written

Kamilla Youver 3 Jan 11, 2022
🤖 Automated follow/unfollow bot for GitHub. Uses GitHub API. Written in python.

GitHub Follow Bot Table of Contents Disclaimer How to Use Install requirements Authenticate Get a GitHub Personal Access Token Add your GitHub usernam

João Correia 37 Dec 27, 2022
Currency Merger is a simple tool for joining values in different currencies

Currency Merger Description Currency Merger is a simple tool for joining values in different currencies. For example, if I have money in USD, EUR, BRL

Arthur Diniz 1 Feb 08, 2022
Finds Jobs on LinkedIn using web-scraping

Find Jobs on LinkedIn 📔 This program finds jobs by scraping on LinkedIn 👨‍💻 Relies on User Input. Accepts: Country, City, State 📑 Data about jobs

Matt 44 Dec 27, 2022
Telegram bot for stream music or video on telegram

KYURA MUSIC Telegram bot for stream music or video on telegram, powered by PyTgCalls and Pyrogram Help Need Help me to translate this repo, click the

0 Dec 08, 2022
telegram bot that calculates file hash / Dosya toplamı hesaplayan telegram botu

Telegram File Hash Bot FileHashBot: 🇬🇧 Bot that calculates file hashes. 🇹🇷 Dosya toplamları hesaplayan bot. Demo in Telegram: @FileHashBot 🇬🇧 Se

Hüzünlü Artemis [HuzunluArtemis] 5 Jun 29, 2022
Der Dischkort Bot für Andiismus

AndreOS Der Dischkort Bot für Andiismus Wichtigger Bot für den hauseigenen Discord-Server Indoktrinationsmechanismusleitungsprogramm der andiistischen

Leon Bartle 3 Jan 13, 2022