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.

1

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

@Test(alwaysRun=true) 
  {
      //TestCode.
  }
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.