-
Notifications
You must be signed in to change notification settings - Fork 755
Closed
Description
Hello!
I have some tests that create different artefacts (log files, screenshots, etc.), and sometimes the full paths of the artefacts can be longer, than 255 symbols. The artefacts are still created and published in TeamCity, but I'm facing the issue, that NUnit can't handle such file paths when I'm using TestContext.AddTestAttachment(filePath).
The problem is hidden inside the AddTestAttachment method:
if (!File.Exists(filePath))
throw new FileNotFoundException("Test attachment file path could not be found.", filePath);
var result = TestExecutionContext.CurrentContext.CurrentResult;
result.AddTestAttachment(new TestAttachment(filePath, description));When filePath is too long, File.Exists(filePath) returns false and I'm getting the FileNotFoundException. But in reality, the file exists, and I'm able to access it.
Is there a way to bypass the File.Exists validation?
I tried to use the "\\?\" prefix as suggested by Microsoft, but it didn't help.