Showing posts with label How to skip a test case in TestNG or use of parameter 'enabled'. Show all posts
Showing posts with label How to skip a test case in TestNG or use of parameter 'enabled'. Show all posts

Thursday, May 15, 2014

How to skip a test case in TestNG or use of parameter 'enabled'

Note- By default every @Test has enabled=true.

ex-

import org.testng.annotations.Test;

public class Enabled {
    @Test                            
    public void defaultEnabled(){
        System.out.println("by default enabled=true");
    }
    @Test(enabled=true)
    public void trueEnabled(){
        System.out.println("hard coded enabled=true");
    }
    @Test(enabled=false)
    public void falseEnabled(){
        System.out.println("this test case will be skipped because enabled=false");
    }
}