CheckOps home

Tools directory

A

CheckOps

Awaitility

Awaitility is an Apache-2.0 Java DSL for testing asynchronous systems, letting tests wait declaratively until a condition is met instead of using sleeps.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

Awaitility is a small Java library for synchronising asynchronous operations in tests. Testing code that uses background threads, message queues, event-driven systems or eventually consistent stores is notoriously hard: fixed Thread.sleep calls make tests either slow or flaky. Awaitility replaces them with a readable DSL that polls a condition until it becomes true or a timeout expires.

A typical statement reads await().atMost(5, SECONDS).until(() -> repository.count() == 1). You can configure poll intervals and delays, ignore exceptions while waiting, wait for a value to match a Hamcrest matcher or AssertJ assertion (untilAsserted), and wait on atomic variables or fields. Default timeouts can be set globally. Kotlin and Groovy extensions provide idiomatic syntax. It is particularly popular with Testcontainers-based integration tests, where messages or database writes complete asynchronously. The repository has about 4,000 GitHub stars, with its most recent commit in April 2026; versions are published to Maven Central.

The source code is at awaitility/awaitility on GitHub under the Apache-2.0 licence, with about 4,000 stars; the most recent commit was on 17 April 2026.

Features

  1. Declarative waiting: await().atMost(...).until(...) instead of sleeps.
  2. Assertion integration: untilAsserted works with AssertJ and Hamcrest.
  3. Configurable polling: Intervals, delays, defaults and ignored exceptions.
  4. Kotlin and Groovy support: Idiomatic language extensions.

Pros

  1. Free to use: Open source under the Apache-2.0 licence, so the core tool costs nothing to use.
  2. Actively maintained: The repository had commits as recent as 17 April 2026.
  3. Community: About 4,000 GitHub stars.

Cons

  1. Can mask slowness: Generous timeouts may hide performance regressions.
  2. Polling only: Waits by polling rather than event notification.
import static org.awaitility.Awaitility.await;
import static java.util.concurrent.TimeUnit.SECONDS;

@Test
void orderEventIsProcessed() {
    publisher.publish(new OrderPlaced("o-1"));

    await().atMost(10, SECONDS)
           .pollInterval(200, java.util.concurrent.TimeUnit.MILLISECONDS)
           .untilAsserted(() ->
               assertThat(orders.findById("o-1")).hasValueSatisfying(o ->
                   assertThat(o.status()).isEqualTo(Status.CONFIRMED)));
}

Resources:

Pricing

Awaitility is free and open source under the Apache-2.0 licence.

  1. JVM teams testing asynchronous or event-driven code.
  2. Integration tests with Testcontainers, Kafka or message queues.

Conclusion

Awaitility is a small library with an outsized effect on test reliability, replacing flaky sleeps with clear, bounded waiting.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with Awaitility side by side.