我创建了 3 个测试服务器、IE、Chrome 和 Firefox。在 TeamCity 中,我创建了 3 个构建配置 IE、Chrome 和 Firefox。我有 3 个代理 AgentIE、AgentChrome 和 AgentFirefox。
每个代理都分配给特定的构建配置示例 Build Configuration IE is to AgentIE
当我运行构建配置 Firefox 时,所有测试都会被执行,但是当我运行构建配置 IE 和 Chrome 测试时不会执行。错误消息表明 IE 和 Chrome exe 不存在,但我按照 exe 文件存在于目录和 PATH 环境变量的目录中。
测试]
Framework.FeatureFiles.AdditionalFieldsFeature.CreateNewAdditionalField_0001 (Create New Additional Field: 0001)
[10:35:53][Framework.FeatureFiles.AdditionalFieldsFeature.CreateNewAdditionalField_0001 (Create New Additional Field: 0001)] Assembly Initialization method Framework.BaseClasses.Base.InitWebdriver threw exception. OpenQA.Selenium.DriverServiceNotFoundException: OpenQA.Selenium.DriverServiceNotFoundException: The chromedriver.exe file does not exist in the current directory or in a directory on the PATH environment variable. The driver can be downloaded at http://chromedriver.storage.googleapis.com/index.html.. Aborting test execution.
[10:35:53][Framework.FeatureFiles.AdditionalFieldsFeature.CreateNewAdditionalField_0001 (Create New Additional Field: 0001)] at OpenQA.Selenium.DriverService.FindDriverServiceExecutable(String executableName, Uri downloadUrl)
at OpenQA.Selenium.Chrome.ChromeDriverService.CreateDefaultService()
at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeOptions options)
at Framework.BaseClasses.Base.GetChromeDriver() in C:\TeamCity\buildAgent\work\eba5cd3c0056fc6a\Framework\BaseClasses\Base.cs:line 61
at Framework.BaseClasses.Base.InitWebdriver(TestContext tc) in C:\TeamCity\buildAgent\work\eba5cd3c0056fc6a\Framework\BaseClasses\Base.cs:line 84
如果我在 teamcity 服务器上运行的代理上运行 Chrome 构建配置,则会执行测试。