Karate 如何使用LoggerFactory在空手道最终报告中抛出自定义错误?

Karate 如何使用LoggerFactory在空手道最终报告中抛出自定义错误?,karate,Karate,在java类中,我希望在html报告中显示自定义错误 尝试使用以下语法来实现此目的,但在cucumber html报告中未发现任何失败 public static org.slf4j.Logger logger = LoggerFactory.getLogger("com.intuit.karate"); public static void myMethod() { int a=1; int b=3; if(a!=b) { logger.error("bla bla")

在java类中,我希望在html报告中显示自定义错误

尝试使用以下语法来实现此目的,但在cucumber html报告中未发现任何失败

     public static  org.slf4j.Logger logger = 
 LoggerFactory.getLogger("com.intuit.karate");

public static void myMethod() 
  {
int a=1;
int b=3;
if(a!=b) {
logger.error("bla bla");
         }
 }
我的并行runner类文件如下所示

@KarateOptions(tags = {"~@ignore"})
public class Controller {


@Test
public void testParallel() {
    System.setProperty("karate.env", "acpt"); 
Results results = Runner.parallel(getClass(), 1);
    generateReport(results.getReportDir());
    assertTrue(results.getErrorMessages(), results.getFailCount() == 0);
}

public static void generateReport(String karateOutputPath) {
    Collection<File> jsonFiles = FileUtils.listFiles(new File(karateOutputPath), new String[] {"json"}, true);
    List<String> jsonPaths = new ArrayList(jsonFiles.size());
    jsonFiles.forEach(file -> jsonPaths.add(file.getAbsolutePath()));
    Configuration config = new Configuration(new File("target"), "EPP");
    ReportBuilder reportBuilder = new ReportBuilder(jsonPaths, config);
    reportBuilder.generateReports();
}
}
@KarateOptions(标记={“~@ignore”})
公共类控制器{
@试验
公共void testParallel(){
System.setProperty(“空手道环境”、“acpt”);
结果=Runner.parallel(getClass(),1);
generateReport(results.getReportDir());
assertTrue(results.getErrorMessages(),results.getFailCount()==0);
}
公共静态void生成器报告(字符串karateOutputPath){
Collection jsonFiles=FileUtils.listFiles(新文件(karateOutputPath),新字符串[]{“json”},true);
List jsonpath=newarraylist(jsonFiles.size());
forEach(文件->jsonpath.add(文件.getAbsolutePath());
配置配置=新配置(新文件(“目标”),“EPP”);
ReportBuilder ReportBuilder=newreportbuilder(jsonpath,config);
reportBuilder.generateReports();
}
}

您可以查看此答案中的提示是否有助于您:否则假设不支持此选项。您可以查看此答案中的提示是否有助于您:否则假设不支持此选项。