Currently, there are no unit tests for the msbuild tasks in src/tasks. For wasm, there are some limited tests for PInvokeTableGenerator in src/mono/wasm/Wasm.Build.Tests, but these perform full builds which are not always necessary.
Instead, the msbuild tasks should have their own unit tests in src/tests which can be targeted, and much lighter to run.
essentially, the task classes will inherit from MSBuildTaskBase, their Execute methods become ExecuteTask, and have a ConfigureServices for dependencies like Log.
Add a product dependency on Microsoft.Arcade.Common in eng/Version.Details.xml
<PackageReference Include="Microsoft.Arcade.Common" Version="$(MicrosoftArcadeCommonVersion)" /> in the project
Currently, there are no unit tests for the msbuild tasks in
src/tasks
. For wasm, there are some limited tests forPInvokeTableGenerator
insrc/mono/wasm/Wasm.Build.Tests
, but these perform full builds which are not always necessary.Instead, the msbuild tasks should have their own unit tests in
src/tests
which can be targeted, and much lighter to run.these can be based on Arcade's
MSBuildTaskBase
- https://github.com/dotnet/arcade/blob/main/Documentation/Mechanics/MSBuildTaskDependencyInjection.mdMSBuildTaskBase
, theirExecute
methods becomeExecuteTask
, and have aConfigureServices
for dependencies likeLog
.Add a product dependency on
Microsoft.Arcade.Common
ineng/Version.Details.xml
<PackageReference Include="Microsoft.Arcade.Common" Version="$(MicrosoftArcadeCommonVersion)" />
in the projectThis should be enough to build the project
And a separate test project would use the same package, and add tests like https://github.com/dotnet/arcade/blob/main/Documentation/Mechanics/MSBuildTaskDependencyInjection.md#how-to-use-with-tests
Examples for tests to add:
ManagedToNativeGenerator
- tests for native libraries, and assembly names with special characters (an example issue: https://github.com/dotnet/runtime/issues/78992)SignatureMapper
inWasmAppBuilder
This should be applicable for mobile tasks too.
cc @maraf @ilonatommy @lewing @steveisok