Closed DerGary closed 6 years ago
@MireilleHanna Can you please share below info?
UWP tests required to be run under admin account.
@nigurr I already wrote that I'm using private Build Agents:
Environment
Server: VSTS VSTS Account Name: dev-fg Team Project Name: App Development Build Definition Name: Reporting App UWP Pull Request Build ID: 2985 Build Number: 05203
Agent: Private OS: Windows 10 Build 15063.483 Agent version: 2.129.1
VSTest Version: 2.*
I never needed to run vstest.console.exe as admin before and until I updated Visual studio on the build agent everything run just fine. I really think that it has to do with the new version of vstest.console.exe from the TestPlatform folder. Like I already mentioned here:
When I try the vstest from the TestWindow folder locally everything works fine. When I try the vstest from the TestPlatform it fails with this error. I also tried specifying the path to the vstest.console.exe in the VSTest build task which did not work. Using a Command Line Build Task and opening vstest.console.exe works.
Can you please mention the full path from which location it's working and from which location it's not working?
I also already did this in my original post:
It seems like it uses the vstest.console.exe from the folder C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform instead of the folder C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
working: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
not working: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform\
@DerGary we debugged this issue, & the reason it is failing is because in 15.5(2017 update 5) we brought our new Testplatform(C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform) and made it as default for all scenarios except UWP
The reason it is passing in CLI from "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\" is because our old testplatform contains an explicit check saying that if input is ".appx" do not redirect to newer testplatform. However in VSTS Test task, we create a response file as input to vstest.console, which does not end with ".appx", hence the request for UWP also goes to Tpv2 which fails to run it.
In 15.6 we have also made UWP to via our newer Testplatform, but the input for CLI has changed from ".appx" to ".appxrecipe", & also you need to pass the Framework switch. The support for ".appx" should come by 15.7
Current E.g. command vstest.consol.exe
To run your UWP tests in CI/CD
This should work for you after above steps, please let us know if you still run into error.
Thanks I will try your suggestion next week. Unfortunately this week I do not have time for it.
@mayankbansal018 Using VS 15.6.1 with these settings does work:
What I don't understand is it says it's using the TestWindow Version of vstest but it is not using this version because it's using the TestPlatform Version which can be seen by the version string (15.6.0):
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" @C:\Users\BUILDA~1\AppData\Local\Temp\e1233191-25f7-11e8-8f0b-c7c2802b7014.txt
Microsoft (R) Test Execution Command Line Tool Version 15.6.0
Copyright (c) Microsoft Corporation. All rights reserved.
vstest.console.exe
"C:\Tools\agent\_work\3\s\NUnitTestAPp\UnitTestProject1\bin\x86\Debug\UnitTestProject1.build.appxrecipe"
/logger:"trx"
/TestAdapterPath:"C:\Tools\agent\_work\3\s"
/Framework:FrameworkUap10
Starting test execution, please wait...
And if I try to supply a path to the TestWindow vstest it does not use the TestWindow version:
and therefore fails with this error:
System.ArgumentException: File 'C:\Tools\agent\_work\3\s\NUnitTestAPp\UnitTestProject1\AppPackages\UnitTestProject1_1.0.0.0_x86_Debug_Test\UnitTestProject1_1.0.0.0_x86_Debug.appx' has an invalid extension, it must be '.appxrecipe'.
For now the suggested workaround does do the trick but I think when I supply a path to a specific exe it has to use this exe and not a totally different one from a different folder. This must have to do with the VSTest Build Task because it does not do this on the command line.
@DerGary can provide the full build logs with system.debug=true. I will if and why a different vstest.console.exe is being used when you explicitly provide the path.
@DerGary
2018-03-19T10:28:47.2598044Z [command]"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" @C:\Users\BUILDA~1\AppData\Local\Temp\4e8146b1-2b60-11e8-b0a7-43737c48c411.txt
from the logs it is clear that it is using the vstest.console.exe from the path you specified.
Since you are building with Vs 2017 update 6, tpv2 (newer testplatorm) dependencies get added to the appx itself, which cannot work with tpv1 (older testplatform) even though you pointed to its path.
We understand that this is a change in behavior for users currently, & we plan to bring the support of running tests via ".appx" in 15.7 RTM
Currently the way to go ahead right now is to change the extension to .appxrecipe
@ShreyasRmsft
it is NOT using the vstest.console.exe from the path I specified. If I run the command on the CLI I do NOT get the error that is shown in the log files and it reports a different version number.
Hi @DerGary after looking into this a little more this is the conclusion:
The correct vstest.console.exe is getting invoked
But there is a redirect built into tpv1 (old vstest.console.exe, the one you are pointing to)
This redirect almost always kicks in starting from VS 15.6
In a few exceptional cases (mostly cases where tpv1 supports something and tpv2 does not) the redirect does not happen
One of the cases is when you invoke vstest.console.exe with an .appx input file
But when the vstest task invokes vstest.console.exe it does so via response file (the reason for this if you must know is because for cmd line args there is a character limit and there are instances in the task when this limit gets exceeded). And when vstest.console.exe gets invoked with a response file it does not perform those checks that prevent the redirection.
This is indeed a bug/breaking change from our end and will indeed be fixed in 15.7 RTM.
For now you can either use an older version of VS or go ahead by changing the extension to .appxrecipe
The issue is not with the task but with the way vstest.console.exe handles redirects and also the lack of support for .appx files in tpv2 but this will be fixed.
Sorry for prematurely closing the issue. Lemme know if you need any more info or if I can close the issue now.
Thanks
@ShreyasRmsft Thank you that explains this strange behavior. I already started to change all our build definitions to use .appxrecipe. I reckon .appxrecipe will stay supported after support for .appx files is added to tpv2? Yes you can close this issue now.
Yes .appxrecipe will be supported after .appx is added to tpv2. Tagging @mayankbansal018 to confirm this
@DerGary , yes the support for ".appxrecipe" will continue to remain, but it seems reasonable to assume that users would want to use ".appx" for CLI, as it is self contained.
ok thank you @mayankbansal018 @ShreyasRmsft you can close this issue Greetings
Environment
Server: VSTS VSTS Account Name: dev-fg Team Project Name: App Development Build Definition Name: Reporting App UWP Pull Request Build ID: 2985 Build Number: 05203
Agent: Private OS: Windows 10 Build 15063.483 Agent version: 2.129.1
VSTest Version: 2.*
Issue Description
After updating Visual Studio from 15.3.x to 15.5.x the VSTest Build Task for testing UWP Unit Test Apps is always failing with an error message. It seems like it uses the vstest.console.exe from the folder
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\TestPlatform
instead of the folderC:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TestWindow\
. When I try the vstest from theTestWindow
folder locally everything works fine. When I try the vstest from theTestPlatform
it fails with this error. I also tried specifying the path to the vstest.console.exe in the VSTest build task which did not work. Using a Command Line Build Task and opening vstest.console.exe works.Settings:
Error logs
I uploaded the complete log of the VSTest build task to gist: https://gist.github.com/DerGary/6939cb6ac36e0e53a5edb9d1e053d074
Some Links to similar Problems: Link1 Link2 Link3