Bird
0
0

Which of the following is the correct way to set test priority in TestNG?

easy📝 Syntax Q12 of 15
Selenium Java - TestNG Integration
Which of the following is the correct way to set test priority in TestNG?
A@Test(priority = 1)
B@Test(order = 1)
C@Test(sequence = 1)
D@Test(rank = 1)
Step-by-Step Solution
Solution:
  1. Step 1: Recall TestNG annotation syntax

    TestNG uses @Test(priority = number) to set the execution order of tests.
  2. Step 2: Identify the correct attribute name

    The correct attribute is priority, not order, sequence, or rank.
  3. Final Answer:

    @Test(priority = 1) -> Option A
  4. Quick Check:

    TestNG priority syntax = @Test(priority = x) [OK]
Quick Trick: Use 'priority' attribute inside @Test for order [OK]
Common Mistakes:
  • Using wrong attribute names like order or rank
  • Missing parentheses after @Test
  • Confusing priority with dependsOnMethods

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Java Quizzes