mardi 17 mars 2020

Kotlin JUnit5 tests using Bazel target not found

I have a Bazel project in Kotlin and I am trying to run unit tests with JUnit 5. Here are my targets:

kt_jvm_library(
    name = "lib",
    srcs = glob(["src/main/kotlin/**/*.kt"]),
)

kt_jvm_test(
    name = "tests",
    main_class = "org.junit.platform.console.ConsoleLauncher",
    args = [
        "--select-package com.acme",
        "--include-engine junit-jupiter",
    ],
    srcs = glob(["src/test/kotlin/**/*.kt"]),
    deps = [
        ":lib",
        "@maven//:org_junit_jupiter_junit_jupiter_api",
        "@maven//:org_junit_jupiter_junit_jupiter_engine",
        "@maven//:org_junit_jupiter_junit_jupiter_params",
        "@maven//:org_junit_platform_junit_platform_console",
    ],
)

When I run bazel run //:tests, I get this output:

Test run finished after 43 ms
[         1 containers found      ]
[         0 containers skipped    ]
[         1 containers started    ]
[         0 containers aborted    ]
[         1 containers successful ]
[         0 containers failed     ]
[         0 tests found           ]
[         0 tests skipped         ]
[         0 tests started         ]
[         0 tests aborted         ]
[         0 tests successful      ]
[         0 tests failed          ]

As you see, no tests are found. What's wrong with my configuration?

Aucun commentaire:

Enregistrer un commentaire