As an Administrator, install and start the coverage collector service:
SL.DotNet.CoverageCollectorService.exe install --start |
Register our agent as a profiler in the IIS services (two specific services - WAS and W3SVC):
SL.DotNet.exe instrumentIIS --force |
Perform IIS reset:
iisreset /restart |
At the successful completion of this step, you will see a new entry appearing in the Cockpit > Agent Monitor for an entity called |
This installation step is updating the following keys in the Windows Registry
Those keys are updated with a Multi-String value called 'Environment' containing the following
In case of testing is executed from within a PowerShell script, the provided environment variables need to be defined using the Set-Item command to be accessible by the PowerShell-spawned processes.
|
During the time you want to run your tests and capture coverage, you can now start and stop the coverage collection of the SeaLights agent test listener
Before you start running your tests, you need to update the SeaLights Test Listener to start collecting coverage. You do so with the startCollectorServiceSession
command.
Since there could be multiple applications running on a single IIS server, it is important to make note of the Application Pool name that corresponds to the hosted application from which coverage will be collected. If you are unsure what your application pool name is for the processTag
parameter, refer to the expandable paragraph below (inside this article section) to identify it manually from your IIS Manager console.
SL.DotNet.exe startCollectorServiceSession --buildSessionIdFile buildSessionId.txt --labId my_labId --processName w3wp.exe --applicationPool DefaultAppPool --includeChildProcesses true |
For .NET Core processes, set --processName dotnet, as this is the name of the process on which .NET Core applications run. |
At the successful completion of this step, you will see additional new entries appearing in the Cockpit > Agent Monitor: the |
You can provide a star ('*') to the processTag
parameter in order to capture all the Application Pools at once.
This option can be used for troubleshooting or if your IIS server is dedicated to your application but is not necessarily defined as a best practice.
This command can be run on a remote machine (like the CI running the tests) while providing the host to start the session on using the parameter: --machine <IIS host>
You can provide a star ('*') to the processTag
parameter in order to capture all the Application Pools at once.
This option can be used for troubleshooting or if your IIS server is dedicated to your application but is not necessarily defined as a best practice.
This command can be run on a remote machine (like the CI running the tests) while providing the host to start the session on using the parameter: --machine <IIS host>
To retrieve the Application Pool name:
|
Now you can run any one of your tests that run against this IIS instance and capture coverage (Don’t forget to send a start and end command with the test stage name):
See 'SeaLights .NET agent - Running tests' for details of how to run tests |
SL.DotNet.exe stopCollectorServiceSession --stopAllSessions --processName w3wp.exe --processTag DefaultAppPool |
Note: This command can be run on a remote machine (like the CI running the tests) while providing the host to start the session on it, using the parameter: --machine <IIS host>
Sometimes when upgrading your agent version, you will need to uninstall the coverage collector service from your machine.
This can be done by running the following command:
SL.DotNet.CoverageCollectorService.exe uninstall |
See 'SeaLights .NET - command reference' for full parameter details |
# ===== SECTION TO UPDATE ==== $SL_TOKEN="123456789" #Prefer an Env variable from your Credentials Manager ### Env specific $SL_BSID_FILE="$SEALIGHTS_PATH\buildSessionId.txt" $SL_ENV_LABID="TestLabEnv@Automation" ### IIS Service specific $IIS_AppPool="DefaultAppPool" # ============================ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 $previousProgressPref=$global:ProgressPreference && $global:ProgressPreference = "SilentlyContinue" #Disable Progress bar to speed up download and expand archive command ### Install Agent and Token ### iwr -OutFile sealights-dotnet-agent.zip -UseBasicParsing -Uri https://agents.sealights.co/dotnetcore/latest/sealights-dotnet-agent-windows-self-contained.zip Expand-Archive .\sealights-dotnet-agent.zip -DestinationPath sl-dotnet-agent -Force Write-Output "[Sealights] .NetCore Agent version is: $(Get-Content .\sl-dotnet-agent\version.txt)" $global:ProgressPreference = $previousProgressPref #Restore progress bar Out-File -Input-Object $SL_TOKEN -NoNewline -Force ".\sl-dotnet-agent\sltoken.txt" ### Install SL Collector Service ### Invoke-Expression .\sl-dotnet-agent\SL.DotNet.CoverageCollectorService.exe install start ### Register SL service into IIS Invoke-Expression .\sl-dotnet-agent\SL.DotNet.exe instrumentIIS --force Invoke-Expression iisreset /restart # Starting session for specific app version Invoke-Expression .\sl-dotnet-agent\SL.DotNet.exe startCollectorServiceSession --buildSessionIdFile $SL_BSID_FILE --processName w3wp.exe --processTag $IIS_AppPool ` --includeChildProcesses true --logEnabled true --logAppendConsole true --labId $SL_ENV_LABID #### You can start your tests #### |