Complete the code to import the TestNG annotation for test methods.
import org.testng.annotations.[1];
The correct import for TestNG test methods is org.testng.annotations.Test.
Complete the code to define a simple TestNG test method.
@[1] public void sampleTest() { System.out.println("Test running"); }
The @Test annotation marks a method as a TestNG test method.
Fix the error in the TestNG test method to enable default reporting.
@Test
public void testMethod() {
int expected = 5;
int actual = 3 + 2;
Assert.[1](expected, actual);
}Use Assert.assertEquals to compare expected and actual values for TestNG reports.
Fill in the blank to create a TestNG test that fails and logs a message.
@Test
public void testFailure() {
Assert.[1]("test failed");
}The Assert.fail method fails the test immediately with a message.
Fill all three blanks to create a TestNG test with a priority and description.
@Test(priority = [1], description = "[2]") public void testPriority() { Assert.[3](true); }
Priority 0 runs before priority 1. The description explains the test. assertTrue(true) passes the test.
