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 Listener
First the SeaLights server needs to be notified that a test stage is starting.
Code Block |
---|
language | bash |
---|
theme | Eclipse |
---|
title | Sample command |
---|
|
Unix:
./node_modules/.bin/slnodejs start --tokenfile /path/to/sltoken.txt --labid "<Lab ID>" --teststage "Unit Tests"
Windows:
call .\node_modules\.bin\slnodejs start --tokenfile \path\to\sltoken.txt --labid "<Lab ID>" --teststage "Unit Tests" |
Expand |
---|
title | Using Build Session ID |
---|
|
|
...
...
Unix:
./node_modules/.bin/slnodejs start --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --teststage "Unit Tests"
Windows:
call .\node_modules\.bin\slnodejs start --tokenfile \path\to\sltoken.txt --buildsessionidfile buildSessionId --teststage "Unit Tests" |
|
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 result files to be reported to the SeaLights server.
Running your tests - Unit Tests
...
Once done running the tests you upload the report files to the SeaLights server
Code Block |
---|
language | bash |
---|
theme | Eclipse |
---|
title | Sample command for a single file |
|
Unix:
./node_modules/.bin/slnodejs uploadReports --tokenfile /path/to/sltoken.txt --labid "<Lab ID>" --reportFile "/path/to/junit_report.xml"
Windows:
call .\node_modules\.bin\slnodejs uploadReports --tokenfile \path\to\sltoken.txt --labid "<Lab ID>" --reportFile "\path\to\junit_report.xml" |
Expand |
---|
title | Using Build Session ID |
---|
|
|
...
...
Unix:
./node_modules/.bin/slnodejs uploadReports --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --reportFile "/path/to/junit_report.xml"
Windows:
call .\node_modules\.bin\slnodejs uploadReports --tokenfile \path\to\sltoken.txt --buildsessionidfile buildSessionId --reportFile "\path\to\junit_report.xml" |
|
...
...
...
information on how to upload multiple files
Info |
---|
See 'Using Node.js Agents - Uploading multiple Command Reference - Upload report files' for information on how to upload multiple filesfull parameter details |
Ending the Test Stage
Finally notify the server that a test stage has ended.
Code Block |
---|
language | bash |
---|
theme | Eclipse |
---|
title | Sample command |
---|
|
Unix:
./node_modules/.bin/slnodejs end --tokenfile /path/to/sltoken.txt --labid "<Lab ID>"
Windows:
call .\node_modules\.bin\slnodejs end --tokenfile \path\to\sltoken.txt --labid "<Lab ID>" |
Expand |
---|
title | Using Build Session ID |
---|
|
|
...
| Unix:
./node_modules/.bin/slnodejs end --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId
Windows:
call .\node_modules\.bin\slnodejs end --tokenfile \path\to\sltoken.txt --buildsessionidfile buildSessionId |
|