Skip to content
vic

vic/mill-test-junit-report

Generate JUnit xml reports from Mill's test output.

vic/mill-test-junit-report.json
{
"defaultBranch": "main",
"description": "Generate JUnit xml reports from Mill's test output.",
"fullName": "vic/mill-test-junit-report",
"homepage": "",
"language": "Scala",
"name": "mill-test-junit-report",
"pushedAt": "2025-07-15T04:39:48Z",
"stargazersCount": 5,
"updatedAt": "2025-07-15T04:39:52Z",
"url": "https://github.com/vic/mill-test-junit-report"
}

Generate JUnit XML reports from Mill’s test output.

Section titled “Generate JUnit XML reports from Mill’s test output.”

Many CI/CD servers already support reading JUnit XML reports and integrate well with code-review and merge-requests. However Mill is still more of a Scala niche tool.

This repo contains a tiny Scala utility that can transform Mill test json reports into JUnit XML reports.

Terminal window
ammonite generate-junit-report.sc --help
ammonite generate-junit-report.sc TEST_ID TEST_NAME TARGET_JUNIT_XML_FILE SOURCE_MILL_JSON_FILE...

TEST_ID and TEST_NAME have no special meaning and are for you to decide. You can provide many json files as input and they will be aggreated into a single target xml file.

Suppose you have a build.sc file like:

build.sc
import mill._, scalalib._
object foo extends ScalaModule {
def scalaVersion = "2.13.1"
object test extends Tests {
def ivyDeps = Agg(ivy"com.lihaoyi::utest:0.7.1")
def testFramework = "utest.runner.Framework"
}
}

After running mill foo.test you will find mill’s json report at out/foo/test/test/dest/out.json.

To convert it into JUnit XML format, execute the following ammonite script:

Terminal window
> ammonite generate-junit-report.sc "foo.test" "Foo tests" "foo-junit.xml" "out/foo/test/test/dest/out.json"

that will generate foo-junit.xml.