sillsdev / solid

Solid is a software tool that can be used to check, clean up, and convert Standard Format (e.g. Toolbox) lexicon data.
MIT License
1 stars 2 forks source link

get Solid NUnit tests running in GHA #8

Closed megahirt closed 3 months ago

megahirt commented 6 months ago

So I spent a few hours trying to get NUnit 2.6.4 tests running in GHA. So far I haven't succeeded.

What I know:

image image
<Target Name="Test" DependsOnTargets="Build">
    <ItemGroup>
      <TestAssemblies Include="$(teamcity_build_checkoutDir)/output/release/*Tests.dll;" Exclude="" />
    </ItemGroup>
    <NUnitTeamCity Assemblies="@(TestAssemblies)" ExcludeCategory="SkipOnTeamCity" />
  </Target>

AFAIK the appropriate way to run NUnit v2 on the command line is through the NUnit Console Runner.

NUnit.Runners.Net4.2.6.4\tools\nunit-console.exe can accept a .dll file with tests in it or a csproj file for the test project. When I point it at the .dll I get the error:

System.BadImageFormatException: Could not load file or assembly 'SolidGui.Tests, Version=0.20.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format.

When I point it at the csproj file I get a different error (on GHA) that it cannot find Solid.exe. So far I get different behavior between GHA and local for the csproj file but I get the same error if I point nunit-console.exe at the .dll

So I'm stuck and have decided to abandon efforts for now, just ensuring that the tests pass locally. I will try again once the entire project has been upgraded to .Net 8 - I think it will be easier to address this with more modern tooling.

megahirt commented 3 months ago

Unit tests are all green as of 14e5a9fc0c6d9890fe06497544ed10d9d1295278