testfx icon indicating copy to clipboard operation
testfx copied to clipboard

Test discovery broken on Android from 2.2.10+

Open MichaelRostgaard opened this issue 2 years ago • 10 comments

Describe the bug

We have a MAUI test runner that we deploy to both Android and iOS phones. It is using (MSTestX.UnitTestRunner 2.0.0-preview4). The project is configured with: <TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks> using 'android'">21.0.

When we include MSTest.TestFramework 2.2.9 in the referenced test projects that contains the tests, all tests are discovered correctly on BOTH iOS and Android

When we update MSTest.TestFramework to 2.2.10 or 3.x.y in the referenced test projects that contains the tests, all tests are discovered correctly ONLY on iOS, but fails on android.

Looking at the code in repo, I can see that there are significant changes in test discovery code from 2.2.9 -> 2.2.10 in MSTest.TestFramework. I hope you will try testing this on android.

Steps To Reproduce

  1. Create a test project targeting <TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
  • Add some MS tests that are data driven. We use the following test attributes: DataTestMethodAttribute, DataRowAttribute
  • reference MSTest.TestFramework 2.2.9
  1. create a maui testrunner application targeting <TargetFrameworks>net6.0-android;net6.0-ios</TargetFrameworks>
  • reference the above test project
  • reference MSTestX.UnitTestRunner 2.0.0-preview4
  1. Run on android phone and see discovery of tests work

  2. update the test proejct to reference MSTest.TestFramework 2.2.10

  3. Run on android phone and see discovery of tests no longer works (0 tests discovered)

Expected behavior

Test discovery works on android for .net60 test projects.

Actual behavior

0 tests are discovered on android.

MichaelRostgaard avatar Mar 06 '23 08:03 MichaelRostgaard

Hello @MichaelRostgaard, Can you give us a simple project with the issue reproducible?

engyebrahim avatar Mar 14 '23 10:03 engyebrahim

Hi,

I will provide you with a sample project as soon as possible (I may be able to prioritize this within a few weeks).

/Michael

