Skip to content

JUnit5 params dependency is required in default IDEA's Gradle project #620

Closed
@alisevych

Description

@alisevych

Description

IntelliJ IDEA is generating default Gradle project with separate jupiter-api and jupiter-engine dependencies.
For compiling JUnit5 parametrized tests jupiter-params dependency is needed.

To Reproduce

Steps to reproduce the behavior:

  1. Run IntelliJ IDEA with UTBot plugin installed
  2. File -> New -> Project... -> Enter name, select Java, Gradle, JDK 8/11, Groovy, click Create
  3. Open build.gradle, check dependencies added by default
dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
  1. Add a simple class to the project src\main\java
  2. Create tests with UTBot... for it - with JUnit5 and Parametrized
  3. See the generated test

Expected behavior

All required dependencies, including params, are added

Actual behavior

ParameterizedTest, MethodSource are not found - Cannot resolve symbol... compilation errors are shown.
Tests cannot be compiled and executed.

Visual proofs (screenshots, logs, images)

image

Environment

Windows 10 Pro
IDEA Ultimate 2022.1.4
JDK 11

Additional context

To fix the issue:

  1. add params
dependencies {
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
    testImplementation 'org.junit.jupiter:junit-jupiter-params:5.8.1'
}

or
2) add parent dependency, params included

dependencies {
    implementation 'org.junit.jupiter:junit-jupiter:5.8.1'
}

When JUnit5 dependency is added by UTBot the 2nd one is added - works fine.

Metadata

Metadata

Assignees

Labels

ctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions