Closed tharishreddy closed 4 years ago
have u tried any of the suggestions?
if yes, can u add the contents of csproj
Yes, tried solution-1 by adding [MethodImpl(MethodImplOptions.NoInlining)]. Still same issue. For solution-2, we are already using Nunit framework, which is currently supported by ApprovalTests
As a workaround The below code works without any exception
[Test] [UseReporter(typeof(DiffReporter), typeof(NUnitReporter))] public async Task Abc() { var task = Task.Delay(1); task.Wait(); Approvals.Verify("abc"); }
and have you done
Set Build->Optimize Code to False
& Build->Advanced->DebugInfo to Full
Yes, correct.
in that case can you upload, to a new github repository, a small solution that reproduces the issue
uploaded a sample here - https://github.com/tharishreddy/AppTest
Additional note: the error message reported by the OP contains a link to a blog post that refers to a broken and outdated link: http://approvaltests.svn.sourceforge.net/viewvc/approvaltests/trunk/projects/ApprovalTests/DotNetApprovals/ApprovalTests/Namers/UnitTestFrameworks/NUnitStackTraceParser.cs?revision=345&view=markup
Approval Tests Nuget version - 3.0.14 The below code throwing an exception:
System.Exception : Could Not Detect Test Framework
Either: 1) Optimizer Inlined Test Methods
Solutions: a) Add [MethodImpl(MethodImplOptions.NoInlining)] b) Set Build->Optimize 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, MsTest-DataTest, xUnit.net, xUnit.extensions, xUnit2.net, 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
The below code works without any exception