appveyor / ci

AppVeyor community support repository
https://www.appveyor.com
344 stars 66 forks source link

Appveyor logger not found #1990

Open AndersAbel opened 6 years ago

AndersAbel commented 6 years ago

In my builds I've started to get a message that the Appveyor logger can't be found by the vstest.console runner:

vstest.console.exe : Could not find a test logger with URI or FriendlyName 'appveyor'.

Build history shows that the last successful build was on December 5th and the first broken was on December 13th.

I've not done any updates to the settings during this time. The configuration for this build is in the web interface, relevant parts (ping me if more is needed):

Install script:

appveyor downloadfile https://dist.nuget.org/win-x86-commandline/v4.3.0/nuget.exe

set path=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow;%path%
copy "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions\appveyor.*" "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions" /y

Test Script:

vstest.console.exe /logger:Appveyor /Enablecodecoverage /settings:codecoverage.runsettings .\Tests\Tests\bin\Debug\Tests.dll .\Tests\Mvc.Tests\bin\Debug\Mvc.Tests.dll .\Tests\Owin.Tests\bin\Debug\Owin.Tests.dll .\Tests\HttpModule.Tests\bin\Debug\HttpModule.Tests.dll .\Tests\AspNetCore2.Tests\bin\Debug\AspNetCore2.Tests.dll

$result = $LASTEXITCODE

$coverageFilePath = Resolve-Path -path "TestResults\*\*.coverage"

$coverageFilePath = $coverageFilePath.ToString()

if(Test-Path .\coverage.coveragexml){ rm .\coverage.coveragexml }

& "C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Team Tools\Dynamic Code Coverage Tools\CodeCoverage.exe" analyze /output:coverage.coveragexml "$coverageFilePath"

$coveralls = "packages/coveralls.net.0.7.0-beta0001/tools/csmacnz.coveralls.exe"

& $coveralls --dynamiccodecoverage -i coverage.coveragexml --useRelativePaths

if($result -ne 0){
  exit $result
}

This is the cause of Sustainsys/Saml2#872

IlyaFinkelshteyn commented 6 years ago

@AndersAbel Just remove all this workaround scripts (your Install sscript) for copying appveyor logger and setting location to vstest.console and rely on vstest.console which is available in PATH. Apparently, starting from VS 2017 15.5.1 they changed the location of vstest.console with extensions to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\Extensions\TestPlatform.

Side note: nuget download is not needed too, it is up to date on build worker image.

AndersAbel commented 6 years ago

Thank you, removing the custom install script fixed the issue.

AndersAbel commented 6 years ago

Well, it didn't fix the problem completely, as the vstest.console.exe in the path doesn't handle code coverage. Looking into it.

AndersAbel commented 6 years ago

Looks like I still need to use the test runner from TestAgent to be able to use code coverage. Can't get it to work with /logger:Appveyor though. When I run the same commands from an RDP session it works, so I really don't know where to look.

For now I just excluded the /logger:AppVeyor switch. The tests tab on the build is empty because of that, but at least the build works and runs the tests.

FeodorFitsner commented 6 years ago

Could you please provide the commands you run in RDP session and that worked?

AndersAbel commented 6 years ago

Coming back to look at this (sorry it took so long time) but can't find the commands that worked.

The problem persists: I need to run a version of vstest.console.exe that supports the /EnableCodeCoverage switch. Using the vstest.console.exe in path results in the error Data collector 'Code Coverage' message: Cannot find CodeCoverage.exe. .

Using an explicit path to 'C:\Program Files (x86)\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\Extensions\TestPlatform\vstest.console.exe' makes the /EnableCodeCoverage switch work, but then /logger/AppVeyor won't work.

I tried copying the Appveyor.MsTestLogger.VS2017.dll to C:\Tools and used the /TestAdapterPath:C:/Tools switch, but still no luck.

IlyaFinkelshteyn commented 6 years ago

Right, we see the same. Here is little bit ugly workaround we can propose right now:

test_script:
- set path=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow;%path%
- copy "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions\appveyor.*" "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\TestAgent\Common7\IDE\CommonExtensions\Microsoft\TestWindow\Extensions" /y
- vstest.console /EnableCodeCoverage "C:\projects\vscodecoverage\VsCodeCoverageTests\bin\Debug\VsCodeCoverageTests.dll" /logger:trx;LogFileName=results.trx
- ps: $wc = New-Object 'System.Net.WebClient'
- ps: $wc.UploadFile("https://ci.appveyor.com/api/testresults/mstest/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\TestResults\results.trx))