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
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
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/documentation/guides_quick-start-guide
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.
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.
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.
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.