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
12,107 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,150 points
1,779 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
834 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
719 views
0 votes
2 answers

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

Veracode is the best due to banking ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
904 views
0 votes
2 answers

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,500 points
13,442 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,007 views
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,910 points
7,121 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,805 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
2,679 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP