I just googled but didn't get any idea about that how dataprovider publish the test data into default TestNG report. If anybody expert about the internal logic of dataprovider please let me know. It would be appreciate if there is any document to understand this better.
I just created a custom annotation which I want to publish into default testNG HTML report like DataProvider did. I have been tried the below code so far.
The below class will create annotation:
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.METHOD })
public @interface Greet {
/**
* @return - The name of the person to greet.
*/
String name() default "";
}
The below class will get data from user:
public class TestCase1 {
@Test
@DataPublish(name="First Test method_1")
public static void test1() throws Exception {
try {
Assert.assertTrue(true);
}
catch (Exception ex) {
ex.printStackTrace();
}
}
I would like to print that annotation value in testNG default HTML report.
dataprovider
to pass data to your classes that extendTestHTMLReporter.java
orSuiteHTMLReporter.java
or implementsIReporter
depending on what you want to do – user1207289