Hello,
I started using the trail version of NCrunch and its a fascinating tool. Although I have encountered the following oddity.
I have a test that generates a .bat file. The first time NCrunch is loaded that test always fails. With the following exception:
System.IO.DirectoryNotFoundException : Could not find a part of the path 'C:\Users\ethan.behar\AppData\Local\NCrunch\60016\2\XXXXXXXXXXX.Test\TestFiles\ActualOutput\XXXXXXXXXXX.bat'.
Once I run the test a second time it doesn't fail.
Now this occurs if I have tests running automatically or manually and if I restart visual studio or use the "Restart the Ncrunch engine, resynchronize with VS and rebuild all projects (reset)" button.
My first thought was that maybe Ncrunch is running the tests before the workspace location is fully created but if that was the case I would assume manually running the tests wouldn't cause the exception but it does.
Any insight into this problem is grealy appreciated.
-LKEthan
Build/Test Issues
NCrunch fails test on first run and then passes on second run
Started by LKEthan on 1,963 views
I already figured it out. This issue has to do with an empty folder in my test project. I use this folder to save my files generated by the tests. And then when the tests are over the files get deleted. It seems like NCrunch is getting confused on bringing this folder into the Ncrunch workspace.
Is there a way I can designated an empty folder with a flag or attribute so its always created in the Ncrunch workspace?
I'll check if the folder exists and create it if it doesn't.
-LKEthan
Is there a way I can designated an empty folder with a flag or attribute so its always created in the Ncrunch workspace?
I'll check if the folder exists and create it if it doesn't.
-LKEthan
Edited 02 Apr 2020 19:11 UTC
Remco NCrunch Developer
#14571
03 Apr 2020 00:52 UTC
Hi, thanks for sharing this problem.
Yes, we currently don't replicate empty directories into the workspace. This is a known issue.
I would recommend making a call to System.IO.Directory.CreateDirectory at the beginning of your test to ensure the directory containing the .bat file exists. This should make the test resilient and prevent any issues from arising.
Yes, we currently don't replicate empty directories into the workspace. This is a known issue.
I would recommend making a call to System.IO.Directory.CreateDirectory at the beginning of your test to ensure the directory containing the .bat file exists. This should make the test resilient and prevent any issues from arising.
Thank you for the reply Remco.
I did indeed do as you suggested yesterday and the tests pass without issue now.
Out of curiosity, will Ncrunch replicate empty directories in the future?
-LKEthan
I did indeed do as you suggested yesterday and the tests pass without issue now.
Out of curiosity, will Ncrunch replicate empty directories in the future?
-LKEthan
Remco NCrunch Developer
#14576
03 Apr 2020 23:04 UTC
LKEthan wrote:
Out of curiosity, will Ncrunch replicate empty directories in the future?
I'd like to say yes, but this is one of those problems that is relatively low in impact (i.e. affects very few people) and takes a surprisingly high effort to solve.
So if we're to fix this, it may be some way off.
Post a reply
Log in to reply.