Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

Table of Contents

...

Configure a session and create session ID

...

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

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

branch

branchname

The source branch of the application

build

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 (case-sensitive)

proxy

Address of proxy to run connection through

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

Scanning a build

...

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-legacy]
proxy <proxy>] [--help]

...

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

workspacepath

Path to the source workspace

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'

projectRoot
Path to the root of the project. Usually where the src folder resides
uniqueModuleId
Unique name when providing more than one build scan per buildes-modulesIndicates that you use es6 modules
jobName
Name of Jenkins job
logsUrl 
Path to Jenkins log folder

scm

scmProvider

Source control used

Current options are: git, none

dependenciesFile 

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

instrumentForBrowsers
Instrument the JS files for providing browser front-end coverage information. Must be used with the outputpath parameter.
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').
instrumentationOnly
Only instrument the javascript files, without sending the build information to the SeaLights server
outputpath
Folder to generate the instrumented JS files in when using the instrumentForBrowsers parameter
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
proxy
Address of proxy to run connection through
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

Ending a multi module build 

...

. 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 buildendrun {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--cov-proxyreport <proxy><path>] [--per-failbuildtest {true|false}] [--interval <interval>] [--skipUpgrade {true|false}labid <labid>] [--okproxy |<proxy>] [--failed
help] args...

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

proxyAddress of proxy to run connection throughfailbuildExit with an error code if an error is encountered

cov-report

Path to generate XML coverage report

per-test

Collect coverage per test (Default: false)

skipUpgrade

Should not try to upgrade agent (Default: false)

ok

build finished successfully

failed

build not finished successfully

Updating/Deleting a component from an Integration build

Code Block
firstline1
titleUsage
sl-python {componentUpdate | componentDelete} {-token  <arg> | -tokenfile <arg>} {-buildsessionid <arg> | -buildsessionidfile <arg>} [--proxy <proxy>] {-componentIds <arg> | -componentFile <file>}

ParameterDescription tokenAccess token generated from the SeaLights servertokenfilePath to file containing access token generated from the SeaLights serverbuildsessionidSession ID of configuration createdbuildsessionidfilePath to file containing the Session ID of configuration createdcomponentIdsOne or several build session ID's (comma separated) of the component(s) to be updated or deletedcomponentFileA path to a json file that is in the following format:
[{"appName":"","branch":"","build":""}, {...}]
or
[{"buildSessionId":"", {...}]proxyAddress of proxy to run connection through

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

help

Show Help message and exit.

args...

Extra arguments for running the application server

Test Listener

Starting a test stage

Usage
Code Block
firstline1
title
sl-python start {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --teststage <teststage> [--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

buildsessionid

Session ID of configuration created

buildsessionidfile

Path to file containing the Session ID of configuration created

teststage

Name of the test stage

labid

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

proxy

Address of proxy to run connection through

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

Upload report files

Report files must be junit JUnit style xml XML reports

Usage
Code Block
firstline1
title
sl-python uploadReports {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} {--reportFilereportfile <reportFile> | --reportFilesFolderreportfilesfolder <reportFilesFolder>} [--hasmorerequests {False|True}] [--labid <labid>] [--source <source>] [--type <type>] [--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

buildsessionid

Session ID of configuration created

buildsessionidfile

Path to file containing the Session ID of configuration created

reportFile

reportfile

Path to report file

(multiple entries can be provided)reportFilesFolder

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

reportfilesfolder

Path to folder

containing report files (multiple entries can be provided)

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 (case-sensitive)

source

The reports provider

Default:

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

type

Values:

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

typeName of testing framework type

...

Coverage file must be in JSON format, created by the Istanbul framework

Code Block
firstline1
titleUsage
sl-python nycReport {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} {--report <reportFile> | --projectRoot <project root dir>} [--labid <labid>] [--proxy <proxy>]
ParameterDescription
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
report

Path to coverage-final.json

projectRoot

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

labid

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

proxyAddress of proxy to run connection through

proxy

Address of proxy to run connection through

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

Optional override parameters:

...

appname

...

branch

...

build

...

help

Show Help message and exit.

Ending a test stage

Usage
Code Block
firstline1
title
sl-python end {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}]

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

labid

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

proxy

Address of proxy to run connection through

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

...

Code Block
firstline1
titleUsage
sl-python mocha {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --teststage <teststage> [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}] -- args...

...

token

...

tokenfile

...

buildsessionid 

...

buildsessionidfile

...

teststage

...

Name of the test stage

...

labid

...

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

...

proxy

...

failbuild

...

Extra arguments for running mocha framework tests
Note the double dash delimits between the sealights options and parameters passed to mocha

...

Code Block
firstline1
titleUsage
sl-python jasmine {--token  <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} --teststage <teststage> [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}] args...

...

token

...

tokenfile

...

buildsessionid 

...

buildsessionidfile

...

teststage

...

Name of the test stage

...

labid

...

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

...

proxy

...

failbuild

...

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

...

token

...

tokenfile

...

buildsessionid 

...

buildsessionidfile

...

workspacepath

...

Path to the source workspace

...

useinitialcolor

...

teststage

...

Name of the test stage

...

labid

...

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

...

proxy

...

failbuild

...

Logging

In order to enable logs you can set the NODE_DEBUG environment variable to one of the following:

...

sl

...

sl-file

...

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

...

languagebash
titleSample

...

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

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

Code Block
languagebash
export SL_DEBUG=true