Frequently Asked Questions#

Installing third-party packages#

You can install Ubuntu packages using apt or Python packages using pip. See Configuration Reference: Customising the test-run environment.

Passing parameters to test scripts#

Static configuration#

For configuration that is different on each Stb-tester Node, but doesn’t change very often, create a config file for each Stb-tester Node under config/test-farm/. For example:

config/
  test-farm/
    stb-tester-012345678912.conf
    stb-tester-abcdefabcdef.conf
    ...etc...

Your test script can read the configuration in these files by calling stbt.get_config. For more details see Node-specific configuration files.

Run-time parameters#

You can use Tags to pass parameters to the test script at run-time:

  • When running a test from the Stb-tester Portal you can specify tags in the form in your browser.

  • When running a test with stbt_rig Command-Line Tool you can specify tags with --tag NAME=VALUE. For example:

    stbt_rig --node-id=stb-tester-012345678912 run --tag NAME=VALUE ...testname...
    

    --tag can be specified more than once.

  • Similarly, if you are using the REST API directly instead of using stbt_rig, /api/v2/run_tests takes a tags parameter.

In the test script you can read the tag’s value by calling stbt.get_config("result.tags", "tagname", default="..."). The value is always a string, so you may need to convert it to another type — for example value = int(stbt.get_config(...)).

The current node_id#

Several configuration values are defined automatically, and you can read them using stbt.get_config. These include the node_id (the serial number of the Stb-tester Node that the test is running on): stbt.get_config("node", "node_id").

For the full list see Automatic configuration keys.

Passwords and other secrets#

See Storing passwords and other secrets.

OCR#

Installing language packs#

  1. Install the necessary language pack (see instructions below). The following language packs are already installed by default:

    • Arabic (ara)

    • Czech (ces)

    • Danish (dan)

    • Dutch (nld)

    • English (eng)

    • French (fra)

    • German (deu)

    • Greek (ell)

    • Hungarian (hun)

    • Italian (ita)

    • Japanese (jpn)

    • Norwegian (nor)

    • Portuguese (por)

    • Romanian (ron)

    • Spanish (spa)

  2. Use the lang parameter when you call stbt.ocr and stbt.match_text — for example stbt.ocr(lang="dan") or stbt.ocr(lang="eng+dan").

    You can set the default language globally by setting lang in the [ocr] section of .stbt.conf. For example:

    [ocr]
    lang = eng+dan
    

To install additional languages, create the file config/setup/setup in your test-pack with the following contents:

#!/bin/bash -ex

# Install Japanese language support for OCR:
sudo curl --fail -o /usr/share/tesseract-ocr/4.00/tessdata/jpn.traineddata \
  https://raw.githubusercontent.com/stb-tester/tessdata/d0a9de7/jpn.traineddata

Change “jpn” above to the three-letter ISO-639-3 language code that you want. See the available tesseract language packs here.

For more information about the config/setup/setup script see Customising the test-run environment.