共用方式為


Running Coded UI Tests built using Visual Studio 2013 with Team Foundation Server 2015

Recently some users have reported issues while executing tests using TFS 2015 for the projects built with Visual Studio 2013. The test execution fails with this error message:

 

2016-06-08T18:04:59.8268353Z ##[warning]DistributedTests: UnExpected error occured during test execution. Try again.

2016-06-08T18:04:59.8268353Z ##[warning]DistributedTests: Error : MSTestAdapter failed to discover tests in class 'TestProject.CodedUITest1' of assembly 'C:\TestDrop\CUITProject.dll'. Reason Could not load file or assembly 'Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified..

 

Test execution is failing in this scenario because test execution engine is not able to resolve version 12.0 binaries (Visual Studio 2013) while executing tests in a 14.0 environment (TFS 2015).

 

As a workaround to this issue, add an 'app.config' file to your solution (See how to add app.config https://msdn.microsoft.com/en-in/library/ms184658.aspx) and update the contents of the file with the shared on OneDrive . The updated configuration files contain assembly redirects from version 12.0 to 14.0, which will make sure that the test agent machine is able to resolve the framework assemblies.

Check-in the updated configuration file into the source control repository and run the BDT scenario once again. The tests should run fine this time.

 

If the test execution again throws an error complaining version mismatch for some other assembly, add the assembly to the app.config file and retry.