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

Implement test timeouts #647

Merged
merged 11 commits into from
Apr 14, 2019
Merged

Implement test timeouts #647

merged 11 commits into from
Apr 14, 2019

Conversation

raniejade
Copy link
Member

@raniejade raniejade commented Mar 6, 2019

Resolves #643

An optional timeout parameter is added to test scope builder which defaults to 10 seconds. Timeout is implemented using coroutines under the hood, this means that timeout is not working on KN (only a single threaded coroutine is supported). Also, note that timeouts do not apply to beforeGroup, afterGroup and afterEachTest.

@@ -49,14 +51,23 @@ kotlin {

linuxMain {
dependsOn nativeMain
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.1.1'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dependencies.gradle does not work here for some reason.

@@ -15,6 +15,7 @@ pluginManagement {
}

enableFeaturePreview('STABLE_PUBLISHING')
enableFeaturePreview('GRADLE_METADATA')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

required by the coroutines library.

@raniejade raniejade merged commit 16e40b9 into 2.x Apr 14, 2019
@raniejade raniejade deleted the rr-test-timeouts branch April 14, 2019 10:01
@boylenssen
Copy link

While debugging, I'm not able to take my time as this timeout occurs. I'm using the Gherkin method, so where can I override the timeout? And isn't there a way to set the timeout globally?

@raniejade
Copy link
Member Author

@boylenssen just filed #692 and will be included in 2.0.5

val test = TestScopeImpl(
idFor(description),
root.path.resolve(description),
root,
defaultTimeout,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you want to use the argument here instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, already fixed in master.

Copy link

@boylenssen boylenssen May 24, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I have this:

class ResponseTest : Spek({

    setArchTaskExecutor()

    timeout(15000)

but that doesn't work. How to I set it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defaultTimeout = xxx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test timeouts
3 participants