SeaLights .NET Core agent - Running tests
If .NetCore FW is not installed on your testing machine(s), you can download and execute the “Self-contained” version of the Sealights agent. See https://sealights.atlassian.net/l/cp/yYJFTu8C for details.
In this case, replace in the commands below the beginning dotnet .\sl-dotnet-agent\SL.DotNet.dll
with .\sl-dotnet-agent\SL.DotNet.exe
for example (without dotnet
and with the agent executable directly)
Starting a test stage
Before running your tests, you must send the SeaLights server a start execution event with the test stage's name.
dotnet ./sl-dotnet-agent/SL.DotNet.dll startExecution --buildSessionIdFile buildSessionId.txt --testStage "Functional Tests"
Running your tests
Now you can run your tests while capturing coverage: https://sealights.atlassian.net/l/cp/w1EAHAFK
If you’re using a supported testing framework by Sealights (MSTest, NUnit, or XUnit), you can wrap the test process using the first option below; otherwise, upload the test results post-execution with the relevant command.
Running tests with MSTest, NUnit, or XUnit
When using MSTest, NUnit, or XUnit, you need to wrap the execution with the agent and the test listener will monitor the tests. When test execution is completed, test results will be uploaded automatically.
dotnet ./sl-dotnet-agent/SL.DotNet.dll run --tags mytag --instrumentationMode tests --buildSessionIdFile buildSessionId.txt --testStage "Functional Tests" --target "c:\tools\testrunner.exe" --workingDir $(pwd) --targetArgs "MyTest.dll --flag1 true --flag2 false"
Minimum System Requirements
MSTest Framework 1.4.0 (a.k.a. MSTest v2) and higher
NUnit 3.10.0 and higher
XUnit 2.3.0 and higher
VSTest.Console.exe 17.2 and higher
For “In-Process Testing” (like Unit Tests, Integration Tests and Components Tests), you will need to remove the flag --instrumentationMode tests
from the command above as the agent needs to capture coverage as well in this use case.
Running tests using CLI and uploading Test reports to Sealights
If you’re using a non-supported testing framework, execute your tests with your regular command/script and once the tests are finished, you can upload one or more report files. Supported formats are MSTest (TRX files), xUnit.Net, and NUnit (XML files)
dotnet ./sl-dotnet-agent/SL.DotNet.dll uploadTestReport --buildSessionIdFile buildSessionId.txt --testStage "Functional Tests" --report myReport.trx
Ending the test stage
Once you run your tests and upload the results, you must send the SeaLights server an end execution event with the test stage's name.