Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Commands to complete

...

nose

...

pytest

...

unit2

...

Info

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

Generating a session ID

Standard Session ID

Code Block
sl-python config {--token <token> | --tokenfile <file>} --appname <appname> --branchbranchname <branch> --buildbuildname <build> --workspacepath <path> [--include <include>] [--exclude <exclude>] [--buildsessionid <buildsessionid>] [--proxy <proxy>] [--failbuild {true|false}help]

Parameter

Description

code

token

Access token generated from the Sealights server

code

tokenfile

Path to file containing access token generated from the SeaLights server

code

appname

Name of the application

Code Blockbranch

branchname

The source branch of the application

Code Blockbuild

buildname

The build label of the current build

workspacepath

Path to the workspace where the source code exists

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".

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

Optional: A user provided session ID

code

(case-sensitive)

proxy

Address of proxy to run connection through

Code Block
failbuild

Exit with an error code if an error is encountered (Default: false)

...

help

Show Help message and exit.

Pull Request Session ID

Code Block
sl-python buildprConfig {--token  <token> | --tokenfile <file>} {--buildsessionidappname <id> |<appname> --buildsessionidfiletargetbranch <file>}<branch> --workspacepath <workspacepath> latestcommit <commit_sha> --scm {git|none} [pullrequestnumber <number> --projectRootrepourl <folder>]<url> [--excludedpathsworkspacepath <excludedpaths>]<path> [--uniqueModuleIdinclude <id><include>] [--es-modulesexclude <exclude>] [--jobNamebuildsessionid <jobName><buildsessionid>] [--logsUrlproxy <logsUrl><proxy>] [--dependenciesFile <dependenciesFile>] [--instrumentForBrowsers --outputpath <folder> [--downloadAgent {true|false}] [--instrumentationOnly] [--labid <labid>]] [--proxy <proxy>] [--failbuild {true|false}]help]

Parameter

Description

token

Access token generated from the Sealights server

tokenfile

Path to file containing access token generated from the SeaLights server

appname

Name of the application

targetbranch

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

latestcommit

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

pullrequestnumber

he number assigned to the Pull Request from the source control

repourl

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

workspacepath

Path to the workspace where the source code exists

include

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

exclude

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

buildsessionid

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

proxy

Address of proxy to run connection through

help

Show Help message and exit.

Scanning a build

