You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何让PDK test unit同时输出JUnit报告至文件及测试结果至控制台?

Solution: Output PDK Unit Test Results to Both Console and JUnit Report

I totally get the frustration—having to dig into a JUnit report file just to see why tests failed is a real workflow killer. Good news is PDK supports multiple output formats in a single command, so you can keep the Jenkins-friendly JUnit report and get immediate console output for your devs.

Here's how to adjust your command:

Step 1: Update the PDK Test Command

Instead of specifying just the JUnit format, add a console-friendly format alongside it using multiple --format flags (comma-separated values also work in most PDK versions):

Option 1: Use Progress Format (Concise, Default Style)

This gives you the same compact progress output you'd get without any format flags, plus the JUnit report:

pdk test unit --format=progress --format=junit:report.xml

Option 2: Use Documentation Format (Detailed Test Output)

If your devs want full visibility into each test's pass/fail status right in the console (great for debugging failures quickly), use the documentation format instead:

pdk test unit --format=documentation --format=junit:report.xml

Why This Works

When you only specify --format=junit:report.xml, PDK redirects all test output exclusively to the XML file. By adding a console-focused format, you tell PDK to send output to both the console and the JUnit file simultaneously.

Verify It Works

Run the updated command locally first to confirm:

  • You'll see test results streaming in the console (either progress bars or full test details)
  • The report.xml file will still be generated with all the structured data Jenkins needs for its test dashboard

内容的提问来源于stack exchange,提问作者Michael P.

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 03:24:57