From cdee1c878d5e7b03215e0637eb04b396fcab77a8 Mon Sep 17 00:00:00 2001 From: Daniel Mohedano Date: Mon, 2 Dec 2024 12:04:48 +0100 Subject: [PATCH] Tracing of setup and teardown actions in JUnit 4 (#8030) --- .../junit-4.10/junit-4.13/build.gradle | 28 ++ .../junit-4.10/junit-4.13/gradle.lockfile | 228 ++++++++++++++ .../JUnit4BeforeAfterInstrumentation.java | 69 +++++ .../JUnit4BeforeAfterOperationsTracer.java | 41 +++ .../src/test/groovy/JUnit413Test.groovy | 59 ++++ .../java/org/example/TestFailedAfter.java | 23 ++ .../org/example/TestFailedAfterClass.java | 23 ++ .../org/example/TestFailedAfterParam.java | 40 +++ .../java/org/example/TestFailedBefore.java | 23 ++ .../org/example/TestFailedBeforeClass.java | 23 ++ .../org/example/TestFailedBeforeParam.java | 40 +++ .../org/example/TestSucceedBeforeAfter.java | 25 ++ .../TestSucceedBeforeClassAfterClass.java | 25 ++ .../TestSucceedBeforeParamAfterParam.java | 38 +++ .../test-failed-after-class/coverages.ftl | 1 + .../test-failed-after-class/events.ftl | 224 ++++++++++++++ .../test-failed-after-param/coverages.ftl | 1 + .../test-failed-after-param/events.ftl | 289 ++++++++++++++++++ .../resources/test-failed-after/coverages.ftl | 1 + .../resources/test-failed-after/events.ftl | 249 +++++++++++++++ .../test-failed-before-class/coverages.ftl | 1 + .../test-failed-before-class/events.ftl | 130 ++++++++ .../test-failed-before-param/coverages.ftl | 1 + .../test-failed-before-param/events.ftl | 193 ++++++++++++ .../test-failed-before/coverages.ftl | 1 + .../resources/test-failed-before/events.ftl | 249 +++++++++++++++ .../test-succeed-before-after/coverages.ftl | 1 + .../test-succeed-before-after/events.ftl | 277 +++++++++++++++++ .../coverages.ftl | 1 + .../events.ftl | 239 +++++++++++++++ .../coverages.ftl | 1 + .../events.ftl | 283 +++++++++++++++++ gradle/configure_tests.gradle | 1 + settings.gradle | 1 + 34 files changed, 2829 insertions(+) create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/build.gradle create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/gradle.lockfile create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterInstrumentation.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterOperationsTracer.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/groovy/JUnit413Test.groovy create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfter.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterClass.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterParam.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBefore.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeClass.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeParam.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeAfter.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeClassAfterClass.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeParamAfterParam.java create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/events.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/coverages.ftl create mode 100644 dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/events.ftl diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/build.gradle b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/build.gradle new file mode 100644 index 00000000000..0de58ffa9c0 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/build.gradle @@ -0,0 +1,28 @@ +apply from: "$rootDir/gradle/java.gradle" + +muzzle { + pass { + group = 'junit' + module = 'junit' + versions = '[4.13,5)' + } +} + +addTestSuiteForDir('latestDepTest', 'test') + +dependencies { + implementation project(':dd-java-agent:instrumentation:junit-4.10') + compileOnly group: 'junit', name: 'junit', version: '4.13' + + testImplementation testFixtures(project(':dd-java-agent:agent-ci-visibility')) + + // version used below is not the minimum one that we support, + // but the tests need to use it in order to be compliant with Spock 2.x + testImplementation(group: 'junit', name: 'junit') { + version { + strictly '4.13.2' + } + } + + latestDepTestImplementation group: 'junit', name: 'junit', version: '4.+' +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/gradle.lockfile b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/gradle.lockfile new file mode 100644 index 00000000000..092cf2a268d --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/gradle.lockfile @@ -0,0 +1,228 @@ +# This is a Gradle generated file for dependency locking. +# Manual edits can break the build and are not advised. +# This file is expected to be part of source control. +cafe.cryptography:curve25519-elisabeth:0.1.0=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +cafe.cryptography:ed25519-elisabeth:0.1.0=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +ch.qos.logback:logback-classic:1.2.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +ch.qos.logback:logback-core:1.2.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.beust:jcommander:1.78=latestDepTestRuntimeClasspath,testRuntimeClasspath +com.blogspot.mydailyjava:weak-lock-free:0.17=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq.okhttp3:okhttp:3.12.15=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq.okio:okio:1.17.6=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq:dd-javac-plugin-client:0.1.7=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleBootstrap,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.datadoghq:java-dogstatsd-client:4.4.0=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.datadoghq:sketches-java:0.8.3=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.eed3si9n:shaded-jawn-parser_2.13:0.9.1=zinc +com.eed3si9n:shaded-scalajson_2.13:1.0.0-M4=zinc +com.eed3si9n:sjson-new-core_2.13:0.9.1=zinc +com.eed3si9n:sjson-new-scalajson_2.13:0.9.1=zinc +com.fasterxml.jackson.core:jackson-annotations:2.16.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-core:2.16.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson.core:jackson-databind:2.16.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.fasterxml.jackson:jackson-bom:2.16.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.github.javaparser:javaparser-core:3.25.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.github.jnr:jffi:1.3.13=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-a64asm:1.0.0=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-constants:0.10.4=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-enxio:0.32.17=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-ffi:2.2.16=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-posix:3.1.19=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-unixsocket:0.38.22=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.jnr:jnr-x86asm:1.0.2=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.github.spotbugs:spotbugs-annotations:4.2.0=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.github.spotbugs:spotbugs-annotations:4.7.3=spotbugs +com.github.spotbugs:spotbugs:4.7.3=spotbugs +com.github.stefanbirkner:system-rules:1.19.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.auto.service:auto-service-annotations:1.0-rc7=annotationProcessor,compileClasspath,latestDepTestAnnotationProcessor,latestDepTestCompileClasspath,testAnnotationProcessor,testCompileClasspath +com.google.auto.service:auto-service:1.0-rc7=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.auto:auto-common:0.10=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.code.findbugs:jsr305:3.0.2=annotationProcessor,compileClasspath,latestDepTestAnnotationProcessor,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,spotbugs,testAnnotationProcessor,testCompileClasspath,testRuntimeClasspath +com.google.code.gson:gson:2.9.1=spotbugs +com.google.errorprone:error_prone_annotations:2.2.0=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.guava:failureaccess:1.0.1=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.guava:guava:20.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.google.guava:guava:27.0.1-jre=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.j2objc:j2objc-annotations:1.1=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +com.google.re2j:re2j:1.7=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +com.jayway.jsonpath:json-path:2.8.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.lmax:disruptor:3.4.2=zinc +com.squareup.moshi:moshi:1.11.0=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.squareup.okhttp3:logging-interceptor:3.12.12=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.squareup.okhttp3:okhttp:3.12.12=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.squareup.okio:okio:1.17.5=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.swoval:file-tree-views:2.1.10=zinc +com.thoughtworks.qdox:qdox:1.12.1=latestDepTestRuntimeClasspath,testRuntimeClasspath +com.vaadin.external.google:android-json:0.0.20131108.vaadin1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +commons-codec:commons-codec:1.15=spotbugs +commons-fileupload:commons-fileupload:1.5=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +commons-io:commons-io:2.11.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +de.thetaphi:forbiddenapis:3.1=compileClasspath +info.picocli:picocli:4.6.3=latestDepTestRuntimeClasspath,testRuntimeClasspath +io.github.java-diff-utils:java-diff-utils:4.12=zinc +io.sqreen:libsqreen:11.1.0=latestDepTestRuntimeClasspath,testRuntimeClasspath +javax.servlet:javax.servlet-api:3.1.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +jaxen:jaxen:1.2.0=spotbugs +jline:jline:2.14.6=latestDepTestRuntimeClasspath,testRuntimeClasspath +junit:junit-dep:4.11=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +junit:junit:4.13.2=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy-agent:1.14.18=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.bytebuddy:byte-buddy:1.14.18=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +net.java.dev.jna:jna-platform:5.13.0=zinc +net.java.dev.jna:jna-platform:5.8.0=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +net.java.dev.jna:jna:5.13.0=zinc +net.java.dev.jna:jna:5.8.0=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +net.jcip:jcip-annotations:1.0=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,spotbugs,testCompileClasspath,testRuntimeClasspath +net.minidev:accessors-smart:2.4.9=latestDepTestRuntimeClasspath,testRuntimeClasspath +net.minidev:json-smart:2.4.10=latestDepTestRuntimeClasspath,testRuntimeClasspath +net.openhft:zero-allocation-hashing:0.10.1=zinc +net.sf.saxon:Saxon-HE:11.4=spotbugs +org.apache.ant:ant-antlr:1.10.12=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.apache.ant:ant-antlr:1.9.15=codenarc +org.apache.ant:ant-junit:1.10.12=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.apache.ant:ant-junit:1.9.15=codenarc +org.apache.ant:ant-launcher:1.10.12=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.apache.ant:ant:1.10.12=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.apache.bcel:bcel:6.5.0=spotbugs +org.apache.commons:commons-lang3:3.12.0=spotbugs +org.apache.commons:commons-text:1.10.0=spotbugs +org.apache.httpcomponents.client5:httpclient5:5.1.3=spotbugs +org.apache.httpcomponents.core5:httpcore5-h2:5.1.3=spotbugs +org.apache.httpcomponents.core5:httpcore5:5.1.3=spotbugs +org.apache.logging.log4j:log4j-api:2.17.1=zinc +org.apache.logging.log4j:log4j-api:2.19.0=spotbugs +org.apache.logging.log4j:log4j-core:2.17.1=zinc +org.apache.logging.log4j:log4j-core:2.19.0=spotbugs +org.apiguardian:apiguardian-api:1.1.2=latestDepTestCompileClasspath,testCompileClasspath +org.checkerframework:checker-qual:2.5.2=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +org.codehaus.groovy:groovy-all:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-ant:2.5.14=codenarc +org.codehaus.groovy:groovy-ant:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-astbuilder:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-cli-picocli:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-console:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-datetime:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-docgenerator:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-groovydoc:2.5.14=codenarc +org.codehaus.groovy:groovy-groovydoc:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-groovysh:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-jmx:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-json:2.5.14=codenarc +org.codehaus.groovy:groovy-json:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-jsr223:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-macro:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-nio:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-servlet:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-sql:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-swing:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-templates:2.5.14=codenarc +org.codehaus.groovy:groovy-templates:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-test-junit5:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-test:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-testng:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy-xml:2.5.14=codenarc +org.codehaus.groovy:groovy-xml:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.groovy:groovy:2.5.14=codenarc +org.codehaus.groovy:groovy:3.0.17=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.codehaus.mojo:animal-sniffer-annotations:1.17=annotationProcessor,latestDepTestAnnotationProcessor,testAnnotationProcessor +org.codenarc:CodeNarc:2.2.0=codenarc +org.dom4j:dom4j:2.1.3=spotbugs +org.eclipse.jetty:jetty-http:9.4.56.v20240826=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.eclipse.jetty:jetty-io:9.4.56.v20240826=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.eclipse.jetty:jetty-server:9.4.56.v20240826=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.eclipse.jetty:jetty-util:9.4.56.v20240826=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.freemarker:freemarker:2.3.30=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.fusesource.jansi:jansi:2.1.0=zinc +org.gmetrics:GMetrics:1.1=codenarc +org.hamcrest:hamcrest-core:1.3=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.hamcrest:hamcrest:2.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jacoco:org.jacoco.core:0.8.12=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.jacoco:org.jacoco.report:0.8.12=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.jctools:jctools-core:3.3.0=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:1.6.21=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jetbrains:annotations:13.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jline:jline-terminal-jansi:3.19.0=zinc +org.jline:jline-terminal-jna:3.19.0=zinc +org.jline:jline-terminal:3.19.0=zinc +org.jline:jline:3.22.0=zinc +org.junit.jupiter:junit-jupiter-api:5.9.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.jupiter:junit-jupiter-engine:5.9.2=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-commons:1.9.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-engine:1.9.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-launcher:1.9.2=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-runner:1.9.2=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-suite-api:1.9.2=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit.platform:junit-platform-suite-commons:1.9.2=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.junit:junit-bom:5.9.1=spotbugs +org.junit:junit-bom:5.9.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.msgpack:jackson-dataformat-msgpack:0.9.6=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.msgpack:msgpack-core:0.9.6=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.objenesis:objenesis:3.3=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.opentest4j:opentest4j:1.2.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.ow2.asm:asm-analysis:9.2=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-analysis:9.4=spotbugs +org.ow2.asm:asm-commons:9.2=instrumentPluginClasspath,muzzleTooling,runtimeClasspath +org.ow2.asm:asm-commons:9.4=spotbugs +org.ow2.asm:asm-commons:9.7=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-tree:9.2=instrumentPluginClasspath,muzzleTooling,runtimeClasspath +org.ow2.asm:asm-tree:9.4=spotbugs +org.ow2.asm:asm-tree:9.7=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-util:9.2=instrumentPluginClasspath,latestDepTestRuntimeClasspath,muzzleTooling,runtimeClasspath,testRuntimeClasspath +org.ow2.asm:asm-util:9.4=spotbugs +org.ow2.asm:asm:9.2=instrumentPluginClasspath,muzzleTooling,runtimeClasspath +org.ow2.asm:asm:9.4=spotbugs +org.ow2.asm:asm:9.7=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.scala-lang.modules:scala-parallel-collections_2.13:0.2.0=zinc +org.scala-lang.modules:scala-parser-combinators_2.13:1.1.2=zinc +org.scala-lang.modules:scala-xml_2.13:2.1.0=zinc +org.scala-lang:scala-compiler:2.13.11=zinc +org.scala-lang:scala-library:2.13.10=testCompileClasspath,testRuntimeClasspath +org.scala-lang:scala-library:2.13.11=zinc +org.scala-lang:scala-library:2.13.14=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.scala-lang:scala-library:2.13.6=compileClasspath +org.scala-lang:scala-reflect:2.13.11=zinc +org.scala-sbt.jline:jline:2.14.7-sbt-a1b0ffbb8f64bb820f4f84a0c07a0c0964507493=zinc +org.scala-sbt:collections_2.13:1.9.2=zinc +org.scala-sbt:compiler-bridge_2.13:1.9.3=zinc +org.scala-sbt:compiler-interface:1.9.3=zinc +org.scala-sbt:core-macros_2.13:1.9.2=zinc +org.scala-sbt:io_2.13:1.9.1=zinc +org.scala-sbt:launcher-interface:1.4.2=zinc +org.scala-sbt:sbinary_2.13:0.5.1=zinc +org.scala-sbt:test-interface:1.0=compileClasspath,latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.scala-sbt:util-control_2.13:1.9.2=zinc +org.scala-sbt:util-interface:1.9.2=zinc +org.scala-sbt:util-logging_2.13:1.9.2=zinc +org.scala-sbt:util-position_2.13:1.9.2=zinc +org.scala-sbt:util-relation_2.13:1.9.2=zinc +org.scala-sbt:zinc-apiinfo_2.13:1.9.3=zinc +org.scala-sbt:zinc-classfile_2.13:1.9.3=zinc +org.scala-sbt:zinc-classpath_2.13:1.9.3=zinc +org.scala-sbt:zinc-compile-core_2.13:1.9.3=zinc +org.scala-sbt:zinc-core_2.13:1.9.3=zinc +org.scala-sbt:zinc-persist-core-assembly:1.9.3=zinc +org.scala-sbt:zinc-persist_2.13:1.9.3=zinc +org.scala-sbt:zinc_2.13:1.9.3=zinc +org.scalameta:junit-interface:0.7.28=compileClasspath,testCompileClasspath,testRuntimeClasspath +org.scalameta:junit-interface:1.0.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.scalameta:munit-diff_2.13:1.0.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.scalameta:munit_2.13:0.7.28=compileClasspath,testCompileClasspath,testRuntimeClasspath +org.scalameta:munit_2.13:1.0.2=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath +org.skyscreamer:jsonassert:1.5.1=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:jcl-over-slf4j:1.7.30=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:jul-to-slf4j:1.7.30=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:log4j-over-slf4j:1.7.30=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:1.7.30=compileClasspath,instrumentPluginClasspath,latestDepTestCompileClasspath,muzzleBootstrap,muzzleTooling,runtimeClasspath,testCompileClasspath +org.slf4j:slf4j-api:1.7.36=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.slf4j:slf4j-api:2.0.0=spotbugs,spotbugsSlf4j +org.slf4j:slf4j-simple:2.0.0=spotbugsSlf4j +org.spockframework:spock-core:2.2-groovy-3.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.spockframework:spock-junit4:2.2-groovy-3.0=latestDepTestCompileClasspath,latestDepTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +org.testng:testng:7.5=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.webjars:jquery:3.5.1=latestDepTestRuntimeClasspath,testRuntimeClasspath +org.xmlresolver:xmlresolver:4.4.3=spotbugs +xml-apis:xml-apis:1.4.01=spotbugs +empty=scalaCompilerPlugins,spotbugsPlugins diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterInstrumentation.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterInstrumentation.java new file mode 100644 index 00000000000..64fa95ca93c --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterInstrumentation.java @@ -0,0 +1,69 @@ +package datadog.trace.instrumentation.junit4; + +import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named; +import static net.bytebuddy.matcher.ElementMatchers.takesArgument; + +import com.google.auto.service.AutoService; +import datadog.trace.agent.tooling.Instrumenter; +import datadog.trace.agent.tooling.InstrumenterModule; +import datadog.trace.bootstrap.instrumentation.api.AgentScope; +import net.bytebuddy.asm.Advice; +import org.junit.runner.manipulation.InvalidOrderingException; +import org.junit.runner.manipulation.Ordering; +import org.junit.runners.model.FrameworkMethod; + +@AutoService(InstrumenterModule.class) +public class JUnit4BeforeAfterInstrumentation extends InstrumenterModule.CiVisibility + implements Instrumenter.ForKnownTypes { + + public JUnit4BeforeAfterInstrumentation() { + super("ci-visibility", "junit-4", "setup-teardown"); + } + + @Override + public String[] knownMatchingTypes() { + return new String[] { + "org.junit.internal.runners.statements.RunBefores", + "org.junit.internal.runners.statements.RunAfters", + "org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters$RunBeforeParams", + "org.junit.runners.parameterized.BlockJUnit4ClassRunnerWithParameters$RunAfterParams", + }; + } + + @Override + public String[] helperClassNames() { + return new String[] { + packageName + ".JUnit4BeforeAfterOperationsTracer", + }; + } + + @Override + public void methodAdvice(MethodTransformer transformer) { + transformer.applyAdvice( + named("invokeMethod") + .and(takesArgument(0, named("org.junit.runners.model.FrameworkMethod"))), + JUnit4BeforeAfterInstrumentation.class.getName() + "$RunBeforesAftersAdvice"); + } + + public static class RunBeforesAftersAdvice { + @Advice.OnMethodEnter(suppress = Throwable.class) + public static AgentScope startCallSpan(@Advice.Argument(0) final FrameworkMethod method) { + return JUnit4BeforeAfterOperationsTracer.startTrace(method.getMethod()); + } + + @Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class) + public static void finishCallSpan( + @Advice.Enter final AgentScope scope, @Advice.Thrown final Throwable throwable) { + JUnit4BeforeAfterOperationsTracer.endTrace(scope, throwable); + } + + // JUnit 4.13 and above + public static void muzzleCheck(final Ordering ord) { + try { + ord.apply(null); + } catch (InvalidOrderingException e) { + throw new RuntimeException(e); + } + } + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterOperationsTracer.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterOperationsTracer.java new file mode 100644 index 00000000000..1e41f817349 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/main/java/datadog/trace/instrumentation/junit4/JUnit4BeforeAfterOperationsTracer.java @@ -0,0 +1,41 @@ +package datadog.trace.instrumentation.junit4; + +import datadog.trace.bootstrap.instrumentation.api.AgentScope; +import datadog.trace.bootstrap.instrumentation.api.AgentSpan; +import datadog.trace.bootstrap.instrumentation.api.AgentTracer; +import datadog.trace.bootstrap.instrumentation.api.Tags; +import java.lang.reflect.Method; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.runners.Parameterized; + +public class JUnit4BeforeAfterOperationsTracer { + public static AgentScope startTrace(final Method method) { + final AgentSpan span = AgentTracer.startSpan("junit", method.getName()); + if (method.isAnnotationPresent(Before.class)) { + span.setTag(Tags.TEST_CALLBACK, "Before"); + } else if (method.isAnnotationPresent(After.class)) { + span.setTag(Tags.TEST_CALLBACK, "After"); + } else if (method.isAnnotationPresent(BeforeClass.class)) { + span.setTag(Tags.TEST_CALLBACK, "BeforeClass"); + } else if (method.isAnnotationPresent(AfterClass.class)) { + span.setTag(Tags.TEST_CALLBACK, "AfterClass"); + } else if (method.isAnnotationPresent(Parameterized.BeforeParam.class)) { + span.setTag(Tags.TEST_CALLBACK, "BeforeParam"); + } else if (method.isAnnotationPresent(Parameterized.AfterParam.class)) { + span.setTag(Tags.TEST_CALLBACK, "AfterParam"); + } + return AgentTracer.activateSpan(span); + } + + public static void endTrace(final AgentScope scope, final Throwable throwable) { + final AgentSpan span = scope.span(); + if (throwable != null) { + span.addThrowable(throwable); + } + scope.close(); + span.finish(); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/groovy/JUnit413Test.groovy b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/groovy/JUnit413Test.groovy new file mode 100644 index 00000000000..a31d757f760 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/groovy/JUnit413Test.groovy @@ -0,0 +1,59 @@ +import datadog.trace.api.DisableTestTrace +import datadog.trace.civisibility.CiVisibilityInstrumentationTest +import datadog.trace.instrumentation.junit4.TestEventsHandlerHolder +import junit.runner.Version +import org.example.TestFailedAfter +import org.example.TestFailedAfterClass +import org.example.TestFailedAfterParam +import org.example.TestFailedBefore +import org.example.TestFailedBeforeClass +import org.example.TestFailedBeforeParam +import org.example.TestSucceedBeforeAfter +import org.example.TestSucceedBeforeClassAfterClass +import org.example.TestSucceedBeforeParamAfterParam +import org.junit.runner.JUnitCore + +@DisableTestTrace(reason = "avoid self-tracing") +class JUnit413Test extends CiVisibilityInstrumentationTest { + + def runner = new JUnitCore() + + def "test #testcaseName"() { + runTests(tests) + + assertSpansData(testcaseName, expectedTracesCount) + + where: + testcaseName | tests | expectedTracesCount + "test-succeed-before-after" | [TestSucceedBeforeAfter] | 3 + "test-succeed-before-class-after-class" | [TestSucceedBeforeClassAfterClass] | 3 + "test-succeed-before-param-after-param" | [TestSucceedBeforeParamAfterParam] | 2 + "test-failed-before-class" | [TestFailedBeforeClass] | 1 + "test-failed-after-class" | [TestFailedAfterClass] | 3 + "test-failed-before" | [TestFailedBefore] | 3 + "test-failed-after" | [TestFailedAfter] | 3 + "test-failed-before-param" | [TestFailedBeforeParam] | 2 + "test-failed-after-param" | [TestFailedAfterParam] | 2 + } + + private void runTests(Collection> tests) { + TestEventsHandlerHolder.start() + try { + Class[] array = tests.toArray(new Class[0]) + runner.run(array) + } catch (Throwable ignored) { + // Ignored + } + TestEventsHandlerHolder.stop() + } + + @Override + String instrumentedLibraryName() { + return "junit4" + } + + @Override + String instrumentedLibraryVersion() { + return Version.id() + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfter.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfter.java new file mode 100644 index 00000000000..7581a79c5ca --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfter.java @@ -0,0 +1,23 @@ +package org.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Test; + +public class TestFailedAfter { + @After + public void tearDown() { + throw new RuntimeException("testcase teardown failed"); + } + + @Test + public void test_succeed() { + assertTrue(true); + } + + @Test + public void another_test_succeed() { + assertTrue(true); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterClass.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterClass.java new file mode 100644 index 00000000000..24470257301 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterClass.java @@ -0,0 +1,23 @@ +package org.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.Test; + +public class TestFailedAfterClass { + @AfterClass + public static void tearDown() { + throw new RuntimeException("suite teardown failed"); + } + + @Test + public void test_succeed() { + assertTrue(true); + } + + @Test + public void another_test_succeed() { + assertTrue(true); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterParam.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterParam.java new file mode 100644 index 00000000000..6faee23ed5d --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedAfterParam.java @@ -0,0 +1,40 @@ +package org.example; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class TestFailedAfterParam { + private final int num1; + private final int num2; + private final int sum; + + public TestFailedAfterParam(final int num1, final int num2, final int sum) { + this.num1 = num1; + this.num2 = num2; + this.sum = sum; + } + + @Parameterized.BeforeParam + public static void setup() {} + + @Parameterized.AfterParam + public static void tearDown() { + throw new RuntimeException("after param setup failed"); + } + + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList(new Object[][] {{0, 0, 0}, {1, 1, 2}}); + } + + @Test + public void parameterized_test_succeed() { + assertEquals(num1 + num2, sum); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBefore.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBefore.java new file mode 100644 index 00000000000..bca82898209 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBefore.java @@ -0,0 +1,23 @@ +package org.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.Before; +import org.junit.Test; + +public class TestFailedBefore { + @Before + public void setup() { + throw new RuntimeException("testcase setup failed"); + } + + @Test + public void test_succeed() { + assertTrue(true); + } + + @Test + public void another_test_succeed() { + assertTrue(true); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeClass.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeClass.java new file mode 100644 index 00000000000..a7b0c38b059 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeClass.java @@ -0,0 +1,23 @@ +package org.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestFailedBeforeClass { + @BeforeClass + public static void setup() { + throw new RuntimeException("suite setup failed"); + } + + @Test + public void test_succeed() { + assertTrue(true); + } + + @Test + public void another_test_succeed() { + assertTrue(true); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeParam.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeParam.java new file mode 100644 index 00000000000..77f5b1a682b --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestFailedBeforeParam.java @@ -0,0 +1,40 @@ +package org.example; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class TestFailedBeforeParam { + private final int num1; + private final int num2; + private final int sum; + + public TestFailedBeforeParam(final int num1, final int num2, final int sum) { + this.num1 = num1; + this.num2 = num2; + this.sum = sum; + } + + @Parameterized.BeforeParam + public static void setup() { + throw new RuntimeException("before param setup failed"); + } + + @Parameterized.AfterParam + public static void tearDown() {} + + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList(new Object[][] {{0, 0, 0}, {1, 1, 2}}); + } + + @Test + public void parameterized_test_succeed() { + assertEquals(num1 + num2, sum); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeAfter.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeAfter.java new file mode 100644 index 00000000000..347c4ce185c --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeAfter.java @@ -0,0 +1,25 @@ +package org.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +public class TestSucceedBeforeAfter { + @Before + public void setup() {} + + @After + public void tearDown() {} + + @Test + public void test_succeed() { + assertTrue(true); + } + + @Test + public void another_test_succeed() { + assertTrue(true); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeClassAfterClass.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeClassAfterClass.java new file mode 100644 index 00000000000..6c39c071486 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeClassAfterClass.java @@ -0,0 +1,25 @@ +package org.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +public class TestSucceedBeforeClassAfterClass { + @BeforeClass + public static void setup() {} + + @AfterClass + public static void tearDown() {} + + @Test + public void test_succeed() { + assertTrue(true); + } + + @Test + public void another_test_succeed() { + assertTrue(true); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeParamAfterParam.java b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeParamAfterParam.java new file mode 100644 index 00000000000..a5ffd17a693 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/java/org/example/TestSucceedBeforeParamAfterParam.java @@ -0,0 +1,38 @@ +package org.example; + +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Collection; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class TestSucceedBeforeParamAfterParam { + private final int num1; + private final int num2; + private final int sum; + + public TestSucceedBeforeParamAfterParam(final int num1, final int num2, final int sum) { + this.num1 = num1; + this.num2 = num2; + this.sum = sum; + } + + @Parameterized.BeforeParam + public static void setup() {} + + @Parameterized.AfterParam + public static void tearDown() {} + + @Parameterized.Parameters + public static Collection data() { + return Arrays.asList(new Object[][] {{0, 0, 0}, {1, 1, 2}}); + } + + @Test + public void parameterized_test_succeed() { + assertEquals(num1 + num2, sum); + } +} diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/events.ftl new file mode 100644 index 00000000000..25474df8081 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-class/events.ftl @@ -0,0 +1,224 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "fail", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedAfterClass", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 1, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "error.type" : "java.lang.RuntimeException", + "span.kind" : "test_suite_end", + "error.message" : ${content_meta_error_message}, + "test.suite" : "org.example.TestFailedAfterClass", + "error.stack" : ${content_meta_error_stack}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedAfterClass.another_test_succeed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "another_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "another_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedAfterClass", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedAfterClass.test_succeed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedAfterClass", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 1, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_4}, + "error.stack" : ${content_meta_error_stack_2}, + "test.callback" : "AfterClass", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/events.ftl new file mode 100644 index 00000000000..33a0c175bfd --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after-param/events.ftl @@ -0,0 +1,289 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "pass", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedAfterParam", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestFailedAfterParam", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedAfterParam.parameterized_test_succeed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "parameterized_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedAfterParam", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.parameters" : "{\"metadata\":{\"test_name\":\"parameterized_test_succeed[0]\"}}", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedAfterParam.parameterized_test_succeed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "parameterized_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedAfterParam", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.parameters" : "{\"metadata\":{\"test_name\":\"parameterized_test_succeed[1]\"}}", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_4}, + "test.callback" : "BeforeParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_5}, + "test.callback" : "BeforeParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_5}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_8}, + "duration" : ${content_duration_8}, + "error" : 1, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_6}, + "error.stack" : ${content_meta_error_stack}, + "test.callback" : "AfterParam", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_6}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_9}, + "duration" : ${content_duration_9}, + "error" : 1, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_7}, + "error.stack" : ${content_meta_error_stack_2}, + "test.callback" : "AfterParam", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/events.ftl new file mode 100644 index 00000000000..bf98663d9e0 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-after/events.ftl @@ -0,0 +1,249 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "fail", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedAfter", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestFailedAfter", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedAfter.another_test_succeed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "another_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "another_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedAfter", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "error.type" : "java.lang.RuntimeException", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedAfter.test_succeed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedAfter", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "error.type" : "java.lang.RuntimeException", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_span_id_2}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 1, + "metrics" : { }, + "meta" : { + "error.stack" : ${content_meta_error_stack_3}, + "test.callback" : "After", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_span_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 1, + "metrics" : { }, + "meta" : { + "error.stack" : ${content_meta_error_stack_4}, + "test.callback" : "After", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/events.ftl new file mode 100644 index 00000000000..ee89aa70ba7 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-class/events.ftl @@ -0,0 +1,130 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "fail", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedBeforeClass", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 1, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "error.type" : "java.lang.RuntimeException", + "span.kind" : "test_suite_end", + "error.message" : ${content_meta_error_message}, + "test.suite" : "org.example.TestFailedBeforeClass", + "error.stack" : ${content_meta_error_stack}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 1, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_4}, + "error.stack" : ${content_meta_error_stack_2}, + "test.callback" : "BeforeClass", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/events.ftl new file mode 100644 index 00000000000..2399e8b5b57 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before-param/events.ftl @@ -0,0 +1,193 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "skip", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "skip", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedBeforeParam", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "skip", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestFailedBeforeParam", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 1, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_4}, + "error.stack" : ${content_meta_error_stack}, + "test.callback" : "BeforeParam", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 1, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_5}, + "error.stack" : ${content_meta_error_stack_2}, + "test.callback" : "BeforeParam", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_6}, + "test.callback" : "AfterParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_7}, + "test.callback" : "AfterParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/events.ftl new file mode 100644 index 00000000000..8ffd3be0f0e --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-failed-before/events.ftl @@ -0,0 +1,249 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "fail", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestFailedBefore", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "fail", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestFailedBefore", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedBefore.another_test_succeed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "another_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "another_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedBefore", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "error.type" : "java.lang.RuntimeException", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestFailedBefore.test_succeed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 1, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "fail", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestFailedBefore", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "error.type" : "java.lang.RuntimeException", + "_dd.profiling.ctx" : "test", + "error.message" : ${content_meta_error_message}, + "error.stack" : ${content_meta_error_stack_2}, + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_span_id_2}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 1, + "metrics" : { }, + "meta" : { + "error.stack" : ${content_meta_error_stack_3}, + "test.callback" : "Before", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_span_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 1, + "metrics" : { }, + "meta" : { + "error.stack" : ${content_meta_error_stack_4}, + "test.callback" : "Before", + "library_version" : ${content_meta_library_version}, + "error.type" : "java.lang.RuntimeException", + "env" : "none", + "error.message" : ${content_meta_error_message} + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/events.ftl new file mode 100644 index 00000000000..4d08b025bb8 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-after/events.ftl @@ -0,0 +1,277 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "pass", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestSucceedBeforeAfter", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestSucceedBeforeAfter", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestSucceedBeforeAfter.another_test_succeed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "another_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "another_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestSucceedBeforeAfter", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestSucceedBeforeAfter.test_succeed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestSucceedBeforeAfter", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_span_id_2}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.callback" : "Before", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_span_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.callback" : "Before", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_5}, + "parent_id" : ${content_span_id_2}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_8}, + "duration" : ${content_duration_8}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.callback" : "After", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id_6}, + "parent_id" : ${content_span_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_9}, + "duration" : ${content_duration_9}, + "error" : 0, + "metrics" : { }, + "meta" : { + "test.callback" : "After", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/events.ftl new file mode 100644 index 00000000000..03682ac982c --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-class-after-class/events.ftl @@ -0,0 +1,239 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "pass", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestSucceedBeforeClassAfterClass", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestSucceedBeforeClassAfterClass", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestSucceedBeforeClassAfterClass.another_test_succeed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "another_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "another_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestSucceedBeforeClassAfterClass", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestSucceedBeforeClassAfterClass.test_succeed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestSucceedBeforeClassAfterClass", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_4}, + "test.callback" : "BeforeClass", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_5}, + "test.callback" : "AfterClass", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +} ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/coverages.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/coverages.ftl new file mode 100644 index 00000000000..8878e547a79 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/coverages.ftl @@ -0,0 +1 @@ +[ ] \ No newline at end of file diff --git a/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/events.ftl b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/events.ftl new file mode 100644 index 00000000000..d74bcbb5294 --- /dev/null +++ b/dd-java-agent/instrumentation/junit-4.10/junit-4.13/src/test/resources/test-succeed-before-param-after-param/events.ftl @@ -0,0 +1,283 @@ +[ { + "type" : "test_session_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_session", + "resource" : "junit-4.13", + "start" : ${content_start}, + "duration" : ${content_duration}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count}, + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid}, + "test.type" : "test", + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.status" : "pass", + "test_session.name" : "session-name", + "language" : "jvm", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "_dd.profiling.ctx" : "test", + "span.kind" : "test_session_end", + "runtime-id" : ${content_meta_runtime_id}, + "test.command" : "junit-4.13", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_module_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_module", + "resource" : "junit-4.13", + "start" : ${content_start_2}, + "duration" : ${content_duration_2}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_2} + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_2}, + "test.type" : "test", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_module_end", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test_suite_end", + "version" : 1, + "content" : { + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test_suite", + "resource" : "org.example.TestSucceedBeforeParamAfterParam", + "start" : ${content_start_3}, + "duration" : ${content_duration_3}, + "error" : 0, + "metrics" : { + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_3}, + "test.source.end" : 19, + "test.source.start" : 11 + }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_3}, + "test.type" : "test", + "test.source.file" : "dummy_source_path", + "test.module" : "junit-4.13", + "test.status" : "pass", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "component" : "junit", + "span.kind" : "test_suite_end", + "test.suite" : "org.example.TestSucceedBeforeParamAfterParam", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id}, + "span_id" : ${content_span_id}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestSucceedBeforeParamAfterParam.parameterized_test_succeed", + "start" : ${content_start_4}, + "duration" : ${content_duration_4}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_4}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "parameterized_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestSucceedBeforeParamAfterParam", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.parameters" : "{\"metadata\":{\"test_name\":\"parameterized_test_succeed[0]\"}}", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "test", + "version" : 2, + "content" : { + "trace_id" : ${content_trace_id_2}, + "span_id" : ${content_span_id_2}, + "parent_id" : ${content_parent_id}, + "test_session_id" : ${content_test_session_id}, + "test_module_id" : ${content_test_module_id}, + "test_suite_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "junit.test", + "resource" : "org.example.TestSucceedBeforeParamAfterParam.parameterized_test_succeed", + "start" : ${content_start_5}, + "duration" : ${content_duration_5}, + "error" : 0, + "metrics" : { + "process_id" : ${content_metrics_process_id}, + "_dd.profiling.enabled" : 0, + "_dd.trace_span_attribute_schema" : 0, + "_dd.host.vcpu_count" : ${content_metrics__dd_host_vcpu_count_5}, + "test.source.end" : 18, + "test.source.start" : 12 + }, + "meta" : { + "_dd.tracer_host" : ${content_meta__dd_tracer_host}, + "test.source.file" : "dummy_source_path", + "test.source.method" : "parameterized_test_succeed()V", + "test.module" : "junit-4.13", + "test.status" : "pass", + "language" : "jvm", + "test.codeowners" : "[\"owner1\",\"owner2\"]", + "library_version" : ${content_meta_library_version}, + "test.name" : "parameterized_test_succeed", + "span.kind" : "test", + "test.suite" : "org.example.TestSucceedBeforeParamAfterParam", + "runtime-id" : ${content_meta_runtime_id}, + "test.type" : "test", + "test_session.name" : "session-name", + "env" : "none", + "dummy_ci_tag" : "dummy_ci_tag_value", + "test.parameters" : "{\"metadata\":{\"test_name\":\"parameterized_test_succeed[1]\"}}", + "component" : "junit", + "_dd.profiling.ctx" : "test", + "test.framework_version" : ${content_meta_test_framework_version}, + "test.framework" : "junit4" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_3}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_6}, + "duration" : ${content_duration_6}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_4}, + "test.callback" : "BeforeParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_4}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "setup", + "resource" : "setup", + "start" : ${content_start_7}, + "duration" : ${content_duration_7}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_5}, + "test.callback" : "BeforeParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_5}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_8}, + "duration" : ${content_duration_8}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_6}, + "test.callback" : "AfterParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +}, { + "type" : "span", + "version" : 1, + "content" : { + "trace_id" : ${content_test_session_id}, + "span_id" : ${content_span_id_6}, + "parent_id" : ${content_test_suite_id}, + "service" : "worker.org.gradle.process.internal.worker.gradleworkermain", + "name" : "tearDown", + "resource" : "tearDown", + "start" : ${content_start_9}, + "duration" : ${content_duration_9}, + "error" : 0, + "metrics" : { }, + "meta" : { + "_dd.p.tid" : ${content_meta__dd_p_tid_7}, + "test.callback" : "AfterParam", + "library_version" : ${content_meta_library_version}, + "env" : "none" + } + } +} ] \ No newline at end of file diff --git a/gradle/configure_tests.gradle b/gradle/configure_tests.gradle index a06eeaf4ddb..79efc51c7e5 100644 --- a/gradle/configure_tests.gradle +++ b/gradle/configure_tests.gradle @@ -5,6 +5,7 @@ def isTestingInstrumentation(Project project) { return [ "junit-4.10", "cucumber-junit-4", + "junit-4.13", "munit-junit-4", "junit-5.3", "junit-5.8", diff --git a/settings.gradle b/settings.gradle index 60456d9c0be..fb2bb69f846 100644 --- a/settings.gradle +++ b/settings.gradle @@ -336,6 +336,7 @@ include ':dd-java-agent:instrumentation:org-json' include ':dd-java-agent:instrumentation:jsp-2.3' include ':dd-java-agent:instrumentation:junit-4.10' include ':dd-java-agent:instrumentation:junit-4.10:cucumber-junit-4' +include ':dd-java-agent:instrumentation:junit-4.10:junit-4.13' include ':dd-java-agent:instrumentation:junit-4.10:munit-junit-4' include ':dd-java-agent:instrumentation:junit-5.3' include ':dd-java-agent:instrumentation:junit-5.3:junit-5.8'