I have a Xamarin.UITest
project than contains UI tests for both Android and iOS. All tests inherit from a base class that looks like:
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public abstract class UITestBase
{
private readonly Platform _platform;
protected IApp App { get; private set; }
protected UITestBase(Platform platform)
{
_platform = platform;
}
[SetUp]
protected virtual async Task BeforeEachTest()
{
App = AppInitializer.StartApp(_platform);
await Task.CompletedTask;
}
}
So, all tests will run for both Android and iOS. Now, in an IDE such as Visual Studio or Rider, it easily lets me run tests only for a specific platform - while developing, I often only want to run tests for Android, for example.
How can I run tests only for a specific platform from the command line?
dotnet test
will run them for both platforms, and I can't see a way to filter using NUnit's TestFixture
attribute.
While I'd prefer a method using dotnet test
, it would also be OK to use the NUnit console runner, nunit3-console.exe
, but again I can't figure out how to filter using TestFixture
arguments.