Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

ApprovalTest
bhugot
#1 Posted : Friday, March 19, 2021 11:41:33 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/19/2018(UTC)
Posts: 9
Location: France

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hello I have an issue when using approval test with ncrunch.
Ncrunch restart testing permanently.
I think it's due to the generation of .received file, I have put *.received.* in FilesExcludedFromAutoBuild but it's keep runing.

To reproduce it. I have created a simple nunit test project with this class only

public class Tests
{
[Test]
[UseReporter(typeof(DiffReporter))]
public void Test1()
{
Approvals.VerifyJson("{}");
}

[Test]
[UseReporter(typeof(DiffReporter))]
public void Test2()
{
Approvals.VerifyJson("{}");
}
}

Regards
Remco
#2 Posted : Friday, March 19, 2021 11:00:51 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 6,967

Thanks: 929 times
Was thanked: 1256 time(s) in 1169 post(s)
Hi, thanks for posting.

This problem is caused by the approvals tests output files being implicitly included in the project file. When approvals creates the files, this changes the list of files included in the project, forcing NCrunch to reload it. If you have the engine set to run all tests automatically, this can result in circular behaviour as the engine will re-queue the tests for execution.

The solution is to ensure the approvals tests output files are excluded from the project. You can do this using a wildcard in the DefaultItemExcludes property inside the project. For example:

<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);*.received</DefaultItemExcludes>
</PropertyGroup>
2 users thanked Remco for this useful post.
bhugot on 3/19/2021(UTC), UppSol on 3/21/2021(UTC)
bhugot
#3 Posted : Friday, March 19, 2021 11:21:15 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 8/19/2018(UTC)
Posts: 9
Location: France

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Thanks alot
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.028 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download