Command Reference

Passing Parameters as Environment Variables

All of the below sl-python CLI parameters can be passed as an environment variable by prepending SL_ to them.

For example,

  • the param buildName would be set with SL_BUILDNAME

  • the param buildSessionId would be set with SL_BUILDSESSIONID

  • the param proxy would be set with SL_PROXY

Python Agent — Command Reference

Generating a Session ID (config)

This example is with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

##Minimum required CLI parameters
sl-python config \
  --token <token> \
  --appName <app-name> \
  --branchName <branch> \
  --buildName <build> \
  --scanDir <path> \
  --includeFiles <include> \
  --excludeFiles <exclude>

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the Sealights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--appName

--appname

Name of the application.

--branchName

--branchname

The source branch of the application.

--buildName

--buildname

The build label of the current build.

--scanDir

--workspacepath

Path to the workspace where the source code exists.

--includeFiles

--include

Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted. If you want to provide multiple patterns, please use a comma between each quoted pattern. For example, "pattern1", "pattern2".

--excludeFiles

--exclude

Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted. If you want to provide multiple patterns, please use a comma between each quoted pattern. For example, "pattern1", "pattern2".

--buildSessionId

--buildsessionid

Optional: A user provided session ID (case-sensitive).

--proxy

--proxy

Address of proxy to run connection through.

--help

--help

Show Help message and exit.

--quiet

--quiet

Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console. The default value is false.

Pull Request Session (prConfig)

This example is with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the Sealights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--appName

--appname

Name of the application.

--targetBranch

--targetbranch

The branch to which this PR will be merged into (already reported to SeaLights).

--latestCommit

--latestcommit

The full SHA of the last commit made to the Pull Request.

--pullRequestNumber

--pullrequestnumber

he number assigned to the Pull Request from the source control.

--repositoryUrl

--repourl

The pull request URL for the PR to be scanned, up until the section before the pullRequestNumber value.

--scanDir

--workspacepath

Path to the workspace where the source code exists.

--includeFiles

--include

Include only files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.

--excludeFiles

--exclude

Omit files whose paths match one of these patterns. Accepts shell-style wildcards, which must be quoted.

--buildSessionId

--buildsessionid

Optional: A user provided session ID (case-sensitive).

--proxy

--proxy

Address of proxy to run connection through.

--help

--help

Show Help message and exit.

--quiet

--quiet

Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console. The default value is false.

Scanning a Build (scan)

This example is with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the SeaLights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--buildSessionId

--buildsessionid

Session ID of configuration created.

--buildSessionIdFile

--buildsessionidfile

Path to file containing the Session ID of configuration created.

--scmType

--scm

Source control used

Current options are: git, none (Default: none).

--scmProvider

--scmprovider

The provider name of your Source Control Management (SCM) tool. Values: Github, Bitbucket and Gitlab (Default: Github).

--repositoryUrl

--scmbaseurl

The URL to the repository which contains the code.

If not provided, the url of the remote GIT origin will be used.

Example: https://my.bitbucket.com/projects/ABCD/repos/XYZ/browse/A1

--scmVersion

--scmversion

The version of your Source Control Management (SCM) tool. If left blank, cloud version is assumed. Otherwise, specify the version of your on-premise server.

--proxy

--proxy

Address of proxy to run connection through.

--help

--help

Show Help message and exit.

--quiet

--quiet

Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console (Default: false).

Running Backend Server (run)

This example is with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the SeaLights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--buildSessionId

--buildsessionid

Session ID of configuration created.

--buildSessionIdFile

--buildsessionidfile

Path to file containing the Session ID of configuration created.

--labId

--labid

Unique ID for a set of test labs in case multiple labs are running simultaneously (case-sensitive).

--testStage

--teststage

The tests stage (e.g 'integration tests', 'regression'). The default will be 'Unit Tests'.

--testGroupId

--testgroupid

The test group id.

--cov-report

--cov-report

Path to generate XML coverage report.

--autoExecution

Run with auto execution (start and end execution).

--dropInitFootprints

Drop initial footprints (ignore coverage data before execution starts).

--proxy

--proxy

Address of proxy to run connection through.

--help

--help

Show Help message and exit.

--quiet

--quiet

Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console (Default: false).

Test Listener - Opening a Test Stage (start)

This example is with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the SeaLights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--buildSessionId

--buildsessionid

Session ID of configuration created.

--buildSessionIdFile

--buildsessionidfile

