Skip to content

JUnit 5 Dynamic tests not showing with their displayName #5975

@johnzielke

Description

@johnzielke

Expected Behavior

When executing dynamic tests with @testfactory, it should use the displayname of the dynamic test in the report. For example this is the image I get in IntelliJ if I run directly from the IDE using rightclick on the classes an "Run Test.."
image

Current Behavior

When running the tests with "gradle test" in IntelliJ, it shows the following:
image
Every test is just indexed

Context

This is not ideal, as I can't see what data I used in that specific test

Steps to Reproduce (for bugs)

I am using the following build.gradle:

buildscript {
	ext {
		kotlinVersion = '1.2.51'
		springBootVersion = '2.0.3.RELEASE'
		junitJupiterVersion  = '5.2.0'
		junitPlatformVersion = '1.2.0'
	}
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
		classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
		classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
		classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.6'
	}
}


apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.protobuf'
apply plugin: 'idea'

protobuf {
	protoc {
		artifact = "com.google.protobuf:protoc:3.5.1-1"
	}
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
compileKotlin {
	kotlinOptions {
		freeCompilerArgs = ["-Xjsr305=strict"]
		jvmTarget = "1.8"
	}
}
compileTestKotlin {
	kotlinOptions {
		freeCompilerArgs = ["-Xjsr305=strict"]
		jvmTarget = "1.8"
	}
}

repositories {
	mavenCentral()
	jcenter()
	maven { url 'https://jitpack.io' }
}
test {
	useJUnitPlatform()
}

dependencies {
	compile('org.springframework.boot:spring-boot-starter-amqp')
	compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
	compile "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
	testCompile('org.springframework.boot:spring-boot-starter-test'){
		exclude group: 'junit', module: 'junit'
	}

	testImplementation("org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}")
        testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}")


	compile group: 'com.google.protobuf', name: 'protobuf-java-util', version: '3.6.0'
	compile 'net.andreinc.mockneat:mockneat:0.1.7'
	compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.11.0'
	compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.11.0'
	compile 'org.optaplanner:optaplanner-core:7.7.0.Final'
	compile group: 'com.google.guava', name: 'guava', version: '20.0'
}

And this is a example from my test:
image

Your Environment

Gradle 4.8.1
IntelliJ 2018.1.5
Windows 7
Java 8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions