我正在关注 https://github.com/DiUS/pact-workshop-dotnet-core-v3/
给出的 PactNet 研讨会示例我对消费者端代码没有任何问题。所有测试都已通过,并且正在生成契约交互文件。
但是,当尝试验证生成的契约文件时,提供商端的测试失败。问题是我看不到验证失败的详细错误消息。请参阅附加的控制台输出
我的提供商测试代码与https://github.com/DiUS/pact-workshop-dotnet-core-v3/blob/master/Provider/tests/ProductTest.cs中描述的相同
我的 Provider 测试 .csproj 具有与研讨会示例中给出的相同的 NuGet 包
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="PactNet" Version="4.0.0-beta" />
<PackageReference Include="PactNet.Native" Version="0.1.0-beta" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
有人可以帮助我在这里缺少什么以查看详细的错误输出。
谢谢
确保设置“PactVerifierConfig”实例的“Outputers”属性。 这是您提供的同一链接中的代码
var config = new PactVerifierConfig
{
// NOTE: We default to using a ConsoleOutput, however xUnit 2 does not capture the console output,
// so a custom outputter is required.
Outputters = new List<IOutput>
{
new XUnitOutput(_outputHelper)
}
};