Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
alisevych opened this issue Aug 1, 2022 · 0 comments · Fixed by #829
Closed

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

alisevych opened this issue Aug 1, 2022 · 0 comments · Fixed by #829
Assignees
Labels
ctg-bug Issue is a bug

Comments

@alisevych
Copy link
Member

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.

@alisevych alisevych changed the title JUnit5 params dependency is required for Parametrized tests in default IDEA's Gradle project JUnit5 params dependency is required in default IDEA's Gradle project Aug 1, 2022
@korifey korifey moved this to Todo in UTBot Java Aug 1, 2022
@alisevych alisevych added the ctg-bug Issue is a bug label Aug 1, 2022
EgorkaKulikov pushed a commit that referenced this issue Sep 2, 2022
…#829)

Autoadd Junit5-params dependency for junit5 projects without it when needed
Repository owner moved this from Todo to Done in UTBot Java Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ctg-bug Issue is a bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants