Coder Social home page Coder Social logo

testfixtures's Introduction

When applying the java-test-fixtures plugin to a project, classes from sourceSets.main are put onto the test classpath twice, which imho might be a bug in gradle's handling of test-fixtures.

gradlew test --tests at.myorg.testfixtures.MyTest.classesFromMainSourceSetArePresentMultipleTimes yields

  • file:/.../testfixtures/build/classes/java/main/at/myorg/testfixtures/App.class
  • jar:file:/.../testfixtures/build/libs/testfixtures.jar!/at/myorg/testfixtures/App.class

while only

file:/.../testfixtures/build/classes/java/main/at/myorg/testfixtures/App.class

is expected.

Notice, that the project itself is present on the dependency tree twice:

gradlew dependencies --configuration testRuntimeClasspath

> Task :dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

testRuntimeClasspath - Runtime classpath of source set 'test'.
+--- project : (*)
+--- org.junit.jupiter:junit-jupiter-api:5.5.2
|    +--- org.apiguardian:apiguardian-api:1.1.0
|    +--- org.opentest4j:opentest4j:1.2.0
|    \--- org.junit.platform:junit-platform-commons:1.5.2
|         \--- org.apiguardian:apiguardian-api:1.1.0
+--- org.junit.jupiter:junit-jupiter-engine:5.5.2
|    +--- org.apiguardian:apiguardian-api:1.1.0
|    +--- org.junit.platform:junit-platform-engine:1.5.2
|    |    +--- org.apiguardian:apiguardian-api:1.1.0
|    |    +--- org.opentest4j:opentest4j:1.2.0
|    |    \--- org.junit.platform:junit-platform-commons:1.5.2 (*)
|    \--- org.junit.jupiter:junit-jupiter-api:5.5.2 (*)
\--- project : (*)

(*) - dependencies omitted (listed previously)

A web-based, searchable dependency report is available by adding the --scan option.

The result of dependencyInsight are as follows:

gradlew dependencyInsight --dependency testfixtures --configuration testRuntimeClasspath

> Task :dependencyInsight
project :
   variant "testRuntimeClasspath" [
      org.gradle.usage               = java-runtime
      org.gradle.libraryelements     = jar
      org.gradle.dependency.bundling = external
      org.gradle.jvm.version         = 8
   ]
   variant "testFixturesRuntimeElements" [
      org.gradle.usage               = java-runtime
      org.gradle.libraryelements     = jar
      org.gradle.dependency.bundling = external
      org.gradle.category            = library (not requested)
      org.gradle.jvm.version         = 8
   ]
   variant "runtimeElements" [
      org.gradle.usage               = java-runtime
      org.gradle.libraryelements     = jar
      org.gradle.dependency.bundling = external
      org.gradle.category            = library (not requested)
      org.gradle.jvm.version         = 8
   ]

project :
\--- project : (*)

project :
\--- project : (*)

(*) - dependencies omitted (listed previously)

A web-based, searchable dependency report is available by adding the --scan option.

Removing the java-test-fixtures plugin from the project (and moving all sources from src/testFixtures into src/test to avoid compile errors) makes the jar:file:... classpath resource disappear. Also, the dependency tree looks more familiar:

gradlew dependencies --configuration testRuntimeClasspath

> Task :dependencies

------------------------------------------------------------
Root project
------------------------------------------------------------

testRuntimeClasspath - Runtime classpath of source set 'test'.
+--- org.junit.jupiter:junit-jupiter-api:5.5.2
|    +--- org.apiguardian:apiguardian-api:1.1.0
|    +--- org.opentest4j:opentest4j:1.2.0
|    \--- org.junit.platform:junit-platform-commons:1.5.2
|         \--- org.apiguardian:apiguardian-api:1.1.0
\--- org.junit.jupiter:junit-jupiter-engine:5.5.2
     +--- org.apiguardian:apiguardian-api:1.1.0
     +--- org.junit.platform:junit-platform-engine:1.5.2
     |    +--- org.apiguardian:apiguardian-api:1.1.0
     |    +--- org.opentest4j:opentest4j:1.2.0
     |    \--- org.junit.platform:junit-platform-commons:1.5.2 (*)
     \--- org.junit.jupiter:junit-jupiter-api:5.5.2 (*)

testfixtures's People

Contributors

esz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.