2

How to run other tests in TestNG after one test is failed using Java

For example:

@Test(priority=1)
    public void Online1(){
//code     
}

@Test(priority=2)
    public void Online2(){
//code     
}

In the above code, if priority 1 fails then priority 2 automatically get failed, I want to execute priority 2 even if 1 gets failed.

surya
  • 45
  • 3

1 Answers1

1

You can use TestNG's alwaysRun attribute. This is quite self explanatory.

@Test(alwaysRun=true) 
  {
      //TestCode.
  }
MKay
  • 225
  • 1
  • 8