Gathering coverage and test information using the SeaLights Node.jsTest Listener is done in a few steps:
See 'Generating an agent token' for instructions on how to generate a token
Starting the Test Listener
First the SeaLights server needs to be notified that a test stage is starting.
./node_modules/.bin/slnodejs start --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --teststage "Unit Tests"
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 result files to be reported to the SeaLights server.
Running your tests - Unit Tests
As the 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 result files to be reported to the SeaLights server.
The command is the same as you would use on the backend server. See 'Using Node.js Agents - Running backend server using SeaLights agent'
Upload report files
Once done running the tests you upload the report files to the SeaLights server
./node_modules/.bin/slnodejs uploadReports --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId --reportFile "/path/to/junit_report.xml"
See 'Node.js Command Reference - Upload report files' for full parameter details
See 'Using Node.js Agents - Uploading multiple files' for information on how to upload multiple files
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 that a test stage has ended.
./node_modules/.bin/slnodejs end --tokenfile /path/to/sltoken.txt --buildsessionidfile buildSessionId
See 'Node.js Command Reference - Ending a test stage' for full parameter details