This message was deleted.
# community-support
s
This message was deleted.
v
testFixtures
is a source set, not a configuration. So you get the same configurations for it like for other source sets
testFixturesImplementation
,
testFixturesCompileOnly
,
testFixturesCompileClasspath
, .....
Do you maybe man to depend on the test fixtures? You do not only want the dependencies, do you?
You might also consider using JVM test suites instead of manual source sets if you did not already.
c
JVM test suites?
Exactly the tool for declaring additional test suites like integ tests, e2e tests, functional tests, ...
c
I'll give it a look tomorrow, I didn't know it existed and the existing code was doing things based on a tutorial from years and years and years ago. It sounds ideal though.
👌 1
it is questionable that there are 3 different documents saying how to do it 3 different ways...
but none of them mention the best way
v
Mind sharing the documents you refer to?
c
mmm, the one you shared, ... sec I'll find the other 2
that's the one we were using
not sure where the 3rd one is right now... about://history isn't being great, I might be inferring, but I could swear something else has similar examples in official docs
wth, reading this new plugin and all I can say is, all options seem incredibly convoluted, and I can't tell what the simplest thing for adding
integrationTest
that actually works actually is
is this complete? is this really the simplest thing that can work
v
that's the one we were using
Yeah, that sample simply pre-dates JVM test suites. And actually, JVM test suites are still incubating. This might be a reason that the sample was not removed or updated. But it is probably at least worth to add a note to the sample header that hints at the new JVM test suites. I'd recommend you open a feature request or pull request for that. 🙂
c
I'm going to reflect that on you, feel free to do that. I knew it predated it, it's just confusing to see 3 variants (yes I know I can't find one of them)
v
is this complete?
Probably
is this really the simplest thing that can work
No
The simplest thing is
Copy code
testing {
    suites {
        integrationTest(JvmTestSuite)
    }
}
👍 1
c
why doesn't the documentation start with that! 😕
v
I don't know
c
strange... I added that (well similar) and now that dependency analysis plugin is saying
Copy code
> Task :persons-client:projectHealth
Unused dependencies which should be removed:
  intTestImplementation libs.junit.api
  testImplementation libs.junit.api
  testImplementation libs.junit.params
Copy code
testing {
    suites {
        intTest(JvmTestSuite)
        e2eTest(JvmTestSuite)
    }
}
They were required before and
@Test
would still need that...
and kind of unsurprisingly if I remove them, the code fails to compile
v
If you are switching to test suites, I would also move the dependencies into the test suites dsl, but up to you. junit api is unlikely to be needed it should already be there by definig the test suite to use jupiter which is the default for additional test suites. Or do you not use jupiter but junit 4? Then you need to do
useJUnit()
for those test suites.
c
If you are switching to test suites, I would also move the dependencies into the test suites dsl, but up to you.
why would that be better? also guessing it would simply confuse our devs
it's jupiter, that's just what I named it in libs.versions.toml because as far as I'm concerned the project is still junit
and I find that name easier to remember (probably for most people)
v
Well, for Kotlin DSL at least it is better as you don't need to use string-y declaration or getting the configuration by name. For Groovy DSL the difference is less. But I still prefer to have the test suite related setup together, configuring the test task, configuring the test dependencies, ...
c
I did not specify the platform further, it's applied to
test
through a plugin, does it need to be specified further?
Well, for Kotlin DSL at least it is better as you don't need to use string-y declaration or getting the configuration by name.
groovy magic, you don't seem to need a stringy name... idk
v
Yes, as I said 🙂
does it need to be specified further?
What? JUnit Platform? No, with test suites, JUnit Jupiter is configured automatically as test framework for suites you add additionally besides
test
. But then as I said you should indeed also not need the api dependency as that should with that also already be there.
c
although it looks like they aren't running, probably need to add the after, at least for the debatable integration test that runs today
the e2e I really don't want to
v
The "after" - if you mean the "shouldRunAfter(test)" - just means that if you run integration tests and unit tests in the same Gradle run, unit tests should run first as they are usually faster.
It does not change anything about it being executed or not
c
well, I suppose I mean the check depends on
v
If you want
check
to depend on the additional test suites, you have to manually configure that, yes.
c
I find that order a little questionable, because, kind of meh? but can't gradle run them concurrently otherwise? don't know if it will
v
Not everyone wants to run potentially long-running integ tests or ui needing e2e tests or similar as part of
check
Gradle can run the test tasks in parallel only if you use configuration cache
c
sure, I'm leaving the e2e's out
v
Without configuration cache, tasks within one project can never be run in parallel, except they are specifiically designed to run in parallel using the worker api
c
Gradle can run the test tasks in parallel only if you use configuration cache
which is disabled in the github ci action
and probably doesn't work in our project
v
cc is not disabled, its state is just not preserved
👍 1
c
so how does it decide the order if you don't define it?
v
But you still get the benefit of all tasks running in parallel with cc enabled
c
my mistake 😕
v
if you don't define order between tasks with an explicit contraint or some dependency, there is no guaranteed order.
c
effectively not cached because... reasons that are not gradle's fault? although, does gradle have a way to say "don't cache this"?
v
It can be random which runs first depending on what other things already finished, or what you requested in which order from command line
effectively not cached because... reasons that are not gradle's fault? although, does gradle have a way to say "don't cache this"?
Not getting the question, especially because "cache" is a bit overloaded. What do you mean exactly?
c
I mean that you have to recreate it every time, because it's not stored in the cache that is kept between runs
making it arguably, not cached
v
You want to say "don't cache this" for something that is not cached? confused
c
I guess, I'm just miffed that github is calling the configuration cache a security vulnerability
and I'm not sure who's to blame
whether gradle is missing a feature to avoid that problem
the fact that github is injecting environment variables for secure data (this is a security problem, they should fix their stuff first)
if you have to recreate the cache every time it becomes pointless because it doesn't speed anything up
anyways... that's a sidebar
v
Yes it does
c
Copy code
testing {
    suites {
        intTest(JvmTestSuite) {
            targets {
                all {
                    testTask.configure {
                        shouldRunAfter(test)
                    }
                }
            }
        }
        e2eTest(JvmTestSuite)
    }
}
I think this replicates what we had, doesn't seem significantly shorter 😕
v
With CC enabled, also tasks can run in parallel which speeds things up
c
we don't need a new language dsl, we need a better api
like somehow it feels like I should be able to write
Copy code
testing {
    suites {
        intTest(JvmTestSuite) {
           shouldRunAfter(test)
        }
        e2eTest(JvmTestSuite)
    }
}
I only work here
anyways, thanks for pointing out the new thing, it works
is at least more readable if not significantly terser in some cases
v
like somehow it feels like I should be able to write
Well, yes and no, only in the current state. But in some future you will be able to have multiple test targets each with its own or maybe even multiple test tasks. The DSL is already prepared for that to not need to then again change it right away.
c
I mean... but there could still be the more complex api... that also exists
idk
just feels like the most common things should be super simple, and that feels super common
v
Well, if both APIs would be there, you would yet again have two ways to do the same thing and thus increased uncertainty what to use.
Everything has its pros and cons - always
And also, what feels super common for one person, feels absolutely strange and unthinkable for the next one and both cannot really understand the other point of view. 😄
c
eh, I probably wouldn't care much if I had parallelism
just start all 3 at the same time!
I don't really care much now though... the suite is so fast I could barely log in to look at it
v
just start all 3 at the same time!
Yeah, as I said, that you get when you use configuration cache and the tasks do not have an ordering constraint like
mustRunAfter
or
dependsOn
, even if configuration cache state is not preserved.
c
I'm quite certain that configuration cache isn't going to work right now
Preserved or not