From: Enji Eid @.> Sent: 14. marts 2023 11:35 To: microsoft/testfx @.> Cc: Michael Rostgaard (MHRT) @.>; Mention @.> Subject: Re: [microsoft/testfx] Test discovery broken on Android from 2.2.10+ (Issue #1617)

This message comes from outside of the corporate network. Please do not click links or open attachments unless you recognize the source of this e-mail and know the content is safe.

Hello @MichaelRostgaardhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMichaelRostgaard&data=05%7C01%7Cmhrt%40demant.com%7C42528344d0b246ea880e08db2477d57c%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638143869320590801%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QKbr%2FzOp2gECgB2HJ%2FgBfDq%2BWYwJ8%2Fs%2FGxpejiR%2BFwo%3D&reserved=0, Can you give us a simple project with the issue reproducible?

Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Ftestfx%2Fissues%2F1617%23issuecomment-1467836954&data=05%7C01%7Cmhrt%40demant.com%7C42528344d0b246ea880e08db2477d57c%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638143869320590801%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WbnB9xy3mOuseKUqOHGao6NSBTSIeU028pD8Se25KuE%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA6HKTOL5IRPNLBRHQ4YXBODW4BCXDANCNFSM6AAAAAAVQ2CBVA&data=05%7C01%7Cmhrt%40demant.com%7C42528344d0b246ea880e08db2477d57c%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638143869320590801%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=04FBcIvzgFh6SEbyLEyi2Pg%2BFQIl0MSzvm4vrN1ncS0%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.@.>>

MichaelRostgaard avatar Mar 14 '23 14:03 MichaelRostgaard

Sample embedded.

  1. Unpack the rar file-
  2. Open MSTestFrameworkErrorOnAndroid.sln in Visual studio (I use Visualstudio professional 2022 version 17.4.4)
  3. Set IntegrationTest.TestRunner.Net6 as startup project, and connect an android phone with debug permission enabled
  4. Compile and deploy to android phone. -> Verify 3 tests detected on phone (2 passed, 1 failed), stop app
  5. Edit IntegrationTest.Net6.Mobile.csproj -> change:

To

  1. Compile and deploy to android phone. -> Verify 0 tests detected on phone

/Michael

From: Enji Eid @.> Sent: 14. marts 2023 11:35 To: microsoft/testfx @.> Cc: Michael Rostgaard (MHRT) @.>; Mention @.> Subject: Re: [microsoft/testfx] Test discovery broken on Android from 2.2.10+ (Issue #1617)

This message comes from outside of the corporate network. Please do not click links or open attachments unless you recognize the source of this e-mail and know the content is safe.

Hello @MichaelRostgaardhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMichaelRostgaard&data=05%7C01%7Cmhrt%40demant.com%7C42528344d0b246ea880e08db2477d57c%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638143869320590801%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=QKbr%2FzOp2gECgB2HJ%2FgBfDq%2BWYwJ8%2Fs%2FGxpejiR%2BFwo%3D&reserved=0, Can you give us a simple project with the issue reproducible?

Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Ftestfx%2Fissues%2F1617%23issuecomment-1467836954&data=05%7C01%7Cmhrt%40demant.com%7C42528344d0b246ea880e08db2477d57c%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638143869320590801%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=WbnB9xy3mOuseKUqOHGao6NSBTSIeU028pD8Se25KuE%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA6HKTOL5IRPNLBRHQ4YXBODW4BCXDANCNFSM6AAAAAAVQ2CBVA&data=05%7C01%7Cmhrt%40demant.com%7C42528344d0b246ea880e08db2477d57c%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638143869320590801%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=04FBcIvzgFh6SEbyLEyi2Pg%2BFQIl0MSzvm4vrN1ncS0%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.@.>>

MichaelRostgaard avatar Mar 16 '23 12:03 MichaelRostgaard

Hi @MichaelRostgaard,

I think you forget to attach the rar file.

and does the issue happen with you in latest version mstest3.0.2?

engyebrahim avatar Mar 17 '23 12:03 engyebrahim

Sample was included... maybe the proof.rar file was removed by email service?

See image of my outbox @.***

From: Enji Eid @.@.> Sent: 17. marts 2023 13:02 To: microsoft/testfx @.> Cc: Michael Rostgaard (MHRT) @.>; Mention @.***> Subject: Re: [microsoft/testfx] Test discovery broken on Android from 2.2.10+ (Issue #1617)

This message comes from outside of the corporate network. Please do not click links or open attachments unless you recognize the source of this e-mail and know the content is safe.

Hi @MichaelRostgaardhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMichaelRostgaard&data=05%7C01%7Cmhrt%40demant.com%7C613edde0ecb24e8d4e8708db26df7522%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638146513405484209%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=84jeisjhbTV1P4eLJciuduma4CewJDrfZQbVXs7G6CE%3D&reserved=0,

I think you forget to attach the rar file.

and does the issue happen with you in latest version mstest3.0.2?

Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Ftestfx%2Fissues%2F1617%23issuecomment-1473728292&data=05%7C01%7Cmhrt%40demant.com%7C613edde0ecb24e8d4e8708db26df7522%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638146513405484209%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=da65GI5jNli%2B%2FgSIHd1wqODQ9k8d02Izy7s2Ytf8jK8%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA6HKTONYNWAOWMY4TD3GNVTW4RHETANCNFSM6AAAAAAVQ2CBVA&data=05%7C01%7Cmhrt%40demant.com%7C613edde0ecb24e8d4e8708db26df7522%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638146513405484209%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=UxFe58LGHtyzkhPHH6Emr0HqYpJQf34T%2FAXJpGRldAQ%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.@.>>

MichaelRostgaard avatar Mar 17 '23 13:03 MichaelRostgaard

and does the issue happen with you in latest version mstest3.0.2? Yes

From: Enji Eid @.> Sent: 17. marts 2023 13:02 To: microsoft/testfx @.> Cc: Michael Rostgaard (MHRT) @.>; Mention @.> Subject: Re: [microsoft/testfx] Test discovery broken on Android from 2.2.10+ (Issue #1617)

This message comes from outside of the corporate network. Please do not click links or open attachments unless you recognize the source of this e-mail and know the content is safe.

Hi @MichaelRostgaardhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMichaelRostgaard&data=05%7C01%7Cmhrt%40demant.com%7C613edde0ecb24e8d4e8708db26df7522%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638146513405484209%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=84jeisjhbTV1P4eLJciuduma4CewJDrfZQbVXs7G6CE%3D&reserved=0,

I think you forget to attach the rar file.

and does the issue happen with you in latest version mstest3.0.2?

Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Ftestfx%2Fissues%2F1617%23issuecomment-1473728292&data=05%7C01%7Cmhrt%40demant.com%7C613edde0ecb24e8d4e8708db26df7522%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638146513405484209%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=da65GI5jNli%2B%2FgSIHd1wqODQ9k8d02Izy7s2Ytf8jK8%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FA6HKTONYNWAOWMY4TD3GNVTW4RHETANCNFSM6AAAAAAVQ2CBVA&data=05%7C01%7Cmhrt%40demant.com%7C613edde0ecb24e8d4e8708db26df7522%7C9bf8c7a8e00849a79e43ab76976c4bf8%7C0%7C0%7C638146513405484209%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=UxFe58LGHtyzkhPHH6Emr0HqYpJQf34T%2FAXJpGRldAQ%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.@.>>

MichaelRostgaard avatar Mar 17 '23 13:03 MichaelRostgaard

@MichaelRostgaard may be can you add it as a comment in the issue on github please

engyebrahim avatar Mar 23 '23 11:03 engyebrahim

Sample solution added. Proof.zip

Cheers, Michael

MichaelRostgaard avatar Mar 24 '23 07:03 MichaelRostgaard

Hi @MichaelRostgaard,

I cannot compile the sample project you have provided. Looking at my installed workloads/components, I cannot see something missing, could you double check this is a runnable sample?

Also, looking at the runner, it seems to be something provided by someone else so it's possible this runner is not compatible with newer version of MSTest. This is not something we are testing or supporting so I would suggest to contact the maintainer.

Evangelink avatar Apr 14 '23 09:04 Evangelink

I downloaded the sample I provided, unpacked it to a new folder. deleted my nuget packages folder (C:\Users[myusername].nuget\packages) to make sure all packages would be restored correct unpon compilation. Opened the solution in Visual studio 17.4.4. Compiled it and ran the project successfully on my phone.

So - yearh - I think the solution is valid.

/Michael

MichaelRostgaard avatar Apr 17 '23 07:04 MichaelRostgaard