Versions Compared

Key

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

Gathering coverage and test information using the SeaLights Node.jsTest Listener is done in a few steps:

...

, we recommend to use the Lab ID for this. If your component does not yet support the Lab ID option, use the Build Session ID to connect between the test listener and the test runner:

Starting the Test

...

Stage

First the SeaLights server needs to be notified that a test stage is starting.

Code Block
languagebash
themeEclipse
titleSample command
./node_modules/.bin/Unix:
npx slnodejs start --tokenfile /path/to/sltoken.txt --labid "<Lab ID>" --teststage "Unit Tests"

Windows:
call npx slnodejs start --tokenfile \path\to\sltoken.txt --labid "<Lab ID>" --teststage "Unit Tests"

Expand
titleUsing Build Session ID
Code Block
languagebash
Unix:
npx slnodejs start --tokenfile 

...

/path/to/

...

sltoken.txt --buildsessionidfile

...

 buildSessionId --teststage "Unit Tests"

Windows:
call npx slnodejs start --tokenfile \path\to\sltoken.txt --buildsessionidfile buildSessionId --teststage "Unit 

...

Tests"
Info

See 'Node.js Command Reference - Starting a test stage' for full parameter details

Running your tests

...

Functional Tests

Before running your functional tests you need to set up the backend server to receive the test footprints. See 'Using Node.js Agents - Running backend server using SeaLights agent'

Once set up you now run your tests normally while generating one or more JUnit xml XML result files to be reported to the SeaLights server.

...

Unit Tests

As the unit tests Unit Tests are not run against a backend server, you need to run the actual tests using the Sealights Node.js Agent while generating one or more JUnit xml XML result files to be reported to the SeaLights server.

...

Once done running the tests you upload the report files to the SeaLights server

Code Block
languagebash
themeEclipse
titleSample command for a single file
./node_modules/.bin/Unix:
npx slnodejs uploadReports --tokenfile /path/to/sltoken.txt --labid "<Lab ID>" --reportFile "/path/to/junit_report.xml"

Windows:
call npx slnodejs uploadReports --tokenfile "/path/to/tokenFile" --buildsessionidfile "\path\to\sltoken.txt --labid "<Lab ID>" --reportFile "\path\to\junit_report.xml"

Expand
titleUsing Build Session ID
Code Block
languagebash
Unix:
npx slnodejs uploadReports --tokenfile /path/to/

...

sltoken.txt --buildsessionidfile buildSessionId --reportFile "/path/to/junit_report.xml"

...

Info

See 'Node.js Command Reference - Upload report files' for full parameter details

...



Windows:
call npx slnodejs uploadReports --tokenfile \path\to\sltoken.txt --buildsessionidfile buildSessionId --reportFile "\path\to\junit_report.xml"

See 'Using Node.js Agents - Uploading multiple files' for information on how to upload multiple files

Info

See 'Node.js Command Reference - Upload report files' for full parameter details

Ending the Test Stage

If the tests stage was not ended by providing the '-hasMoreRequests false'  option during the upload, then the server needs to be notified Finally notify the server that a test stage has ended.

Code Block
languagebash
themeEclipse
titleSample command
./node_modules/.bin/Unix:
npx slnodejs end --tokenfile /path/to/sltoken.txt --labid "<Lab ID>"

Windows:
call npx slnodejs end --tokenfile \path\to\sltoken.txt --labid "<Lab ID>"

Expand
titleUsing Build Session ID
Code Block
languagebash
Unix:
npx slnodejs end --tokenfile 

...

/path/to/

...

sltoken.txt --buildsessionidfile

...

 buildSessionId

Windows:
call npx slnodejs end --tokenfile \path\to\sltoken.txt --buildsessionidfile buildSessionId
Info

See 'Node.js Command Reference - Ending a test stage' for full parameter details