TestNG – Ignore Test

import org.testng.Assert;
import org.testng.annotations.Test;

public class IgnoreTest {
String message = “Manisha”;
MessageUtil messageUtil = new MessageUtil(message);

@Test(enabled = false)
public void testPrintMessage() {
System.out.println(“Inside testPrintMessage()”);
message = “Manisha”;
Assert.assertEquals(message, messageUtil.printMessage());

public void testSalutationMessage() {
System.out.println(“Inside testSalutationMessage()”);
message = “Hi!” + “Manisha”;
Assert.assertEquals(message, messageUtil.salutationMessage());

Create testng.xml

<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE suite SYSTEM “http://testng.org/testng-1.0.dtd&#8221; >

<suite name=”Suite1″>
<test name=”test1″>
<class name=”IgnoreTest” />

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s