如何为 TeamCity 上的 运行 批准测试指定 approved.txt 文件位置
How to specify approved.txt files location for running approvals tests on TeamCity
我正在尝试 运行 我在 TeamCity
下的 nUnit 的批准测试
[assembly: FrontLoadedReporter(typeof(TeamCityReporter))]
[Test]
[UseReporter(typeof(WinMergeReporter))]
public void Test()
{
}
不幸的是,测试失败,因为批准正在尝试从 C 驱动器中获取已批准的文件。
Test(s) failed. ApprovalTests.Core.Exceptions.ApprovalMissingException : Failed Approval: Approval File "C:\...approved.txt" Not Found.
我是否可以为我的批准文件指定正确的位置?
TeamCityReporter 似乎隐藏了这个问题的真正原因。
这里是本地 运行 的结果和所列解决方案的认证测试输出。
System.Exception : Could Not Detect Test Framework
Either: 1) Optimizer Inlined Test Methods
Solutions: a) Add [MethodImpl(MethodImplOptions.NoInlining)] b) Set
Build->Opitmize Code to False & Build->Advanced->DebugInfo to Full
or 2) Approvals is not set up to use your test framework. It currently
supports [NUnit, MsTest, MbUnit, xUnit.net, xUnit.extensions,
Machine.Specifications (MSpec)]
Solution: To add one use
ApprovalTests.Namers.StackTraceParsers.StackTraceParser.AddParser()
method to add implementation of
ApprovalTests.Namers.StackTraceParsers.IStackTraceParser with support
for your testing framework. To learn how to implement one see
http://blog.approvaltests.com/2012/01/creating-namers.html
很难捕捉到,因为通常本地 运行 在 Debug 下完成,而部署和测试在 Release 下完成。不过,我希望问题和答案对其他人有所帮助。
我正在尝试 运行 我在 TeamCity
下的 nUnit 的批准测试 [assembly: FrontLoadedReporter(typeof(TeamCityReporter))]
[Test]
[UseReporter(typeof(WinMergeReporter))]
public void Test()
{
}
不幸的是,测试失败,因为批准正在尝试从 C 驱动器中获取已批准的文件。
Test(s) failed. ApprovalTests.Core.Exceptions.ApprovalMissingException : Failed Approval: Approval File "C:\...approved.txt" Not Found.
我是否可以为我的批准文件指定正确的位置?
TeamCityReporter 似乎隐藏了这个问题的真正原因。
这里是本地 运行 的结果和所列解决方案的认证测试输出。
System.Exception : Could Not Detect Test Framework
Either: 1) Optimizer Inlined Test Methods
Solutions: a) Add [MethodImpl(MethodImplOptions.NoInlining)] b) Set Build->Opitmize Code to False & Build->Advanced->DebugInfo to Full
or 2) Approvals is not set up to use your test framework. It currently supports [NUnit, MsTest, MbUnit, xUnit.net, xUnit.extensions, Machine.Specifications (MSpec)]
Solution: To add one use ApprovalTests.Namers.StackTraceParsers.StackTraceParser.AddParser() method to add implementation of ApprovalTests.Namers.StackTraceParsers.IStackTraceParser with support for your testing framework. To learn how to implement one see http://blog.approvaltests.com/2012/01/creating-namers.html
很难捕捉到,因为通常本地 运行 在 Debug 下完成,而部署和测试在 Release 下完成。不过,我希望问题和答案对其他人有所帮助。