Sunday, October 14, 2018

What is invocationTimeOut in TestNG?

invocationTimeOut: This is a TestNG attribute that defines the maximum period of time that a test method with invocationCount should take to execute/invoke a test method. If the invocationTimeOut has reached before invoking the test method for invocationCount then an exception (ThreadTimeOutException) will be thrown.

And invocationTimeOut should always used with invocationCount otherwise it will be ignored. Let us understand invocationTimeOut with examples.

Example 1: Give invocationCount = 4, invocationTimeOut = 3000 milli seconds.

Let us execute and observe the result.


As shown in the above screenshot the test is executed 4 times with in the 3000 millis seconds (invocationTimeOut).

Example 2: Give invocationCount = 4, invocationTimeOut = 3000 milli seconds with delay of 1 second.

Let us execute and observe the result.


The test is executed only 3 times out 4 times with in the given 3000 millis seconds (invocationTimeOut) and an exception "ThreadTimeOutException" was thrown as shown in the below screenshot.

1 comment:

  1. Your post is really very helpful. Easy to learn as you explain things precisely. Thank you so much.

    selenium training in chennai

    ReplyDelete

Java Program 6: How to reverse a String in Java?

In this post we will discuss different methods to reverse a String in java programming. Method 1: Step 1: Read the input string using ...