You could run into default script timeout of five minutes, while running scripts before running tests using MTM.
Error 1/19/2016 11:10:39 AM The setup batch file on agent machine 'vstfs:///LabManagement/TestMachine/19' exceeded the execution timeout period. vstfs:///LabManagement/TestMachine/19
How to Resolve
To increase this timeout there is no straight forward way using MTM. However update deployment timeout is explained in here, utilizing the tool created by Aseem Bansal. But setting Script timeout not available with this particular tool.
As explained in this MSDN Q&A, I have made changes to the code downloaded from the post here by Aseem Bansal and improved it to enable setting the Script Timeout for test settings. You can download the new utility from Technet Gallery here, and use it as explained below (VS 2013 source code for the tool available here).
UpdateTestSettings /collection:<ProjectCollectionUri> /teamProject:<ProjectName> /settingsname:<TestSettingsName> [/bucketSize:<value>] [/deploymentTimeout:<value>] [/scriptTimeout:<value>]
UpdateTestSettings /collection:http://abc:8080/tfs/DefaultCollection /teamProject:myProject /settingsname:My2_0_App /bucketSize:200 /deploymentTimeout:600000
UpdateTestSettings /collection:http://abc:8080/tfs/DefaultCollection /teamProject:myProject /settingsname:My2_0_App /bucketSize:200 /deploymentTimeout:600000 /scriptTimeout:900000
UpdateTestSettings /collection:http://abc:8080/tfs/DefaultCollection /teamProjec:myProject /settingsname:My2_0_App /scriptTimeout:900000
How the code is modified
You can download the original code for the utility from the link provided in the post here.
There is no Microsoft.TeamFoundation.dll for VS 2013. Microsoft.TeamFoundation.Common.dll would add all thats is added previously by Microsoft.TeamFoundation.dll. Add the references to Team Foundation dlls.
Replace the code in Program.cs with the below updated Program.cs code.