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 verify the results in my script.
Java:
package com.demoaut.newtours.testcases;
import org.testng.Assert;
import org.testng.annotations.Test;
//import junit.framework.Assert;
public class TC002_CheckAssert {
@Test
public TC002_CheckAssert() {
System.out.println("ajkcbh");
try {
Assert.assertEquals("Pass", "Pass");
}
catch(Exception e) {
System.out.println("Exception:" + e.getLocalizedMessage());
}
}
}
I am executing the above script through testng.xml file.
<suite name="Suite">
<test name="Test">
<classes>
<class name="com.demoaut.newtours.testcases.TC002_CheckAssert" />
</classes>
</test>
</suite>
Console results:
ajkcbh
"==============================================="
Suite
Total tests run: 0, Failures: 0, Skips: 0
"==============================================="
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…