Table of Contents |
---|
...
build
config
end
nose
pytest
run
start
unit2
unittest
uploadreports
...
Info |
---|
Passing Parameters as Environment Variables All of the below For example,
|
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 |
---|
| Access token generated from the Sealights server |
| Path to file containing access token generated from the SeaLights server |
| Name of the application |
| The source branch of the application |
| The build label of the current build |
| Path to the workspace where the source code exists |
| Include only files whose paths match one of these patterns. |
| Omit files whose paths match one of these patterns. |
| Optional: A user provided session ID (case-sensitive) |
| Address of proxy to run connection through |
Code Block |
---|
failbuild |
Exit with an error code if an error is encountered (Default: false)
Scanning a build
| 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}] [--scmBaseUrlhelp] |
Parameter | Description |
---|---|
| Access token generated from the Sealights server |
| Path to file containing access token generated from the SeaLights server |
| Name of the application |
| The branch to which this PR will be merged into (already reported to SeaLights) |
| The full SHA of the last commit made to the Pull Request |
| he number assigned to the Pull Request from the source control |
| The pull request URL for the PR to be scanned, up until the section before the pullRequestNumber value |
| Path to the workspace where the source code exists |
| Include only files whose paths match one of these patterns. |
| Omit files whose paths match one of these patterns. |
| Optional: A user provided session ID (case-sensitive) |
| Address of proxy to run connection through |
| 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 |
---|
| Access token generated from the SeaLights server |
| Path to file containing access token generated from the SeaLights server |
|
Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
Code Block |
---|
workspacepath |
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 |
---|
logsUrl |
Path to Jenkins log folder
jobName
Name of Jenkins job
|
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)
| The provider name of your Source Control Management (SCM) tool. |
| The URL to the repository which contains the code. If not provided, the url of the remote GIT origin will be used Example: |
| The version of your Source Control Management (SCM) tool. |
If |
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. | |
| Address of proxy to run connection through |
| Show Help message and exit. |
Running backend server
Code Block |
---|
sl-python startrun {--token <token> | --tokenfile <file>} {--buildsessionid <id> | --buildsessionidfile <file>} [--cov-report <path>] [--teststage <teststage>per-test {true|false}] [--interval <interval>] [--labid <labid>] [--proxy <proxy>] [--failbuild {true|false}]help] args... |
Parameter | Description |
---|
| Access token generated from the SeaLights server |
| Path to file containing access token generated from the SeaLights server |
|
Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
Code Block |
---|
teststage |
Name of the test stage
| Path to generate XML coverage report |
| Collect coverage per test (Default: false) |
| Interval in milliseconds to send data |
| Unique ID for a set of test labs in case multiple labs are running simultaneously (case-sensitive) |
| Address of proxy to run connection through |
Code Block |
---|
failbuild |
Exit with an error code if an error is encountered (Default: false)
Upload report files
...
| Show Help message and exit. |
| 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>} {--reportFileteststage <reportFile> | --reportFilesFolder <reportFilesFolder>} <teststage> [--labid <labid>] [--source <source>] [--type <type>] [--proxy <proxy>] [--failbuild {true|false}help] |
Parameter | Description |
---|
| Access token generated from the SeaLights server |
| Path to file containing access token generated from the SeaLights server |
|
Session ID of configuration created |
| 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
| Name of the test stage |
| 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 Block |
---|
JUnitReport - For uploading JUnit test report files |
Code Block |
---|
commitLog - For uploading git style commit logs |
type
Name of testing framework type
| 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 |
---|
| Access token generated from the SeaLights server |
| Path to file containing access token generated from the SeaLights server |
|
Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
| Path to report file. This argument can be declared multiple times in order to upload multiple files. |
| Path to folder that contains nothing but report files. All files in folder will be uploaded. Note: all files in the folder will be uploaded |
| Set to ‘True’ if test results contains multiple reports (Default: ‘False’). |
| Unique ID for a set of test labs in case multiple labs are running simultaneously |
(case-sensitive) | |
| The reports provider. If not set, the default will be 'Junit xml report'. |
| Name of testing framework type. The report type. If not set, the default will be 'JunitReport'
|
| Address of proxy to run connection through |
Code Block |
---|
failbuild |
Exit with an error code if an error is encountered (Default: false)
...
| 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 |
---|
| Access token generated from the SeaLights server |
| Path to file containing access token generated from the SeaLights server |
|
Session ID of configuration created |
| Path to file containing the Session ID of configuration created |
Code Block |
---|
workspacepath |
Path to the source workspace
Code Block |
---|
teststage |
Name of the test stage
When reporting tests manually this should be set to false (Default: false)
| Unique ID for a set of test labs in case multiple labs are running simultaneously |
| 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
Logging
In order to enable logs you can set the NODE_DEBUG environment variable to one of the following:
...
Value
...
Description
...
Code Block |
---|
sl |
...
Display log output to the console
...
Code Block |
---|
sl-file |
...
Export the log information to a log file named 'sl.node.log'
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
Sample
| 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 | ||
---|---|---|
| ||
export NODESL_DEBUG=sl export SL_LOG_LEVEL=debugtrue |