pull file
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
Close Stale Issues / close_stale_issues (push) Has been cancelled
repo-sync / repo-sync (push) Has been cancelled
auto-deploy-tencent-scf / pre-check (push) Has been cancelled
auto-deploy-tencent-scf / deploy serverless (push) Has been cancelled
Some checks failed
CodeQL / Analyze (csharp) (push) Has been cancelled
Close Stale Issues / close_stale_issues (push) Has been cancelled
repo-sync / repo-sync (push) Has been cancelled
auto-deploy-tencent-scf / pre-check (push) Has been cancelled
auto-deploy-tencent-scf / deploy serverless (push) Has been cancelled
This commit is contained in:
19
scripts/ut.ps1
Normal file
19
scripts/ut.ps1
Normal file
@@ -0,0 +1,19 @@
|
||||
Set-Location ..
|
||||
|
||||
# 安装 ReportGenerator 工具
|
||||
Write-Output "Installing ReportGenerator tool..."
|
||||
dotnet tool install -g dotnet-reportgenerator-globaltool
|
||||
|
||||
# 运行单元测试并生成覆盖率报告
|
||||
Write-Output "Running unit tests and generating coverage report..."
|
||||
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=./TestResults/coverage.opencover.xml
|
||||
|
||||
# 生成html报告
|
||||
$coverageFiles = Get-ChildItem -Path . -Recurse -Filter "coverage.cobertura.xml"
|
||||
$coverageFiles | ForEach-Object { Write-Output $_.FullName }
|
||||
$reportPaths = ($coverageFiles | ForEach-Object { $_.FullName }) -join ";"
|
||||
reportgenerator "-reports:$reportPaths" "-targetdir:coveragereport" -reporttypes:Html
|
||||
|
||||
# 检查生成的覆盖率报告文件是否存在
|
||||
Write-Output "Coverage report generated successfully."
|
||||
Start-Process "coveragereport/index.htm"
|
||||
Reference in New Issue
Block a user