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

Notification

Icon
Error

How to copy test files to NCrunh folder
Anand
#1 Posted : Thursday, February 7, 2019 3:04:47 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2019(UTC)
Posts: 6
Location: United States of America

Hello
I am getting an error tryin to run tests
System.IO.DirectoryNotFoundException : Could not find a part of the path 'C:\Users\achaudhuri\AppData\Local\NCrunch\17380\7\test\<ProjectName>\bin\Debug\netcoreapp2.0\JsonFiles\financing_credit_cs.json'.
When I checked in the folder, I found the json files I use for testing are not copied from the project to the NCrunch folder
When I run the test from another test runner in Visual Studio like Resharper these work file because the build process copies these folder to the bin
Not sure how to do that for NCrunch which seem to run from the AppData\Local.
Can you please help?
Thanks
Remco
#2 Posted : Thursday, February 7, 2019 8:52:02 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Hi, thanks for sharing this issue.

This should be an easy one to fix. The files need to be flagged up so that NCrunch knows to copy them.

See here for more information: https://www.ncrunch.net/documentation/considerations-and-constraints_implicit-file-dependencies.
Anand
#3 Posted : Thursday, February 7, 2019 9:36:26 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2019(UTC)
Posts: 6
Location: United States of America

The json files are already listed in the .csproj file of the library to be tested
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="JsonFiles\financing_dailyaccrual_cs.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
......
</ItemGroup>
And the test project refers to the library and gets the files in its own folder when it is built
But these are not there in the NCrunch folder
I also tested the .csproj with 1 file

<ItemGroup>
<None Include ="JsonFiles\financing_dailyaccrual_cs.json"
</ItemGroup>

But this is still not copied to NCrunch folder with same file not found error

Please advise
Remco
#4 Posted : Thursday, February 7, 2019 9:39:49 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Sorry, this gets more complicated then. This is now a project accessing resources from another project's workspace.

This documentation page explains the problem in detail. It's a bit harder to fix sadly: https://www.ncrunch.net/documentation/considerations-and-constraints_assembly-colocation-assumptions.
Anand
#5 Posted : Thursday, February 7, 2019 10:09:14 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2019(UTC)
Posts: 6
Location: United States of America

I turned on the setting Copy Referenced Assemblies To Workspace for the test project and then the files were copied to NCrunch folder and the tests passed.
But I want to use NCrunch mainly for code coverage and looking at the source file I am not seeing any markers that indicate coverage referenced in this doc
https://www.ncrunch.net/...guides_quick-start-guide
Remco
#6 Posted : Thursday, February 7, 2019 10:12:50 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Does this documentation page help at all? https://www.ncrunch.net/documentation/troubleshooting_missing-code-coverage.

Has the engine given you any warnings about lost references or other problems?
Anand
#7 Posted : Thursday, February 7, 2019 10:38:38 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2019(UTC)
Posts: 6
Location: United States of America

I do not see any warning from Engine - I turned on automatic, before I had it on run test manual.
In the metrics window, for some files, I see Compiled Lines 0 and Code Coverage % blank, although the tests for that code in those files are passed.
Remco
#8 Posted : Thursday, February 7, 2019 11:07:34 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Can you check if you have the 'Instrument output assembly' setting disabled at any level in your configuration?
Anand
#9 Posted : Friday, February 8, 2019 1:45:21 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2019(UTC)
Posts: 6
Location: United States of America

'Instrument output assembly' setting is enabled everywhere
Remco
#10 Posted : Friday, February 8, 2019 11:13:13 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
Are you able to reproduce this issue in a sample solution? If you have a small test solution where NCrunch is working, it might be possible to progressively transfer code/structure/configuration between this test solution and your main solution until you can find the cause. If you can share a sample solution that produces this problem, I should be able to provide a fix if this is a problem in NCrunch itself.
Anand
#11 Posted : Saturday, February 9, 2019 2:18:18 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 2/7/2019(UTC)
Posts: 6
Location: United States of America

The issue seem to have resolved on its own.
I did not do anything special - other than running the program in debug mode (as I was debugging) over and over.
I am getting % reported instead of blank cells which is an improvement - however % is 0 and coverage markers are showing up for no coverage.

This does not seem right as when I am running a specific test in debug mode I am able to stop at lines that are showing as not covered.
Remco
#12 Posted : Saturday, February 9, 2019 5:58:55 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,144

Thanks: 959 times
Was thanked: 1290 time(s) in 1196 post(s)
When tests are run with a debugger attached, NCrunch won't record code coverage for the run and will instead use coverage from the previous run. This is because the debugger interferes with normal execution data, so we only capture the trace output and exceptions instead. This might explain some of what you're seeing. Let me know if you manage to reproduce any of these problems in sample code that you can share with me.
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.059 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download