Table of Contents | ||
---|---|---|
|
...
The Background Listener option allows you to capture coverage from any application without changing the command you use to run it but requires more steps than testListener option.
Prerequisites
Microsoft run-time components
...
Running the process with the SeaLights .NET agent using the testListener option
To capture coverage from a single application, you can run it with the SeaLights .NET agent, which will capture coverage from it when it runs, and tests are run against it.
Code Block | ||
---|---|---|
| ||
SL.DotNet.exe testListener --buildSessionIdFile buildSessionId.txt --labId my_labId --target c:\MyApplication\App.exe --workingDir c:\WorkingDir --targetArgs "-Flag1 true MyTest.dll" |
The sample command above is replacing the regular command used to startup the application captured: c:\MyApplication\App.exe -Flag1 true MyTest.dll
executed from the c:\WorkingDir
directory
...
Running the SeaLights .NET agent as a background listener
To capture coverage from any application without changing the command you run, you can execute the SeaLights .NET agent as a background process, which will capture coverage from any process with the SeaLights .NET agent attached as a profiler.
The expected steps are then:
Start the Sealights .NET background listener
Set up the environment variable to enable the Sealights .NET Profiler
Start your application
Starting the SeaLights .NET agent background listener
To run the background process, you use the startBackgroundTestListener flag and provide a unique session key:
Code Block | ||
---|---|---|
| ||
SL.DotNet.exe startBackgroundTestListener --buildSessionIdFile buildSessionId.txt --labId my_labId --testListenerSessionKey SL_CovCollectorAgent |
...
Now, you need to run (all) your processes - i.e., including your application - with the SeaLights .NET agent defined as a profiler before starting your application.
This is done by setting the following environment variables in the shell used to run your process:
Cor_Profiler set to
{01CA2C22-DC03-4FF5-8350-59E32A3536BA}
Cor_Enable_Profiling set to 1
Cor_Profiler_Path_32 set to the path of SL.DotNet.ProfilerLib_x86.dll
Cor_Profiler_Path_64 set to the path of SL.DotNet.ProfilerLib_x64.dll
SL_CollectorId set to the same session key provided to the
startBackgroundTestListener
command
...