Skip to content

Could not get test method warnings with munit #8441

Description

@mwisnicki

Tracer Version(s)

1.46.1~8e0205904b

Java Version(s)

21.0.6

JVM Vendor

Eclipse Adoptium / Temurin

Bug Report

When running munit (scala) tests I'm getting a lot of warnings like these:

[dd.trace 2025-02-24 16:19:32:097 +0000] [io-compute-0] WARN datadog.trace.instrumentation.junit4.JUnit4Utils - Could not get test method
java.lang.NoSuchMethodException: com.example.Test.Name of test()
	at java.base/java.lang.Class.getMethod(Class.java:2395)
	at datadog.trace.instrumentation.junit4.JUnit4Utils.getTestMethod(JUnit4Utils.java:139)
	at datadog.trace.instrumentation.junit4.JUnit4Utils.toTestIdentifier(JUnit4Utils.java:297)
	at munit.MUnitRunner.runTest(MUnitRunner.scala:269)
	at munit.MUnitRunner.runTests$$anonfun$1(MUnitRunner.scala:135)
	at scala.collection.Iterator$$anon$9.next(Iterator.scala:584)
	at munit.MUnitRunner.loop$1(MUnitRunner.scala:150)
	at munit.MUnitRunner.sequenceFutures(MUnitRunner.scala:163)
	at munit.MUnitRunner.runTests(MUnitRunner.scala:135)
	at munit.MUnitRunner.runAll$$anonfun$1(MUnitRunner.scala:183)
	at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:470)
	at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:743)

I guess because munit tests don't correspond to actual methods.
The test result seems visible in datadog.

Expected Behavior

No warnings.

Reproduction Code

package com.example

import munit.CatsEffectSuite

class Test extends CatsEffectSuite {
  test("Name of test") {}
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions