Working with the Python harness

How to implement TestArchitect actions using the Python programming language.

This subsection contains two exercises that demonstrate how to create user-scripted actions implemented in the Python programming language, and how to access such actions in your tests.

Supported OS environments

  • Windows
  • Linux
  • macOS

Installing a Python interpreter

TestArchitect installation does not include a Python interpreter, which is a requirement for running Python scripts.
  • Linux: Linux machines come with Python 2.x pre-installed.
  • Windows: Windows does not, by default, include a Python interpreter. You may, however, easily obtain a free interpreter from the Python Releases for Windows page of python.org.
  • macOS: Python 2.x is packaged into macOS by Apple. However, please note the following:
    • For versions of macOS starting with 10.11 (El Capitan), Apple has enhanced System Integrity Protection (SIP). Consequently, the pre-installed Python interpreter can not be used to execute the TestArchitect Python harness. Instead, we recommend that you highly recommended that you download and install the correct macOS Python harness from python.org.
    • After installing your own Python, the framework /Library/Frameworks/Python.framework/Versions/2.x/bin includes the Python executable and libraries.
In addition, please observe the following when installing an interpreter:
  • Use a Python interpreter that is no older than 2.x. (TestArchitect has a set of import files that expose the automation library objects and functions to the interpreter. These files assume a Python version of 2.x.).
  • Both TestArchitect and the Python interpreter must be for the same machine architecture (32-bit or 64-bit).

Before proceeding...

Please ensure that you have Python installed before proceeding with the following examples. In addition, your system’s PATH variable must be set to include the path to the Python executable: for example, C:\python27.