Code Block
sl-python scan {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --scm {git|none} [--scmBaseUrl <url> --scmProvider {github|gitlab|bitbucket} [--scmVersion <version>] [--babylonPlugins decorators-legacyproxy <proxy>] [--help]

...

Parameter

Description

code

token

Access token generated from the SeaLights server

code

tokenfile

Path to file containing access token generated from the SeaLights server

code

buildsessionid

Session ID of configuration created

Code Block

buildsessionidfile

Path to file containing the Session ID of configuration created

Code Blockworkspacepath Code Block

Path to the source workspace

Code Block
excludedpaths

Comma-separated list of files to exclude from scan

Supports wildcards (* = any string, ? = any character). For example: '*-with-dependencies.jar , bad-bad?.war, *-source.jar'

Code Block
projectRoot

Path to the root of the project. Usually where the src folder resides

Code Block
uniqueModuleId

Unique name when providing more than one build scan per build

es-modules

Indicates that you use es6 modules

Code Block
jobName

Name of Jenkins job

Code Block
logsUrl 

Path to Jenkins log folder

scm

scmProvider

Source control used

Current options are: git, none

Code Block
dependenciesFile 

A path to a json file that is in the following format:
[{"appName":"","branch":"","build":""}, {...}]

Code Block
instrumentForBrowsers

Instrument the JS files for providing browser front-end coverage information. Must be used with the outputpath parameter.

Code Block
downloadAgent

Set this value to 'false' in order to prevent the instrumented javascript to try and download the browser test listener (for example, when using 'Karma').

Code Block
instrumentationOnly

Only instrument the javascript files, without sending the build information to the SeaLights server

Code Block
outputpath

Folder to generate the instrumented JS files in when using the instrumentForBrowsers parameter

Code Block
labid

Unique ID for a set of test labs in case multiple labs are running simultaneously or for an integration build.
This needs to be done during the instrumentation process when using the instrumentForBrowsers option

Code Block
proxy

Address of proxy to run connection through

Code Block
failbuild

Exit with an error code if an error is encountered (Default: false)

scmprovider

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

scmBaseUrl

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

not provided

left blank, cloud version is assumed

babylonPlugins 

When there are decorators in the code, you should use this flag with the "decorators-legacy" value

Test Listener

. Otherwise, specify the version of your on-premise server.

proxy

Address of proxy to run connection through

help

Show Help message and exit.

Running backend server

Code Block
sl-python startrun {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [---teststage <teststage>cov-report <path>] [--per-test {true|false}] [--interval <interval>] [--labid <labid>] [--proxy <proxy>] [--help] args...
Name of the test stage

Parameter

Description

token

Access token generated from the SeaLights server

tokenfile

Path to file containing access token generated from the SeaLights server

buildsessionid

Session ID of configuration created

buildsessionidfile

Path to file containing the Session ID of configuration created

teststage

cov-report

Path to generate XML coverage report

per-test

Collect coverage per test (Default: false)

interval

Interval in milliseconds to send data

labid

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

proxy

Address of proxy to run connection through

Upload report files

...

help

Show Help message and exit.

args...

Extra arguments for running the application server

Test Listener

Starting a test stage

Code Block
sl-python uploadReportsstart {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} {--reportFile <reportFile> | --reportFilesFolder <reportFilesFolder>}teststage <teststage> [--labid <labid>] [--source <source>] [--type <type>] [--proxy <proxy>] [--failbuild {true|false}help]

Parameter

Description

code

token

Access token generated from the SeaLights server

code

tokenfile

Path to file containing access token generated from the SeaLights server

code

buildsessionid

Session ID of configuration created

Code Block

buildsessionidfile

Path to file containing the Session ID of configuration created

Code Block
reportFile

Path to report file (multiple entries can be provided)

Code Block
reportFilesFolder

Path to folder containing report files (multiple entries can be provided)

Note: all files in the folder will be uploaded

code

teststage

Name of the test stage

labid

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

Code Block
source

The reports provider

Default: Junit xml report

type

Code Block
Values:
code

type

Name of testing framework type

Code Block

JUnitReport - For uploading JUnit test report files
Code Block
commitLog - For uploading git style commit logs

proxy

Address of proxy to run connection through

Code Block
failbuild

Exit with an error code if an error is encountered (Default: false)

Optional override parameters:

...

Parameter

...

Description

...

Code Block
appname

...

Name of the application

...

Code Block
branch

...

The source branch of the application

...

Code Block
build

...

The build label of the current build

Ending a test stage

...

Upload report files

Report files must be JUnit style XML reports

Code Block
sl-python enduploadReports {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} {--reportfile <reportFile> | --reportfilesfolder <reportFilesFolder>} [--hasmorerequests {False|True}] [--labid <labid>] [--source <source>] [--type <type>] [--proxy <proxy>] [--failbuild {true|false}help]

Parameter

Description

code

token

Access token generated from the SeaLights server

code

tokenfile

Path to file containing access token generated from the SeaLights server

Code Block

buildsessionid

Session ID of configuration created

code

buildsessionidfile

Path to file containing the Session ID of configuration created

code

reportfile

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

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

Set to ‘True’ if test results contains multiple reports (Default: ‘False’).

labid

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

code

(case-sensitive)

source

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

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

proxy

Address of proxy to run connection through

Code Block
failbuild

Exit with an error code if an error is encountered (Default: false)

...

help

Show Help message and exit.

Ending a test stage

Code Block
sl-python runend {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--workspacepath <path>] [--useinitialcolor {true|false}] [--teststage <teststage>] [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}] args...

Parameter

Description

Code Block

token

Access token generated from the SeaLights server

code

tokenfile

Path to file containing access token generated from the SeaLights server

code

buildsessionid

Session ID of configuration created

code

buildsessionidfile

Path to file containing the Session ID of configuration created

Code Block
workspacepath

Path to the source workspace

Code Block
useinitialcolor

When reporting tests manually this should be set to false (Default: false)

Code Blockteststage Code Block

Name of the test stage

labid

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

code

proxy

Address of proxy to run connection through

Code Block
failbuild

Exit with an error code if an error is encountered (Default: false)

args...

Extra arguments for running mocha framework tests

help

Show Help message and exit.

Running Tests via pytest, unittest, unit2 or nose

These commands will be documented soon, please refer to their --help option via the command below

Code Block
sl-python {pytest|unittest|unit2|nose} --help

Logging

Enabling logging in Python is done using by setting the SL_DEBUG environment variable to “true”.Furthermore, you can set the level of logging by using the SL_LOG_LEVEL environment variable  with one of the following options error, warn, info or debug

Messages will be written to stdout and the file, sealights-python-agent.log

Code Block
languagebash
export SL_DEBUG=true
export SL_LOG_LEVEL=info