TestNG tutorial – Ignore Test

Annotation @ignore in TestNG allows a test to be deffered until it is ready (or the feature is). In TestNG, you can use annotation @Test(enabled = false) to bypass one test case if it is not ready to test.

package com.asjava;

import org.testng.annotations.*;

public class TestNGIgnoreTest {

    @Test(enabled = false)
    public void testsetProperty() {
        String path = this.getClass().getResource("/").getPath();
        System.setProperty("CurrentDir", path);
        assert ("c:/testProject".equals(System.getProperty("CurrentDir")));
        System.out.println("Method is not ready yet");

In this example, the test TestNGIgnoreTest is skipped, so it is a exclusion of tests by group to execute. If you are not familiar how to run testng test case, please get first chance reading TestNG Tutorial and Example: Getting Started Run TestNG test

Оцените статью
Добавить комментарий

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



  1. sushma

    i did this test it didn’t run could some one help how to run TestNGIgnoreTest