Skip to content

swittest cli

swittest-cli is a CLI tool to run EMV L2 / L3 test suites in interactive or autonomous modes.

Installation

Note

swittest-cli is currently only availble as a Python package

To install swittest-cli on your machine, checkout the corresponding GitHub repos or download the pre-built binaries.

git clone git@github.com:switstack/swittest-cli-py.git

Usage

swittest-cli is a Typer based application that lets you call different commands organized in categories.

The following categories are available:

  • settings: To load, clear or show your setup settings.
  • suites: To list, show or select a test suite.
  • tests: To list, show or run a (set of) test(s).

Basics

To run the tools, simply call swittest-cli in the terminal of your choice.

# If no command is provided an error message will be displayed.swittest-cli
Usage: swittest-cli [OPTIONS] COMMAND [ARGS]...

Try 'swittest-cli --help' for help.

╭─ Error ──────────────────────────────────────────────────────────────╮
│ Missing command. │
╰──────────────────────────────────────────────────────────────────────╯

# If you need to see the available commands, run `swittest-cli --help`.swittest-cli --help
Usage: swittest-cli [OPTIONS] COMMAND [ARGS]...

╭─ Options ────────────────────────────────────────────────────────────╮
│ --install-completion Install completion for the current │
│ shell. │
│ --show-completion Show completion for the current shell, │
│ to copy it or customize the │
│ installation. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────╮
│ settings Settings commands │
│ suites Test suites commands │
│ tests Tests commands │
╰──────────────────────────────────────────────────────────────────────╯

Verbose mode

By defaul the tool woks in quiet mode. If you want to see additional inputs, append the -v option to the command.

Note

The verbose mode works with the show and run commands.

Settings

swittest-cli needs a bit of configuration before it can run properly. In perticular:

  • Information about the target (terminal under tests).
  • Access details to switcloud service.
  • Access details to the test suites (either local or remote).

This configuration must be made through environment variables, described below:

ST_SWITCLOUD_URL=
ST_ORG_ADMIN_EMAIL=
ST_ORG_ADMIN_PASSWORD=
ST_USER_MACHINE_CLIENT_ID=
ST_USER_MACHINE_CLIENT_SECRET=
ST_TARGET_URL=
ST_POI_ID=
ST_LOCAL_STORAGE=
ST_LOCAL_STORAGE_BASE_DIR=
ST_AWS_ACCESS_KEY_ID=
ST_AWS_SECRET_ACCESS_KEY=
ST_AWS_REGION_NAME=
ST_AWS_BUCKET_NAME=
ST_AWS_LOCATION=

With:

  • ST_SWITCLOUD_URL= switcloud service URL
  • ST_ORG_ADMIN_EMAIL= switcloud service organization admin email
  • ST_ORG_ADMIN_PASSWORD= switcloud service organization admin password
  • ST_USER_MACHINE_CLIENT_ID= switcloud service terminal client id
  • ST_USER_MACHINE_CLIENT_SECRET = switcloud service terminal client secret
  • ST_TARGET_URL= Test terminal info
  • ST_POI_ID= Terminal POI ID
  • ST_LOCAL_STORAGE= Use local storage for test suites

If ST_LOCAL_STORAGE is set to true:

  • ST_LOCAL_STORAGE_BASE_DIR= Path to test suites

If ST_LOCAL_STORAGE is set to false:

  • ST_AWS_ACCESS_KEY_ID= Remote test suites storage key ID
  • ST_AWS_SECRET_ACCESS_KEY= Remote test suites storage access key
  • ST_AWS_REGION_NAME= Remote test suites storage region
  • ST_AWS_BUCKET_NAME= Remote test suites storage name
  • ST_AWS_LOCATION= Remote test suites storage directory

Suites

Test suites can be manipulated with the suites command. To see the list of sub-commands, type swittest-cli suites --help.

swittest-cli suites --help
Usage: swittest-cli suites [OPTIONS] COMMAND [ARGS]...

Test suites commands

╭─ Options ────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────╮
│ current Show current test suite │
│ list List test suites │
│ run Run all tests or a selection of tests │
│ select Select current test suite │
│ show Show test suite │
╰──────────────────────────────────────────────────────────────────────╯

To list the available test suites, use the list sub-command.

swittest-cli suite list
╭─ Suites ─────────────────────────────────────────────────────────────╮
│ │
│ Test suites in AWS bucket S3 swittest-testswit-bucket/assets │
│ ├── 0 - L2-Mastercard-v3.1.4-v1.0.1-dec_2021 │
│ └── 1 - L2-Mastercard-v3.1.4-v1.0.2-dec_2022 │
│ │
╰──────────────────────────────────────────────────────────────────────╯

To show the description of a test suite, use the show sub-command. By default, only the environment section will be displayed. Adding -v to the command will display extra information.

