简体   繁体   English

如何解决 TFS 服务器上 C# selenium 持续集成构建的超时问题?

[英]How to fix time out issue with C# selenium continuous integration build on TFS server?

I am setting up my C# selenium continuous integration build to run on TFS server我正在设置我的 C# selenium 持续集成构建以在 TFS 服务器上运行

The build job has multiple stages:构建作业有多个阶段:

  1. Initialize job初始化作业
  2. Get sources获取资源
  3. Build Solution ***.sln构建解决方案 ***.sln
  4. VsTest - testAssemblies VsTest - 测试程序集
  5. Kill Stray ChromeDriver杀死 Stray ChromeDriver
  6. Post-job: Get Sources工作后:获取资源
  7. Finalize Job完成工作

All these stages passed except VsTest-test Assemblies It always says "Build partially successed" and throws the following error除了 VsTest-test 程序集之外,所有这些阶段都通过了它总是说“构建部分成功”并抛出以下错误

"##[warning]Windows Error Reporting DontShowUI not set, if the windows error dialog pops-up in the middle of UI test execution than the test will hang"
"##[error]The task has timed out."

I am not sure if these two errors are related or not But it always timeout, I have tried to add TearDown method in each of my classes and it still doesn't help我不确定这两个错误是否相关但它总是超时,我试图在我的每个类中添加 TearDown 方法,但它仍然没有帮助

 [TearDown]
public void BaseTearDown()
{
    driver.Close();
}

According to your description, the vsTest task showing as "Partially succeeded" may due to you checked "Continue on error" option.根据您的描述,显示为“部分成功”的 vsTest 任务可能是由于您选中了“错误时继续”选项。

Continue on error (partially successful)出错时继续(部分成功)

Select this option if you want subsequent tasks in the same job to possibly run even if this task fails.如果您希望即使此任务失败也可能运行同一作业中的后续任务,请选择此选项。 The build or deployment will be no better than partially successful.构建或部署不会比部分成功更好。 Whether subsequent tasks run depends on the Run this task setting.后续任务是否运行取决于运行此任务设置。

Please refer to this document for more info: Task control options请参阅此文档了解更多信息: 任务控制选项

Based on your warning and error, VsTest task has a timeout option which specifies the maximum time, in minutes, that a task is allowed to execute before being canceled by server.根据您的警告和错误,VsTest 任务有一个超时选项,用于指定任务在被服务器取消之前允许执行的最长时间(以分钟为单位)。

在此处输入图片说明

Change the value to 0. A zero value indicated an infinite timeout.将该值更改为 0。零值表示无限超时。

If you still get the same error, the time out error should be caused by the hang of your test.如果你仍然得到同样的错误,超时错误应该是你的测试挂起造成的。

For this, there are multiple reasons, make sure you have installed all and need nuget packages.为此,有多种原因,请确保您已安装所有并需要 nuget 软件包。

You could take a look at our official tutorial here: UI test with Selenium您可以在此处查看我们的官方教程: 使用 Selenium 进行 UI 测试

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM