Tags

Unit tests in VS 2015 in local machine were 100% pass rate. When checked in with TFS Continuous Integration, the build failed.  All unit tests passed except one with File Not Found error.

Looked at the details of error message, and found out that there were a few stub files Moq used in unit tests. These files were supposed to deploy with unit tests together. The ‘Build Action’ property was set to ‘Content’, and ‘Copy to Output’ property to ‘Copy if Newer’ already. However, test run just could not find those stub files.

Researched this issue, and happened to find the ‘DeploymentItem’ attribute in MSDN. Attached this attribute [DeploymentItem(@”Testfiles\”)] to my test class according to MSDN instructions, and build succeeded.

References:

DeploymentItem Attribute

Advertisements