swittest-cli suites show 0 -v
╭─ Suite ──────────────────────────────────────────────────────────────╮
│ │
│ Test suite 'MCL v3.1.4 TAL2-Testing Env Dec2021' informations │
│ ├── name: MCL v3.1.4 TAL2-Testing Env Dec2021 │
│ ├── version: 0.2.0 │
│ ├── environment: │
│ │ ├── type: L2 │
│ │ ├── scheme: Mastercard │
│ │ ├── spec_version: v3.1.4 │
│ │ ├── test_plan_version: v1.0.1 │
│ │ └── test_env: Dec 2021 │
│ └── tests: │
│ ├── 3B02-0001_first-trx-5-mutualappls │
│ ├── 3B02-0002_first-trx-4-mutualappls │
│ ├── 3B02-0003_first-trx-4-mutualappls │
│ ├── 3B02-0004_first-trx-4-mutualappls │
│ ├── 3B02-0005_first-trx-4-mutualappls │
│ ├── 3B02-0006_first-trx-4-mutualappls │
│ ├── 3B02-0007_first-trx-4-mutualappls │
│ └── 3B02-0008_first-trx-4-mutualappls │
│ │
╰──────────────────────────────────────────────────────────────────────╯

Finally, to select a test suite and start reunning tests, use the select sub-command with the desired test suite ID or name.

swittest-cli suites select 0
L2-Mastercard-v3.1.4-v1.0.1-dec_2021 selected

Tests

Test can be manipulated with the tests command. To see the list of sub-commands, type swittest-cli tests --help.

swittest-cli tests --help
Usage: swittest-cli tests [OPTIONS] COMMAND [ARGS]...

Tests commands

╭─ Options ────────────────────────────────────────────────────────────╮
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────╮
│ list List tests of the current test suite │
│ run Run all tests or a selection of tests │
│ show Show test of the current test suite │
╰──────────────────────────────────────────────────────────────────────╯

To list the available tests, use the list sub-command.

swittest-cli tests list
╭─ Tests ──────────────────────────────────────────────────────────────╮
│ │
│ Current test suite's tests │
│ ├── 0 - 3B02-0001_first-trx-5-mutualappls │
│ ├── 1 - 3B02-0002_first-trx-4-mutualappls │
│ ├── 2 - 3B02-0002_first-trx-4-mutualappls │
│ ├── 3 - 3B02-0002_first-trx-4-mutualappls │
│ ├── 4 - 3B02-0002_first-trx-4-mutualappls │
│ ├── 5 - 3B02-0002_first-trx-4-mutualappls │
│ ├── 6 - 3B02-0002_first-trx-4-mutualappls │
│ └── 7 - 3B02-0002_first-trx-4-mutualappls │
│ │
╰──────────────────────────────────────────────────────────────────────╯

To show the description of a test, use the show sub-command. By default, only the description section will be displayed. Adding -v to the command will display extra information.

swittest-cli tests show 0 -v
╭─ Test ───────────────────────────────────────────────────────────────╮
│ │
│ Test '3B02-0001_first-trx-5-mutualappls' informations │
│ ├── name: 3B02-0001_first-trx-5-mutualappls │
│ ├── version: 0.2.0 │
│ ├── environment: │
│ │ ├── type: L2 │
│ │ ├── scheme: Mastercard │
│ │ ├── spec_version: v3.1.4 │
│ │ ├── test_plan_version: v1.0.1 │
│ │ └── test_env: Dec 2021 │
│ ├── poi_config: │
│ │ ├── name: poi config name │
│ │ ├── capk_list: CAPK_MCL_1 │
│ │ ├── cr_list: CR_MCL_1 │
│ │ └── emv_config: PPS_MChip_1 │
│ ├── payments: │
│ │ ├── 0: │
│ │ │ ├── randoms: │
│ │ │ │ ├── AABBCCDD │
│ ... │
│ │ │ └── DF8115: 060000000000FF │
│ │ └── outcome_parameter_set: 30F0F000B8F00D00 │
│ └── vcard: Card_MCL_1 │
│ │
╰──────────────────────────────────────────────────────────────────────╯

Finally, to run a test or a serie of tests, use the run sub-command with the desired test ID combination.

swittest-cli tests run 0-5
0 - 3B02-0001_first-trx-5-mutualappls: PASS ────────────────────────────
1 - 3B02-0002_first-trx-4-mutualappls: PASS ────────────────────────────
2 - 3B02-0003_first-trx-4-mutualappls: PASS ────────────────────────────
3 - 3B02-0004_first-trx-4-mutualappls: PASS ────────────────────────────
4 - 3B02-0005_first-trx-4-mutualappls: PASS ────────────────────────────
5 - 3B02-0006_first-trx-4-mutualappls: PASS ────────────────────────────

Note

To run several individual tests, use a comma separated list. To run a contiguous serie of tests, use a dash separator. You can also combine them as follow: 1,4,5-7,8-12.