Monday 10 August 2015

Limit TestMethod Timeout in CodedUI


Sometimes when we have Test Methods which run for long time, we tend to see the below kind of exceptions and TestMethod execution stops.
"Test 'TestMethod_Name' exceeded execution timeout period." 
By default Execution time for a test method is 60mins.
This test execution timeout can be changed as per our requirements.
It can be either changed in the Settings file or else

First way is to Set a limit time for execution which is as shown below
[TestMethod]
[Timeout(6000)]
public void TestMethodName()
{
}

Second is to set infinite time limit when we dont know how much time the execution is going to happen or if we are expecting the execution to run completely irrespective of the time

[TestMethod]
[Timeout(TestTimeout.Infinite)]
public void TestMethodName()
{
}

No comments:

Post a Comment