What are the different attributes for @Test annotation in testNG?

+1 vote
What are the different attributes for @Test annotation in testNG?
Jun 25, 2019 in Selenium by Iqbal
1,663 views

1 answer to this question.

+1 vote

Hey @Iqbal, some of the most common attributes for @Test annotations are:

  • description: gives information about the test it is attached to.
  • timeOut: maximum number of milliseconds for a test run.
  • priority: specifies when to run a test. The test with the lowest priority runs first, then the one with the next priority, and so on.
  • dependsOnMethods: specify when you want to run a test, only after another test has run successfully, making the second test’s run dependent on the first test’s successful outcome.
  • enabled: this attribute has boolean values, and by default is ‘true’. Only worth specifying explicitly when you don’t want a certain test method or class to be run, by setting the attribute to false.
  • groups: useful for grouping together tests that relate to the same functionality, are of the same importance or are of the same type.
answered Jun 25, 2019 by Gulshan
Full Attributes that can use in @Test are,

alwaysrun
attributes
dataprovider
dataproviderclass
dependsongroups
dependsonmethods
description
enabled
expectedExceptions
expectedExceptionsMessageRegExp
groupsigonreMissingDependencies
invocationCount
invocationTimeOut
priorityretryAnalyzer
SingleThreaded
skipfailedInvocations
SuiteName
TestName
ThreadPoolSize
Hi @Ramesh. I hope you are doing good. Please make this comment an answer and register at Edureka community. You will receive points and reputations for your contribution here.

Related Questions In Selenium

0 votes
1 answer

What are the different types of TestNG listeners in Selenium Webdriver?

Hello Jagrati, some of the TestNG listeners ...READ MORE

answered Jun 12, 2019 in Selenium by Anvi
• 14,050 points
370 views
0 votes
1 answer

What are the different assertions supported by testNG?

The different assertions you can use in ...READ MORE

answered Jan 2, 2019 in Selenium by Nabarupa
73 views
0 votes
1 answer

What are the different tools used for Compatibility testing?

For compatibility testing you can use the ...READ MORE

answered Feb 15, 2019 in Selenium by Nandita
75 views
0 votes
1 answer

What are the different tools that can be used for Security Testing?

The different tools used for security testing ...READ MORE

answered Feb 19, 2019 in Selenium by Ria
155 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,510 points
2,854 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,870 points
2,214 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,870 points
2,329 views
0 votes
1 answer
0 votes
1 answer

What is the use of @listener annotation in TestNG?

 @listeners are used to configure reports and ...READ MORE

answered Jan 2, 2019 in Selenium by Shuvodip
973 views