-
Notifications
You must be signed in to change notification settings - Fork 117
/
Copy pathcoverage.ps1
43 lines (34 loc) · 1.99 KB
/
coverage.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
if(Test-Path -Path coverage)
{
Remove-Item .\coverage -recurse
}
dotnet restore
if(-Not (Test-Path -Path '\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe'))
{
nuget install -Verbosity quiet -OutputDirectory packages -Version 4.6.519 OpenCover
}
$openCover = '.\packages\OpenCover.4.6.519\tools\OpenCover.Console.exe'
if(-Not (Test-Path -Path '\packages\ReportGenerator.2.4.5.0\tools\ReportGenerator.exe'))
{
nuget install -Verbosity quiet -OutputDirectory packages -Version 2.4.5.0 ReportGenerator
}
$reportGenerator = '.\packages\ReportGenerator.2.4.5.0\tools\ReportGenerator.exe'
New-Item -path . -name coverage -itemtype directory
Copy-Item .\test\VisualRecognition.v3.IntegrationTests\VisualRecognitionTestData .\VisualRecognitionTestData -recurse
Copy-Item .\test\SpeechToText.v1.IntegrationTests\SpeechToTextTestData .\SpeechToTextTestData -recurse
Copy-Item .\test\Discovery.v1.IntegrationTests\DiscoveryTestData .\DiscoveryTestData -recurse
Copy-Item .\test\CompareComply.v1.IntegrationTests\CompareComplyTestData .\CompareComplyTestData -recurse
Copy-Item .\test\NaturalLanguageClassifier.v1.IntegrationTests\NaturalLanguageClassifierTestData .\NaturalLanguageClassifierTestData - recurse
ForEach ($folder in (Get-ChildItem -Path .\test -Directory))
{
$targetArgs = '-targetargs: test ' + $folder.FullName + ' -c Release -f netcoreapp2.0'
$filter = '-filter:+[IBM.Watson*]*-[*Tests*]*-[*Example*]*'
& $openCover '-target:C:\\Program Files\\dotnet\\dotnet.exe' $targetArgs '-register:user' $filter '-oldStyle' '-mergeoutput' '-hideskipped:File' '-searchdirs:$testdir\\bin\\release\\netcoreapp2.0' '-output:coverage\\coverage.xml'
}
& $reportGenerator -reports:coverage\coverage.xml -targetdir:coverage -verbosity:Error
Remove-Item .\VisualRecognitionTestData -recurse
Remove-Item .\SpeechToTextTestData -recurse
Remove-Item .\DiscoveryTestData -recurse
Remove-Item .\CompareComplyTestData -recurse
Remove-Item .\NaturalLanguageClassifierTestData -recurse
Remove-Item .\packages -recurse