Ir al contenido principal
Versión: 5.4.x

Pruebas no deterministas

[Traducción Beta No Oficial]

Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →

A veces te encuentras trabajando con código inherentemente no determinista. Si bien este no es el escenario ideal para escribir pruebas, cuando no queda alternativa Kotest ofrece varias funciones que ayudan a crear tests donde el camino feliz puede requerir tiempos variables para ejecutarse con éxito.

FunctionRole
EventuallyUsed to ensure that a test will eventually pass within a specified time duration. The test is repeatedly executed until the test passes or the duration expires.
ContinuallyUsed to ensure that a test continually passes for a period of time. Will repeatedly execute a test until the duration has expired or the test fails.
UntilUsed to ensure that a predicate will eventually hold true within a specified time duration. The predicate is repeatedly executed until true or the duration expires.
RetryUsed to ensure that a test willi eventually pass within a given number of retries. The test is repeatedly executed until the test passes or the iteration count is reached.