Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Cyber Security
  3. Question
Cyber Security

If I use the TestNg priority option, what would be the order of execution for tests?

Asked by Alastair Mcdade Feb 23, 2022 1.3K views 1 answer
Share

About this question

 I have three methods as mentioned below, two with priority ( 0 , 1 ) and third method(Test) with no priority attribute. What is the order of execution? Code snippet given below..


@Test(priority = 1)
    private void test1() {
        System.out.println("Test Priority One- Revision");
    }
    @Test(priority = 0)
    private void test2() {
        System.out.println("Test Priority Zero - Revision");
    }
    @Test
    private void ztestNP() {
        System.out.println("Test NoPriority- Revision");
    }

What is the expected Order ? I expected

Test Priority Zero - Revision Test 

Priority One- Revision Test 

NoPriority- Revision

But Getting


Test Priority Zero - Revision

Test NoPriority- Revision 

Test Priority One- Revision

Your answer

1 Answer

More Cyber Security discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Cyber Security Blogs

Guides, tips and career advice on Cyber Security from JanBask experts.