1

I am trying to write some unite tests based on coyote. I found that in the tutorial I should rewrite my assembly before coyote test command.

However, when integrate coyote tests into unit test platform using TestingEngine, it explored bugs without doing any rewriting manually.

Did I doing the right thing? If I can explore the bug without rewriting assembly, what the operate exactly works for?

Thank you!

jiana
  • 11
  • 1
  • Another question is that how I rewrite assembly in the unit test framework? – south Apr 28 '22 at 09:09
  • Not to interrupt you, but in my case, when I rewrite the dll, coyote failed to find the bug for me. Instead, if I run it straightly without rewriting, I get the bug every time. Could anyone help me to explain why? – south Apr 28 '22 at 10:18

1 Answers1

0

In that case, the easiest option is to rewrite during your build.

Add the following to .csproj.

  <ItemGroup>
    <None Update="rewrite.coyote.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
  <Target Name="CoyoteRewrite" AfterTargets="AfterBuild">
    <Exec Command="dotnet tool run coyote rewrite$(OutputPath)/rewrite.coyote.json -v info" />
  </Target>

You have to put your rewrite.coyote.json in your project's root folder (next to your .csproj and set the AssembliesPath to ..

My rewrite.coyote.json looks like:

{
  "AssembliesPath": ".",
  "Assemblies": [
    "MySut.dll",
    "MySut.UnitTests.dll",
    "MySut.Coyote.dll"
  ],
  "IsRewritingConcurrentCollections": "false"
}
delixfe
  • 2,471
  • 1
  • 21
  • 35