[WIP] Dogfood dotnet test for device tests#11224
Draft
jonathanpeppers wants to merge 5 commits intomainfrom
Draft
[WIP] Dogfood dotnet test for device tests#11224jonathanpeppers wants to merge 5 commits intomainfrom
dotnet test for device tests#11224jonathanpeppers wants to merge 5 commits intomainfrom
Conversation
…form (MTP) - Revamp `TestRunner.Core/TestInstrumentation.cs` to use MTP + NUnit (following the androidtest template pattern with `AddNUnit()`) - Delete `TestRunner.NUnit/`, `TestRunner.xUnit/`, `Xamarin.Android.NUnitLite/`, `src-ThirdParty/NUnitLite/` - Update `Mono.Android.NET-Tests` and `JcwGen-Tests` to use new `TestInstrumentation` base class with stock NUnit 4.3.2 - Update CI YAML to use `dotnet test --no-build` instead of `-t:RunTestApp` - Update `NUnitReferences.projitems` to NUnit 4.3.2 + adapter 5.0.0 - Clean up `Directory.Build.props`, installer targets, and solution files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The NUnit 4.x upgrade broke all host-side test projects because NUnit 4 removed classic assert APIs (Assert.IsTrue, FileAssert, etc.). Only NUnit3TestAdapter 5.0.0 is needed (for AddNUnit() MTP support) in the device test projects. NUnit itself stays at 3.13.3, and the shared NUnitReferences.projitems is restored to its original versions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The publish step was skipped because testResultsFiles was empty. Add --logger trx and --results-directory to produce TRX files, and use a deterministic file path for PublishTestResults@2. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Restore XA4313 AndroidError for Xamarin.Android.NUnitLite in Common.targets - Restore NUnitLite in XA4313 test Values in BuildTest.cs - Restore GenerateAssemblyInfo=false and AssemblyInfo.cs in TestRunner.Core - Delete unused MainActivities and Main.axml layout - Move MyFragment to its own file (still needed by FragmentFixup tests) - Fix TRX publishing: copy device-pulled TRX to expected path instead of relying on --logger trx which doesn't work with Microsoft.Android.Run Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
31e7d49 to
7b8a944
Compare
Comment on lines
-33
to
-89
| ExcludedTestNames = new [] { | ||
| // net.dot.jni.test.CallVirtualFromConstructorDerived Java class not in APK | ||
| "Java.InteropTests.InvokeVirtualFromConstructorTests", | ||
|
|
||
| // net.dot.jni.internal.JavaProxyObject Java class not in APK — fixture setup fails (16 tests) | ||
| "Java.InteropTests.JavaObjectArray_object_ContractTest", | ||
|
|
||
| // net.dot.jni.internal.JavaProxyObject Java class not in APK | ||
| "Java.InteropTests.JniValueMarshaler_object_ContractTests.JniValueMarshalerContractTests`1.CreateArgumentState", | ||
| "Java.InteropTests.JniValueMarshaler_object_ContractTests.JniValueMarshalerContractTests`1.CreateGenericArgumentState", | ||
| "Java.InteropTests.JniValueMarshaler_object_ContractTests.JniValueMarshalerContractTests`1.CreateGenericObjectReferenceArgumentState", | ||
| "Java.InteropTests.JniValueMarshaler_object_ContractTests.JniValueMarshalerContractTests`1.CreateGenericValue", | ||
| "Java.InteropTests.JniValueMarshaler_object_ContractTests.JniValueMarshalerContractTests`1.CreateObjectReferenceArgumentState", | ||
| "Java.InteropTests.JniValueMarshaler_object_ContractTests.JniValueMarshalerContractTests`1.CreateValue", | ||
| "Java.InteropTests.JniValueMarshaler_object_ContractTests.SpecificTypesAreUsed", | ||
|
|
||
| // No generated JavaPeerProxy for java/lang/Object with IJavaPeerable target type | ||
| "Java.InteropTests.JniValueMarshaler_IJavaPeerable_ContractTests.JniValueMarshalerContractTests`1.CreateGenericValue", | ||
| "Java.InteropTests.JniValueMarshaler_IJavaPeerable_ContractTests.JniValueMarshalerContractTests`1.CreateValue", | ||
|
|
||
| // net.dot.jni.internal.JavaProxyThrowable — proxy throwable creation fails | ||
| "Java.InteropTests.JavaExceptionTests.InnerExceptionIsNotAProxy", | ||
|
|
||
| // IJavaInterfaceInvoker ctor trimmed / missing JavaPeerProxy for test types | ||
| "Java.InteropTests.JavaPeerableExtensionsTests.JavaAs", | ||
| "Java.InteropTests.JavaPeerableExtensionsTests.JavaAs_Exceptions", | ||
| "Java.InteropTests.JavaPeerableExtensionsTests.JavaAs_InstanceThatDoesNotImplementInterfaceReturnsNull", | ||
|
|
||
| // JNI method remapping not supported in trimmable typemap | ||
| "Java.InteropTests.JniPeerMembersTests.ReplaceInstanceMethodName", | ||
| "Java.InteropTests.JniPeerMembersTests.ReplaceInstanceMethodWithStaticMethod", | ||
| "Java.InteropTests.JniPeerMembersTests.ReplacementTypeUsedForMethodLookup", | ||
| "Java.InteropTests.JniPeerMembersTests.ReplaceStaticMethodName", | ||
|
|
||
| // net.dot.jni.test.GenericHolder Java class not in APK | ||
| "Java.InteropTests.JniTypeManagerTests.CannotCreateGenericHolderFromJava", | ||
|
|
||
| // JniPrimitiveArrayInfo lookup fails for JavaBooleanArray | ||
| "Java.InteropTests.JniTypeManagerTests.GetType", | ||
|
|
||
| // net.dot.jni.test.GetThis — cannot register native members | ||
| "Java.InteropTests.JavaObjectTest.DisposeAccessesThis", | ||
|
|
||
| // NotSupportedException instead of InvalidCastException — no generated JavaPeerProxy | ||
| "Java.InteropTests.JavaObjectExtensionsTests.JavaCast_BadInterfaceCast", | ||
| "Java.InteropTests.JavaObjectExtensionsTests.JavaCast_BaseToGenericWrapper", | ||
| "Java.InteropTests.JavaObjectExtensionsTests.JavaCast_CheckForManagedSubclasses", | ||
| "Java.InteropTests.JavaObjectExtensionsTests.JavaCast_InvalidTypeCastThrows", | ||
|
|
||
| // Open generic type handling differs from non-trimmable | ||
| "Java.InteropTests.JnienvTest.NewOpenGenericTypeThrows", | ||
|
|
||
| // Throwable subclass registration | ||
| "Java.InteropTests.JnienvTest.ActivatedDirectThrowableSubclassesShouldBeRegistered", | ||
|
|
||
| // Instance identity after JNI round-trip | ||
| "Java.LangTests.ObjectTest.JnienvCreateInstance_RegistersMultipleInstances", |
Member
There was a problem hiding this comment.
This test exclusion mechanism was very handy for skipping tests from the Java.Interop submodule which are not in this repo and so applying attributes to the individual tests is not practical. What would the new way of listing these tests as skipped be?
Member
Author
|
With MTP, test filtering works via command-line args passed to I've now added this support to
The old
Everything gets translated to a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrate device test infrastructure from legacy NUnitLite stack to
dotnet testwith Microsoft Testing Platform (MTP), following the pattern established in commit 031246d.Changes
New: MTP-based
TestInstrumentationbase classTestRunner.Core/TestInstrumentation.csnow uses MTP + NUnit (AddNUnit()from NUnit3TestAdapter 5.0+)androidtesttemplateUpdated test projects
TestInstrumentationbase, stock NUnit 4.3.2, removed NUnitLite/TestRunner.NUnit depsTestInstrumentationandMainActivityDeleted (~41K lines)
tests/TestRunner.NUnit/- NUnitTestRunner/NUnitTestInstrumentationtests/TestRunner.xUnit/- XUnitTestRunner/XUnitTestInstrumentationsrc/Xamarin.Android.NUnitLite/- NUnitLite wrapper, TestSuiteInstrumentation, GUIsrc-ThirdParty/NUnitLite/- Embedded NUnitLite source codeCI updates
apk-instrumentation.yaml: Usesdotnet test --no-buildinstead of-t:RunTestAppPackage upgrades
Out of scope
EmbeddedDSOandLocale-Tests(old-style csproj, need SDK migration first)Xamarin.Legacy.NUnitLiteNuGet package (customer-facing, kept as-is)