Search code examples
nunitazure-pipelinesvstesttest-results

TestContext.AddTestAttachment(string path) is not attaching the files to the test report when path is more than 255


I am trying to run nunit tests in azure test plan by triggering Release build pipelines. I have observed file attachments with greater than 255 characters are not attached to the test report.

Using below code to attach reports TestContext.AddTestAttachment(string path) (comes with nunit package).There is no exception thrown in logs, but just a warning message as below:

Failed to upload result logs to Log store, trying to upload to file service. File at location is not available on the disk.

Need help on how to attach the file with long paths to the test attachments.

Note: Concerned file is available in the path


Solution

  • The limitation is existed that windows file paths is not longer than 255 characters in Azure test plan.

    You could copy or move the files out of the folder into another folder that won't violate the limit. For example, using this Copy Files task to copy file attachments from a source folder to a target folder using match patterns.