How to prevent chromedriver.exe blocking on the TFS build server?

I get this error in about 50% of cases on our TFS build server:

Exception Message: Access to the path 'C:\Builds\5673\Company\QA_Web_Tests\bin\WebDrivers\chromedriver.exe' is denied. (type UnauthorizedAccessException)
Exception Stack Trace:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at Microsoft.TeamFoundation.Common.FileSpec.DeleteFile(String path, Boolean throwExceptionOnFailure)
   at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectoryInternal(String path)
   at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectoryInternal(String path)
   at Microsoft.TeamFoundation.Common.FileSpec.DeleteDirectory(String path, Boolean recursive)
   at Microsoft.TeamFoundation.Build.Workflow.Activities.DeleteDirectory.Execute(CodeActivityContext context)
   at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
   at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

It supports a 4-core processor with parallel testing (via MSTest).

One way is to reboot the server between assemblies. But it would be burdensome if we want to conduct our tests several times a day.

Anyone else come across this? Do you know what to fix? Thank.

Here is my cleaning method:

public void Cleanup()
{
    WebDriver.Quit();
    Console.WriteLine(@"[console] TEST END. Datetime: " + DateTime.Now);
    _stopWatch.Stop();
    Console.WriteLine(@"[console] TEST DURATION: " + _stopWatch.Elapsed);
}
+4
source share
1 answer

The problem is that your tests run webdriver but do not close it.

, . UI MTM . MTM/Lab .

, - . , , !

0

All Articles