PowerShell/test/tools/CodeCoverageAutomation
Aditya Patwardhan 5cd0e85d12 Fixed passing common test modules path to unelevated Powershell (#4313)
- Fixed the way common test modules are passed to elevated and unelevated powershell. Earlier, only elevated powershell got those through inheritance as a child process. Now we add them to the startup of the process.
- Fixed error reported by PSScriptAnalyzer about ? / Where-Object
- Converted all the parameters passed to powershell.exe to be a base64 encoded string to avoid complications with quotes.
- Removed code which was updated $env:PSModulePath as we do it in startup args for powershell process instead. 
- Added a way to disable -Quiet for Pester.
- Opencover.console.exe gets confused when the base64 encoded parameter is given with '&' invoke.
Writing to a ps1 file and invoking the script works around the issue.
This also makes it similar to how unelevated tests are invoked.
2017-08-04 09:16:17 -07:00
..
README.md Code coverage automation script (#2918) 2017-01-05 11:13:22 -08:00
Start-CodeCoverageRun.ps1 Fixed passing common test modules path to unelevated Powershell (#4313) 2017-08-04 09:16:17 -07:00

Code Coverage Automation

The script Start-CodeCoverageRun.ps1 automates the execution of tests and uploading the results to Coveralls.io.

The script is self contained and can be executed on any Windows system which supports Powershell v5.0 or above. It has not been tested on Powershell v6.0.

Execution

The virtual machine hosting the script has a scheduled task to start the tests at 5 am PDT.

The script follows the steps below:

  1. Download the code coverage binaries package from AppVeyor nightly builds artifacts (CodeCoverage.zip).
  2. Download the OpenCover powershell module from AppVeyor nightly builds artifacts. (OpenCover.zip)
  3. Download the tests from AppVeyor nightly builds artifacts (tests.zip)
  4. Download Coveralls.net from 'https://github.com/csMACnz/coveralls.net/releases/download/0.7.0/coveralls.net.0.7.0.nupkg'
  5. Invoke 'Install-OpenCover' to install OpenCover toolset.
  6. Invoke 'Invoke-OpenCover' to execute tests.
  7. Invoke powershell to get the git commit ID of the downloaded daily build package.
  8. Using the commit ID get committer info like, message, author and email using the github REST API.
  9. Invoke 'csmacnz.Coveralls.exe' to upload the coverage results to Coveralls.net

The uploaded coverage data can be viewed at: https://coveralls.io/github/PowerShell/PowerShell