testfx icon indicating copy to clipboard operation
testfx copied to clipboard

No 'AddResultFile' implementation in TestContext on UWP test project

Open dotMorten opened this issue 5 years ago • 2 comments

Description

UWP doesn't have the option to add a result file. I get that the storage APIs can be limited here and are sandboxed, but the test runner is more than capable of getting the files from within the application and app data folder, so this really shouldn't be an issue. It's also possible to allow UWP apps to read/write folders outside the application folder by giving the the user ALL APPLICATION PACKAGES read/write access to said folder, so all of this should be possible to use provided a proper setup in UWP - as an alternative we can just create our own post-build scripts to go pick up the files, but without the ability to add the test result file entry we wouldn't know which file belongs to which test.

Steps to reproduce

Create UWP Test project. Inspect TestContext and the missing APIs

image

Expected behavior

Ability to add result files to the generated TRX report.

Actual behavior

What is the behavior observed?

Environment

VS2019.7

dotMorten avatar Aug 11 '20 17:08 dotMorten

@MSLukeWest Luke are you still working on the UWP runner, should this be possible?

nohwnd avatar Jun 23 '21 11:06 nohwnd

@nohwnd It looks like that wouldn't be done in the UWP provider, it would be done here in https://github.com/microsoft/testfx/tree/main/src/Adapter/PlatformServices.Universal. It looks like right now it's context implementation comes from https://github.com/microsoft/testfx/blob/main/src/Adapter/PlatformServices.Shared/netstandard1.0/Services/ns10TestContextImplementation.cs

MSLukeWest avatar Jun 24 '21 00:06 MSLukeWest

I don't see any constraint on MSTest side to implement this feature but I am not sure if it would be handled by the specific Test Platform of UWP. My understanding is that there is a specific "freezed" version of TP for UWP.

@MSLukeWest could you confirm that if this is added to the UnitTestResult for UWP, it would be handled correctly on TP side?

Evangelink avatar Nov 30 '22 17:11 Evangelink

@Evangelink For the most part UWP will run against the latest test platform binaries, so I think this would work. If you tell me the name of the assembly that would contain the fix I can double check this for you.

MSLukeWest avatar Nov 30 '22 18:11 MSLukeWest

@engyebrahim Could you please create a PR for this issue and then provide the MSTest package to @MSLukeWest so he can confirm that's working fine?

@MSLukeWest Is it possible to use SDK style for UWP test projects? We are really lacking UWP integration test project on MSTest and I'd like to add some but it seems I didn't manage to make them sdk-style (which seems to be prerequisite for arcade - I need to double check with arcade's team).

Evangelink avatar Jan 17 '23 08:01 Evangelink

@Evangelink Unfortunately no, there's no SDK style support for UWP projects.

MSLukeWest avatar Jan 17 '23 20:01 MSLukeWest