Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Testwizard - Test

Python language support for testing different kinds of devices using testwizard

Usage

Use this package in combination with one (or more) of the specific device packages

Sidecar file

The testwizard manager enables a single script to be run on different devices with (optionally) different sets of parameters. To enable this from any IDE a sidecar file (in json format) is used . By default the name of the sidecar file is the same as this script, but with a .json extension. A command-line-argument (--sidecar or -s) can be used to instruct the usage of a different file.

This json file has the following attributes:

  • tester: The name of the tester (optional)
  • parameters: An array of parameters (optional)
    • name: The name of the parameter
    • value: The value for the parameter
  • customProperties: An object holding the custom property values (optional)
  • resources: An array of resources
    • category: The category of the testobject
    • name: The name of the testobject
    • id: The id of the testobject
    • customProperties: An object holding the custom property values (optional)
  • outputFolder: The folder where the log files should be written (optional)

Parameters

Every parameter will be made available as a field of the session object.

param1 = session.parameters['param1']

Resources

All resources will be acquired (and thus locked) at the start of a test run and will be released when the script ends. To execute a command on a testobject it must be referenced (constructed), when doing this, the name of the resource will be used, while the id corresponds to the actual device.

mobile = Mobile(session, "Mobile")
result = mobile.initDriver()

CustomProperties

Custom properties are maintained in the Testwizard manager and can be set on Sessions and TestObjects. These custom properties can be accessed from within a script.

sessionProperty = session.customProperties["myString"]
testObjectProperty = mobile.customProperties["myNumber"]

Output folder

When running a test all actions are logged (testrun.log) and so is the result (result.log). By default the location of these files is a timestamp based folder within the runs folder. If a different location is preferred, this can be configured in the outputfolder attribute.

Session

When the script is executed (run or debug), a new session is created, and all resources will be locked If any of the resources is allready in use, a session cannot be setup and an error will be thrown. The session is destroyed when the script ends. At this point the resources will be released and available for other script runs.

More information about the session can be read from the info attribute:

  • info
    • scriptFilePath: The full path of the script file
    • scriptFileName: The file name of the script file
    • storagePath: The directory where the output will be written
    • tester: The name of the tester
  • info.environment
    • scriptsBasePath: The root directory where all scripts are stored
    • storageBasePath: The root directory where the output is written
    • ocrEngine: The name of the ocr engine being used
    • testWizardVersion: The version of testwizard being used
  • info.session (optional: only when run from within the manager)
    • id: The unique identifier of the session in the manager
    • name: The name of the session
    • scriptIndex: The index of the script within the session

Results

The outcome of a script run can be either Pass, Fail or Error. During a script run multiple results can be reported, this can be done in 2 different ways:

  1. addPass / addFail: reports a pass or fail but does not post it to the server
  2. setResult: reports a pass / fail /error and posts it to the server
    result = mobile.initDriver()
    if result.success:
        session.addPass(result.message)
    else:
        session.addFail(result.message)
    result = mobile.initDriver()
    if result.success:
        session.setResult(ResultCodes.PASS, result.message)
    else:
        session.setResult(ResultCodes.FAIL, result.message)

Sample script

python (sample.py)

import sys
import time

from testwizard.test import TestWizard
from testwizard.test import ResultCodes
from testwizard.mobile import Mobile
from testwizard.set_top_box import SetTopBox

