3. Run the test cases.
<right-click-class> -> Run As-> TestNG Test This option should appear if you have installed TestNG plugin to eclipse.
4. Console output
Once we run the test, we should see something like this in the console
Console Output
We are intentionally failing the second test.
Understanding the FirstTest
Our FirstTest class has two methods both annotated with @Test annotation. So in TestNG all the methods that are annotated with @Test annotation are test methods or test cases.
@Test can be applied on class level also. In that case it'll consider all the public methods in the class as test methods.
So we we run the test case using TestNG plugin, keep in mind that we are not the one who created instance of FirstTest.java and called helloworldTest() and failingTestCase() . TestNG did it. (This is why we use testing frameworks like JUnit, TestNG etc.,)
And what goes inside those test methods is entirely in our hand.
We can use both org.junit.Assert and org.testng.Assert