Hire QA – Specialized in QA Recruitment, Technical Interviews and Testing Solutions

How can we disable or prevent a test case from running?

Category: TestNG

By setting the “enabled” attribute as false, we can disable a test method from running.

//In case of a test method
@Test(enabled = false)
public void testMethod1() {
//Test logic
}
//In case of test method belonging to a group
@Test(groups = {“NegativeTests”}, enabled = false)
public void testMethod2() {
//Test logic
}

Leave a Reply

Your email address will not be published. Required fields are marked *