I\'m trying to execute my test scripts using testNG and trying the below code, but 0 displayed against run, fail and skip in the console. Because of that I\'m unable to veri
There is a minor bug in your code block. When you are using TestNG
and writing methods within @Test
annotation, we should define the methods with proper return types
. I have used your own code and simply added the return type as void as follows:
import org.testng.Assert;
import org.testng.annotations.Test;
public class Q45191867_Assert_Pass_Suite
{
@Test
public void TC002_CheckAssert()
{
System.out.println("ajkcbh");
try
{
Assert.assertEquals("Pass", "Pass");
}
catch(Exception e)
{
System.out.println("Exception:"+e.getLocalizedMessage());
}
}
}
The code block executes successfully when executed as TestNG Test
.
I have executed the code block converting into TestNG
with the following testng.xml
as follows:
I have executed this code block again as TestNG Suite
. In this case as well the output on the console was:
[TestNG] Running:
C:\Users\AtechM_03\LearnAutmation\LearnAutomationTestNG\testng.xml
ajkcbh
===============================================
Suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================