Capturing coverage from the app process
Capture runtime coverage by wrapping the target process or by using a background listener.
There are two ways to capture coverage from application or service processes with the SeaLights .NET Agent:
Run the process with the agent by using the run command.
Run the agent as a background listener.
Use the background listener flow when you cannot change the original startup command.
Running the process with run
To capture coverage from a single application, start it through the agent.
.\sl-dotnet-agent\SL.DotNet.exe run --buildSessionIdFile buildSessionId.txt --labId "<lab-id>" --includeNamespace "MyCompany.*" --instrumentationMode coverage --target "C:\MyApplication\App.exe" --workingDir "C:\WorkingDir" --targetArgs "-Flag1 true"./sl-dotnet-agent/SL.DotNet run --buildSessionIdFile buildSessionId.txt --labId "<lab-id>" --includeNamespace "MyCompany.*" --instrumentationMode coverage --target "/opt/my-app/MyApplication" --workingDir "/opt/my-app" --targetArgs "--flag1 true"Running the agent as a background listener
Use this flow when the application command must stay unchanged.
Start the background listener
Start the listener with a unique session key.
.\sl-dotnet-agent\SL.DotNet.exe startBackgroundTestListener --buildSessionIdFile buildSessionId.txt --labId "<lab-id>" --includeNamespace "MyCompany.*" --testListenerSessionKey SL_CovCollectorAgent./sl-dotnet-agent/SL.DotNet startBackgroundTestListener --buildSessionIdFile buildSessionId.txt --labId "<lab-id>" --includeNamespace "MyCompany.*" --testListenerSessionKey SL_CovCollectorAgentSet the agent as a profiler
Set these environment variables in the same session that starts the application.
Stop the background listener
When coverage collection is complete, stop the listener with the same session key.
Last updated
Was this helpful?

