Sunday, October 14, 2018

What is invocationCount in TestNG?

invocationCount: This is a TestNG attribute that defines number of times a test method should be invoked or executed before executing any other test method. If invocationCount = 5, then the test method will be executed 5 times before executing next test method.

Check the below example, In getTitle() test method we are printing the title of the website with invocationCount = 5. And we have another test method secondTest() also.

Let us execute the tests and observe results.

As shown in the above screenshot the chrome browser is invoked for 5 times and printed the website title 5 times in the console, finally it executed secondTest() test method.

Please comment your comment your queries or suggestion on this post. Thanks for reading.
#HappyLearning #HappyTesting #QABABU

No comments:

Post a Comment

Selenium4: Working with two parallel windows in Selenium Automation

A new method newWindow() is introduced in Selenium 4 (Alpha). Using this method we can open a new tab or new window from the current window...