The Tauk Python Package allows you to easily report and monitor your Appium and Selenium automation tests on the Tauk platform.

Installation

The Tauk Python Package is hosted on the Python Package Index (PyPI) and you can install it via pip:

$ pip install tauk

Usage

Import the Tauk and TaukConfig classes from the package in your test suite.

from tauk.tauk_webdriver import Tauk
from tauk.config import TaukConfig

Initialize Tauk with your driver, API TOKEN, and PROJECT ID.

You only have to initialize the Tauk class once for the entire execution. You can retrieve your API TOKEN and PROJECT ID from the Tauk Web UI. Your tokens can be generated and retrieved from the User Settings > API Access section. Each of your project cards will have their associated Project ID's in the # section.

Tauk(TaukConfig(api_token="API-TOKEN", project_id="PROJECT-ID"))

Additionally, if you are running tests in parallel and each test runs in a different process, you should include the multi_process_run=True flag when initializing Tauk so that it can tie multiple processes with the same execution.

Tauk(TaukConfig(api_token="API-TOKEN", project_id="PROJECT-ID", multiprocess_run=True))

Alternatively, you can also pass these argument inputs through environment variables instead of through the TaukConfig class. In your local environment, you can set the following variables:

TAUK_API_TOKEN=YOUR-API-TOKEN
TAUK_PROJECT_ID=YOUR-PROJECT-ID

# If you have a multiprocess run
TAUK_MULTI_PROCESS=true

# Useful if you running multiple instances of you project. 
# Tauk will automatically use the process ID to create the execution context, 
# but you can override this behavior and provide an explicit execution dir if needed
TAUK_EXEC_DIR=/tmp/tauk/smoke_runs

If you're passing these inputs through environment variables, you conveniently don't need to explicitly initialize the Tauk class in your code. Instead, the Tauk class will check your environment variables on invocation. In other words, if you have the inputs as environment variables you can just import Tauk.

Decorate your individual test case methods with @Tauk.observe.

Add the @Tauk.observe decorator above the test case methods you want Tauk to watch. For example:

@Tauk.observe(custom_test_name='Add New Contact', excluded=False)
def test_Contacts_AddNewContact(self):
	print("Clicking on the [Add] Button")
	self.wait.until(expected_conditions.presence_of_element_located(
		(MobileBy.ID, "com.android.contacts:id/floating_action_button"))
	).click()