How can I configure TestStack.White timeouts?

拟墨画扇 提交于 2019-12-10 15:29:53

问题


I'm using Visual Studio 2010 and I got TestStack.White via NuGet (I got version 0.10.3.118).

Problem is, my test clicks a button which triggers an action that exceeds the default 5 second timeout. So my test always yields:

[Error] 'White.Core.Interceptors.CoreInterceptor' Error when invoking Click, on Button with parameters: 

White.Core.UIItems.UIActionException : Window didn't respond, after waiting for 5000 ms
  ----> System.Exception : Timeout occured, after waiting for 5000 ms

I read White's doc about waiting, but it says to look at Configuration section to see how to set my own timeout values. And that section does not exist.

Update: I tried creating a file called TestStack.White.dll.config and placed it in the same directory as TestStackWhite.dll and my test dll. The contents:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>

    <sectionGroup name="White">
      <section name="Core" type="System.Configuration.NameValueSectionHandler"/>
    </sectionGroup>
  </configSections>

  <White>
    <Core>
      <add key="WorkSessionLocation" value="." />
      <add key="PopupTimeout" value="5000" />
      <add key="SuggestionListTimeout" value="10000" />
      <add key="BusyTimeout" value="10000" />
      <add key="WaitBasedOnHourGlass" value="true" />
      <add key="UIAutomationZeroWindowBugTimeout" value="10000" />
      <add key="TooltipWaitTime" value="10000" />
      <add key="DragStepCount" value="4" />
    </Core>
  </White>
</configuration>

Nevertheless, I'm still getting the 5 seconds timeout whether I run my test from inside NUnit or VS + Resharper...


回答1:


These timeouts can be configured programmatically, in your test code. For example:

CoreAppXmlConfiguration.Instance.BusyTimeout = 20000;

To do it using an App.Config, such file must be associated to the test assembly. So adding an App.Config to my test project and pasting the content from the question works as well.




回答2:


I solved a problem like yours, where the the test timeout when I click on element. I've used this:

  Mouse.Instance.Location = element.ClickablePoint;
  Mouse.Instance.Click();


来源:https://stackoverflow.com/questions/17305248/how-can-i-configure-teststack-white-timeouts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!