Friday, March 25, 2016

Coded UI Tests: When debugging, function evaluation time out

Most of the coded ui developers may encounter this situation. When they want to debug a script and they want to add watch on a particular object or property, this message "function evaluation time out" may display.
This results in frustration and developers have to manually find the bug.
To overcome this situation I begin to research about this particular issue. I cannot find anything on the blogs and forums. They all seem to say one thing only that this error occurs due to bad programming practice etc.
But luckily I found the solution and it is very simple.
Just open your .testsettings file (Located under solution items folder) . My test setting name was TraceAndTestImpact.testsettings
Open it with XML Text Editor.
You will see something like this
xml
version="1.0"
encoding="UTF-8"?>
<TestSettings
name="Trace and Test Impact"
id="1494f279-051d-465d-97a9-e57b59372376"
xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are test settings for Trace and Test Impact.</Description>
<Execution>

<ExecutionThread
apartmentState="MTA" />
Just comment out the selected line
xml
version="1.0"
encoding="UTF-8"?>
<TestSettings
name="Trace and Test Impact"
id="1494f279-051d-465d-97a9-e57b59372376"
xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are test settings for Trace and Test Impact.</Description>
<Execution>

And restart visual studio.
You will now be able to debug without having function evaluation time out message. Inshallah.
Cheers J

1 comment:

  1. Hi Mohammand,

    I don't have these line which you talked about.
    I am getting the same error, how to resolve?
    I pasted the .uitest code below please have a look and help me. Thanks in advance.

    ReplyDelete