Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I configure TestStack.White timeouts?

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...

like image 451
dario_ramos Avatar asked Jun 25 '13 18:06

dario_ramos


2 Answers

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.

like image 155
dario_ramos Avatar answered Oct 20 '22 19:10

dario_ramos


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();
like image 42
Milen Grigorov Avatar answered Oct 20 '22 18:10

Milen Grigorov