CLI Guide¶
This section describes the available commands for the Optics Framework CLI. The command you run is optics; the package you install is optics-framework (e.g. pip install optics-framework).
Setup Optics Framework¶
To set up the Optics Framework, use the following command:
To list all possible drivers:
TUI way:
CLI way:
Executing Test Cases¶
Run test cases from a project folder. The runner discovers test cases (and modules, elements, config) from that folder:
Options:
<folder_path>: Path to the project directory (containstest_cases.csv,test_modules.csv,config.yaml, etc.).--runner <runner_name>: Test runner to use. Supported:test_runner(default),pytest.--use-printer(default): Enable live result printer.--no-use-printer: Disable live result printer.
Initializing a New Project¶
Use the following command to initialize a new project:
Options:
--name <project_name>: Name of the project (required).--path <directory>: Directory to create the project in (default: current directory).--template <sample_name>: Copy files from a predefined sample. See Templates below.--force: Overwrite an existing project directory if it exists.--git-init: Initialize a Git repository in the project.
Templates¶
Use --template <name> to copy a sample layout and assets from optics_framework/samples/. Available template names include:
contact— Contact/sample layoutclock— Clock app sampleyoutube— YouTube samplegmail_web— Gmail web samplecalendar— Calendar sample
Exact values depend on the directories under optics_framework/samples/. Use only names that exist as subdirectories there.
Generating Code¶
Generate test automation code from a project's test data (test cases, modules, config):
Options:
<project_path>: Path to the project folder (containing test case and module data).--output <path>: Output file path. Defaults totest_generated.py(pytest) ortest_generated.robot(robot).--framework:pytest(default) orrobot.
Listing Available Keywords¶
Display all available keywords and their parameters:
Executing Dry Run¶
Validate test cases without executing actions (keyword and parameter checks):
Options:
<folder_path>: Path to the project directory.--runner <runner_name>: Test runner to use (default:test_runner).--use-printer(default): Enable live result printer.--no-use-printer: Disable live result printer.
Serving the REST API¶
Start the REST API server (e.g. for programmatic or remote use):
Options:
--host: Host to bind (default:127.0.0.1).--port: Port to bind (default:8000).--workers: Number of worker processes (default:1).
For endpoint details, request/response formats, and examples, see REST API Usage.
Shell autocompletion¶
Enable shell autocompletion for the optics command:
This updates your shell RC (e.g. .bashrc, .zshrc) so that commands and arguments are completed when you press Tab.
Showing Help Information¶
Get help for the CLI:
Managing Configuration¶
Manage framework configuration:
Options:
--set <key> <value>: Set a configuration key-value pair.--reset: Reset all configurations to default.--list: Display current configuration values.
Checking Version¶
Check the installed version:
Additional Information¶
Command name
The CLI command is optics. The PyPI package is optics-framework. Install with pip install optics-framework; then run optics in your terminal.
Optional parameters
Options such as --runner, --force, and --git-init are optional. Omit them to use defaults (e.g. test_runner for --runner).
Driver installation
When using optics setup --install, use driver names listed by optics setup --list.
Configuration persistence
Configuration changed with optics config --set persists until you run optics config --reset.