Path to file containing the Session ID of configuration created.

--labId

--labid

Unique ID for a set of test labs in case multiple labs are running simultaneously.

--testStage

--teststage

The tests stage (e.g 'integration tests', 'regression'). The default will be 'Unit Tests'.

--testProjectId

--testprojectid

The test project id.

--testGroupId

--testgroupid

The test group id.

--prId

--prid

The PR id.

--waitAfterStart

The time to wait after starting the execution.

--proxy

--proxy

Address of proxy to run connection through.

--help

--help

Show Help message and exit.

--quiet

--quiet

Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console (Default: false).

Test Listener - Uploading Report Files (uploadReports)

This example is with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the SeaLights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--buildSessionId

--buildsessionid

Session ID of configuration created.

--buildSessionIdFile

--buildsessionidfile

Path to file containing the Session ID of configuration created.

--labId

--labid

Unique ID for a set of test labs in case multiple labs are running simultaneously (case-sensitive).

--file

--reportfile

Path to report file. This argument can be declared multiple times in order to upload multiple files.

--fileFolder

--reportfilesfolder

Path to folder that contains nothing but report files. All files in folder will be uploaded. This argument can be declared multiple times in order to upload multiple files from multiple folders containing report files.

Note: all files in the folder will be uploaded

--hasMoreRequests

--hasmorerequests

Set to true if test results contains multiple reports (Default: false).

--source

--source

The reports provider. If not set, the default will be 'Junit xml report'.

--type

--type

Name of testing framework type. The report type. If not set, the default will be 'JunitReport':

  • JUnitReport - For uploading JUnit test report files.

  • commitLog - For uploading git style commit logs.

--help

--help

Show Help message and exit.

--quiet

--quiet

Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console (Default: false).

Test Listener - Closing a Test Stage (end)

This example is with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the SeaLights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--buildSessionId

--buildsessionid

Session ID of configuration created.

--buildSessionIdFile

--buildsessionidfile

Path to file containing the Session ID of configuration created.

--labId

--labid

Unique ID for a set of test labs in case multiple labs are running simultaneously.

--testGroupId

--testgroupid

The test group id.

--waitBeforeEnd

The time to wait before ending the execution.

--help

--help

Show Help message and exit.

Running Tests via pytest, unittest, nose or behave

These examples are with minimum required CLI Parameters. All available CLI Parameters can be found in the table below.

All CLI Parameters

CLI Parameter
Legacy Alias
Description

--token

--token

Access token generated from the SeaLights server.

--tokenFile

--tokenfile

Path to file containing access token generated from the SeaLights server.

--buildSessionId

--buildsessionid

Session ID of configuration created.

--buildSessionIdFile

--buildsessionidfile

Path to file containing the Session ID of configuration created.

--labId

--labid

Unique ID for a set of test labs in case multiple labs are running simultaneously.

--testStage

--teststage

The tests stage (e.g 'integration tests', 'regression'). The default will be 'Unit Tests'.

--testProjectId

--testprojectid

The test project id.

--testGroupId

--testgroupid

The test group id.

--prid

--prid

The PR id.

--cov-report

--cov-report

Path to generate XML coverage report.

--pre-test

--pre-test

Collect coverage per test.

--interval

--interval

Interval in milliseconds to send data.

--disableTia

--test-selection-disable

A flag to disable the Test Optimization.

--test-selection-retry-interval

--test-selection-retry-interval

Test recommendation retry interval in sec.

--test-selection-retry-timeout

--test-selection-retry-timeout

Test recommendation retry timeout in sec.

--proxy

--proxy

Address of proxy to run connection through.

--help

--help

Show Help message and exit.

--quiet

--quiet

Suppresses console feedback messages only. Does not suppress log output when logging is configured to print to the console (Default: false).

Logging

Logging is configured via environment variables. By default, the agent logs at ERROR level only.

Environment Variable
Description

SL_DEBUG

Enables agent logging when set to true. Required for any log output beyond errors.

SL_LOG_LEVEL

Sets the log verbosity: DEBUG, INFO, WARN, ERROR (default: ERROR). Takes effect only when SL_DEBUG=true.

SL_SAVE_LOG_FILE

Persists log output to sealights-python-agent.log when set to true. By default, output is written to stdout only.

Enable SL_DEBUG=true first, then use SL_LOG_LEVEL to control verbosity. Setting SL_LOG_LEVEL alone without SL_DEBUG=true has no effect.

Last updated

Was this helpful?