-
Notifications
You must be signed in to change notification settings - Fork 181
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
~30s pause when running tests #782
Comments
That usually means you have some long running logic during the discovery phase. i.e describe("something") {
runLongRunningThing()
it("some test") {
...
}
} |
Hey @raniejade, thanks for the quick response! |
Looking at this more closely, it looks like the time is spent loading classes and waiting for Mockito to generate mocks. Would you be interested in a PR that runs the spec resolution in parallel? (I'm imagining something like replacing the |
Is mockito thread-safe though? |
Nice, I'm currently working on integrating coroutines internally - let's hold this for now until I'm done with it. |
Hey @raniejade, are you still working on integrating coroutines? I'm still keen to have a crack at this |
Hey @charleskorn! Yes, you find it at #835. Looks like everything is working, just need to do some testing since it is quite a big change. |
OK great, I'll keep an eye on that PR then. |
@charleskorn fyi, #835 is now merged! |
Hello @raniejade , we recently splitted some of our code to new modules to reduce incremental build and test time. I've migrated two simple modules to junit jupiter and the test discovery improvement is huge - detekt/detekt#2902 (comment)! We rely heavily on Spek with more than 1700 tests. Do you have any idea how we can improve the startup time? Thanks! |
@arturbosch Thanks for the report! I suspect this line spek/spek-runtime/src/jvmMain/kotlin/org/spekframework/spek2/runtime/JvmDiscoveryContextFactory.kt Line 48 in 60c14fe
spek/spek-runtime/src/jvmMain/kotlin/org/spekframework/spek2/runtime/JvmDiscoveryContextFactory.kt Line 52 in 60c14fe
|
Thanks for the quick reply and the ongoing effort! It will help a lot. |
I can look at that, but I don't think Gradle's implementation of JUnit 5 support is able to pass that info: https://github.com/gradle/gradle/blob/a9f9b343a3ebfa34534d8245908a1f5702271ac9/subprojects/testing-junit-platform/src/main/java/org/gradle/api/internal/tasks/testing/junitplatform/JUnitPlatformTestClassProcessor.java#L117 From what I can see, if you set a test filter in gradle - gradle itself will do the filtering and passed in classes (I'm not sure of the selection criteria here) to JUnit Platform launcher. |
I'm not sure if this is something in my setup or an issue in Spek, but when I run the tests in https://github.com/charleskorn/batect with
./gradlew app:test
, Gradle seems to pause for nearly 30 seconds at:app:test > 0 tests completed
before then starting to run my tests.Do you have any ideas on what the cause of this might be?
Running the tests with a profiler suggests that most of this time is spent calling
resolveSpec
for each test class.The text was updated successfully, but these errors were encountered: