Manually Install the Python Automation Library

CukeTest not only supports developing and executing automated tests within its built-in Python environment, but also provides the ability to install its automation library into an external Python environment. This allows you to leverage the features of CukeTest in your own familiar development setup.
The following tutorial will guide you through a few simple steps to install the CukeTest automation library into your Python environment (using Python 3.8 as an example).

Prerequisites

Before starting the installation, make sure that Python 3.8 is installed on your system.
You can check the current version of Python by running the following commands in your command line or terminal:

python --version
# or
python3 --version

Choose the appropriate command depending on your system configuration.

Installation Steps

  1. Open the command line tool or terminal:

    • Windows users: Search for and open "Command Prompt" or "PowerShell".
    • macOS / Linux users: Open the system's built-in "Terminal".
  2. Navigate to the automation library directory:

    Use the cd command to navigate to the directory where the CukeTest automation library whl files are located.
    This directory contains library files for different Python versions. Default paths on various systems are as follows:

    • Windows:

      cd "C:\Program Files\LeanPro\CukeTest\pyapi\dist\"
      
    • Linux:

      cd /usr/lib/cuketest/pyapi/dist/
      
    • macOS:

      cd /Applications/CukeTest.app/Contents/pyapi/dist/
      
  3. Run the install or upgrade command:

    In the current directory, run the following pip command to install or upgrade the leanproAuto library:

     pip install --upgrade leanproAuto --no-index --find-links=./
    

    Explanation of this command:

    • --upgrade (or -U): If the leanproAuto library is already installed, it attempts to update it to the latest version available in the dist directory; if not installed, it performs a fresh installation.
    • --no-index: Prevents querying PyPI (Python Package Index) or other online repositories, ensuring that only local files are used.
    • --find-links=./: Restricts the search for the leanproAuto package to the current directory (./).

    • If you have previously installed the library but need to reinstall or downgrade to a specific version, you can use the --force-reinstall flag:

      pip install --force-reinstall leanproAuto --no-index --find-links=./
      

Verify Installation

After installation, you can verify whether the leanproAuto library has been successfully installed by running:

pip show leanproAuto

If installed successfully, the output will display information similar to the following (version and path may vary depending on your environment):

Name: leanproAuto
Version: 1.8.10.3
Summary: API to automate desktop
Home-page: https://www.cuketest.com/
Author: LeanPro Corporation
Location: /path/to/your/python/site-packages

Getting Started

Once the CukeTest automation library is installed, you can import and use it in your Python scripts.
The following is an example of performing keyboard operations using the CukeTest library:

Python
from leanproAuto import WinAuto, QtAuto, Keyboard, Mouse, Util, Screen, Image, RunSettings, CukeTest

# Simulate pressing Ctrl+A (Select All)
Keyboard.keyDown("control")
Keyboard.keyTap("a")
Keyboard.keyUp("control")
By following the above steps, you have successfully integrated the CukeTest automation library into your local Python environment, enabling you to leverage its powerful capabilities across various testing scenarios.