Skip to content

Commit

Permalink
Add timeout to fail for tests taking longer than 15 minutes
Browse files Browse the repository at this point in the history
  • Loading branch information
LZRS committed Nov 21, 2024
1 parent bcb6f52 commit ac370d9
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import org.junit.Rule
import org.junit.runner.RunWith
import org.robolectric.Shadows
import org.robolectric.annotation.Config
import org.robolectric.junit.rules.TimeoutRule
import org.robolectric.util.ReflectionHelpers
import org.smartregister.fhircore.engine.util.extension.SDF_YYYY_MM_DD
import org.smartregister.fhircore.engine.util.extension.formatDate
Expand All @@ -69,6 +70,8 @@ abstract class RobolectricTest {

@get:Rule(order = 20) val fhirEngineProviderTestRule = FhirEngineProviderTestRule()

@get:Rule(order = 38) val globalTimeoutRule: TimeoutRule = TimeoutRule.seconds(900) // 15 minutes

/** Get the liveData value by observing but wait for 3 seconds if not ready then stop observing */
@Throws(InterruptedException::class)
fun <T> getLiveDataValue(liveData: LiveData<T>): T? {
Expand Down

0 comments on commit ac370d9

Please sign in to comment.