with TestWizard() as TW:
    session = TW.session

    print("-- Parameter and Custom properties ---")
    print("Parameters:")
    print("  param1 = " + session.parameters.param1)
    print("  param2 = " + session.parameters['param2'])
    print("  dummy = " + str(session.parameters.get('dummy')))
    print("Custom Properties:")
    print("  myString = " + session.customProperties.myString)
    print("  myNumber = " + str(session.customProperties['myNumber']))
    print("  dummy = " + str(session.customProperties.get('dummy')))

    print("Session info:")
    print("  info.scriptFilePath = " + session.info.scriptFilePath)
    print("  info.scriptFileName = " + session.info.scriptFileName)
    print("  info.storagePath = " + session.info.storagePath)
    print("  info.tester = " + session.info.tester)
    print("  info.environment.scriptsBasePath = " + session.info.environment.scriptsBasePath)
    print("  info.environment.storageBasePath = " + session.info.environment.storageBasePath)
    print("  info.environment.ocrEngine = " + session.info.environment.ocrEngine)
    print("  info.environment.testWizardVersion = " + session.info.environment.testWizardVersion)
    if  session.info.session is not None:
        print("Script was started by the manager:")
        print("  info.session.id = " + session.info.session.id)
        print("  info.session.name = " + session.info.session.name)
        print("  info.session.scriptIndex = " + session.info.session.scriptIndex)

    print("-- Create Mobile test object ---")
    mobile = Mobile(session, "Mobile")

    print("-- Mobile test object info ---")
    print("  id = " + mobile.info.id)
    print("  name = " + mobile.info.name)
    print("  category = " + mobile.info.category)
    print("  device.serialNo = " + mobile.info.device.serialNo)
    print("  device.hardwareVersion = " + mobile.info.device.hardwareVersion)
    print("  device.softwareVersion = " + mobile.info.device.softwareVersion)
    print("  device.description = " + mobile.info.device.description)
    print("  device.vendor.name = " + mobile.info.device.vendor.name)
    print("  device.vendor.modelName = " + mobile.info.device.vendor.modelName)
    print("  device.vendor.serialNo = " + mobile.info.device.vendor.serialNo)
    print("Custom Properties:")
    print("  myString = " + mobile.customProperties.myString)
    print("  myNumber = " + str(mobile.customProperties['myNumber']))
    print("  dummy = " + str(mobile.customProperties.get('dummy', None)))

    print("mobile: initDriver")
    result = mobile.initDriver()
    print(result.message)
    if result.success is False:
        session.addFail(result.message)

    print("-- Create SetTopBox test object ---")
    setTopBox = SetTopBox(session, "STB")

    print("stb: sendRCKey")
    result = setTopBox.sendRCKey("menu")
    print(result.message)
    if result.success is False:
        session.addFail(result.message)

    if not (session.hasFails or session.hasErrors):
        session.addPass("Test was successful")

sidecar file (sample.json)

{
    "tester": "Some tester",
    "parameters": [
        { 
            "name": "param1", 
            "value": "value1"
        },
        { 
            "name": "param2", 
            "value": "value2"
        }
    ],
    "customProperties": {
        "myString": "test",
        "myNumber": 123.4
    },
    "resources": [
        { 
            "category": "MOBILE", 
            "name": "Mobile", 
            "id": "Mobile 1",
            "customProperties": {
                "myString": "Just testing",
                "myNumber": 456
            }
        },
        { 
            "category": "STB", 
            "name": "STB", 
            "id": "SetTopBox 1"
        }
    ],
    "outputFolder": "c:\\temp"
}

Compatibility

The version is compatible with testwizard version 3.5

License

Testwizard licensing

Metadata

Release files for testwizard.test 3.4.4b1063

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for testwizard.test 3.4.4b1063
File Size Uploaded
testwizard.test-3.4.4b1063.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for testwizard.test 3.4.4b1063
File Interpreter ABI Platform
testwizard.test-3.4.4b1063-py3-none-any.whl Python 3 none any Details

Total release size: 8.6 kB

Release files / testwizard.test-3.4.4b1063.tar.gz

Download URL testwizard.test-3.4.4b1063.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
72c8b95d4f07e071d49333c709cd833e93ffae42ce1fd5f7f1266621a6dec102
BLAKE2b-256 checksum
How to use checksums
886d5800cc25cb0b6e438a5186c894bd536d076a77d4e932149e2dd1a9dd77ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

Release files / testwizard.test-3.4.4b1063-py3-none-any.whl

Download URL testwizard.test-3.4.4b1063-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25679b52da67358e390b78f46eb560c286e3bcc002167aae0e466204131c52e9
BLAKE2b-256 checksum
How to use checksums
9788dbb858fa16392ea492a7a1037e6f9c3c72a7e51af2aabe49b811a09ea6fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.9

Release history Release notifications | RSS feed

3.8.1

2 release files

3.8.0

2 release files

3.7.0

2 release files

3.6.0

2 release files

3.5.0

2 release files

3.4.4

2 release files

This release

3.4.4b1063 This release

2 release files

3.4.2

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.6

2 release files

3.3.5

2 release files

3.3.4

2 release files

3.3.3

2 release files

3.3.2

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.10

2 release files

3.2.9

2 release files

3.2.8

2 release files

3.2.7

2 release files

3.2.6

2 release files

3.2.5

2 release files

3.2.3

2 release files

3.2.1

2 release files

3.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page