简体   繁体   English

自定义报告程序在TestNG执行后以编程方式生成Junit xml报告

[英]Custom reporter to generate Junit xml report programmatically after TestNG execution

Need some help in generating junit xml report after TestNG completes execution. 在TestNG完成执行后,在生成junit xml报告时需要一些帮助。

I am invoking TestNG tests programmatically via it's API's hence post execution it does not generate the expected html / junit xml reports that it typically does under the /test-output folder. 我通过它的API以编程方式调用TestNG测试,因此执行后不会生成通常在/ test-output文件夹下生成的预期html / junit xml报告。 I understand I would need to implement IReporter and a listener to kick off the reports in the end of the execution. 我知道我需要实现IReporter和一个侦听器以在执行结束时启动报告。 But, I am specifically interested to know if i can someway get the Junit xml report that TestNG typically generates and not a complete custom reporter. 但是,我特别想知道是否能以某种方式获得TestNG通常生成的Junit xml报告,而不是完整的自定义报告器。

I have a JAVA POJO corresponding to this Junit style which i need to send back as a response to a webservice call and needs to be compatible over a CI pipeline 我有一个与该Junit风格相对应的JAVA POJO,我需要将其作为对Web服务调用的响应发送回去,并且需要通过CI管道兼容

TestNG is generating the JUnit xml without any POJO. TestNG生成没有任何POJO的JUnit xml。

I see 2 solutions for you: 我为您提供2种解决方案:

  • Parsing the generated junit xml after the TestNG run TestNG运行后解析生成的junit xml
  • Implementing your own soap reporter (you can inspire yourself with default testng reporters like JUnitReportReporter or JUnitXMLReporter ) 实现自己的肥皂报告程序(您可以使用默认的Testng报告程序(例如JUnitReportReporterJUnitXMLReporter )来启发自己)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM