Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'dotnet test' to run .NET unit tests on Android #26930

Open
melanchall opened this issue Aug 2, 2022 · 2 comments
Open

Use 'dotnet test' to run .NET unit tests on Android #26930

melanchall opened this issue Aug 2, 2022 · 2 comments

Comments

@melanchall
Copy link

I'm developing a library. And I have a test project (jn NUnit) within the library solution. I successfully run my unit tests on desktop platforms (Windows, macOS, Ubuntu) via dotnet test on MS-hosted agents within Azure Pipelines.

.NET 6 states it supports mobile platforms. So I want to run my unit tests on them. First of all, on Android. But I absolutely don't understand where to start from, how setup environment during CI on Azure Pipelines and so on.

Is it possible? Maybe there are some guides or official articles how it can be done.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-DotNet Test untriaged Request triage from a team member labels Aug 2, 2022
@evgenyvalavin
Copy link

+1
Seems like NUnit needs a test adapter for Android

@nohwnd
Copy link
Member

nohwnd commented Oct 24, 2022

I am not an expert on Android, but the execution is probably running via Mono, you would need a way to deploy to the remote device (UWP for example does that via Visual Studio deployer services), and it extends vstest (https://github.com/microsoft/vstest) which powers dotnet test by using ITestRuntimeProvider extension point. This extension point deploys and then starts the testhost (the executable that runs tests on the remote side).

I assume for your need you would need s testhost that can run on android, maybe the testhost we ship with vstest could run there as well, but more likely you need a specialize less capable testhost that is okay running in the restricted environment of android device.

And from there you just send back messages over you chosen transport. Test platform now supports just Json over TCP, but you could stand-up a proxy in the middle that forwards your messages however you like.

@nohwnd nohwnd removed the untriaged Request triage from a team member label Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants