# Where Are Asio's Unit Tests? Complete Guide to the Test Suite Structure

> Discover the location and structure of Asio's unit tests within the chriskohlhoff/asio repository. Learn about unit, property-based, and performance tests.

- Repository: [chriskohlhoff/asio](https://github.com/chriskohlhoff/asio)
- Tags: how-to-guide
- Published: 2026-07-16

---

**Asio's unit tests are located in the `src/tests/` directory, organized into core unit tests (`src/tests/unit/`), property-based tests (`src/tests/properties/`), and performance benchmarks (`src/tests/performance/`).**

The chriskohlhoff/asio repository maintains a comprehensive validation suite for its cross-platform networking and asynchronous I/O library. Understanding where Asio's unit tests reside and how they are categorized helps contributors verify changes and developers integrate tested components with confidence. This guide maps the exact locations of all test files and explains how to execute them.

## Core Unit Tests Location

The bulk of Asio's validation logic lives in `src/tests/unit/`. This directory contains individual test files for each core component, following a naming convention that mirrors the library's public API.

Key test files include:

- [`basic_socket.cpp`](https://github.com/chriskohlhoff/asio/blob/main/basic_socket.cpp) – validates socket operations and state management
- [`basic_deadline_timer.cpp`](https://github.com/chriskohlhoff/asio/blob/main/basic_deadline_timer.cpp) – tests timer functionality and expiry handling
- [`any_io_executor.cpp`](https://github.com/chriskohlhoff/asio/blob/main/any_io_executor.cpp) – verifies type-erased executor behavior
- [`awaitable.cpp`](https://github.com/chriskohlhoff/asio/blob/main/awaitable.cpp) – checks C++20 coroutine integration

Each file typically contains multiple test cases exercising edge cases and error conditions for its respective component.

## Property-Based Tests

Beyond traditional unit tests, Asio uses property-based testing to verify executor and property concepts. These reside in `src/tests/properties/` and are further divided by C++ standard version, such as `cpp11/`.

Important files in this category include:

- [`require_static.cpp`](https://github.com/chriskohlhoff/asio/blob/main/require_static.cpp) – tests static property requirements on executors
- [`can_prefer_member_prefer.cpp`](https://github.com/chriskohlhoff/asio/blob/main/can_prefer_member_prefer.cpp) – validates the `prefer` customization point behavior

These tests ensure that Asio's executor properties compose correctly across different contexts and compiler configurations.

## Performance Benchmarks

Load testing and throughput validation occur in `src/tests/performance/`. This directory contains reference implementations used to measure Asio's efficiency under realistic network conditions.

Key benchmarks include:

- [`server.cpp`](https://github.com/chriskohlhoff/asio/blob/main/server.cpp) – multi-threaded server implementation for stress testing
- [`client.cpp`](https://github.com/chriskohlhoff/asio/blob/main/client.cpp) – corresponding client generating configurable load patterns

These binaries help developers validate performance regressions and tune buffer sizes or thread counts.

## How to Build and Run Asio Tests

Running the complete test suite requires building from source using the autotools-based build system.

Configure and compile the library with test support:

```bash
./configure
make

```

Execute all unit tests using the check target:

```bash
make check

```

Depending on your build configuration, you may also run tests directly via `./test/asio_test` after compilation.

## Summary

- **Primary location**: All tests reside under `src/tests/` in the chriskohlhoff/asio repository
- **Core validation**: Component-specific tests in `src/tests/unit/` including [`basic_socket.cpp`](https://github.com/chriskohlhoff/asio/blob/main/basic_socket.cpp) and [`basic_deadline_timer.cpp`](https://github.com/chriskohlhoff/asio/blob/main/basic_deadline_timer.cpp)
- **Property verification**: Concept checks in `src/tests/properties/` organized by C++ standard version
- **Performance testing**: Benchmark tools in `src/tests/performance/` with [`server.cpp`](https://github.com/chriskohlhoff/asio/blob/main/server.cpp) and [`client.cpp`](https://github.com/chriskohlhoff/asio/blob/main/client.cpp)
- **Execution**: Build with `./configure` and `make`, then run `make check` to validate

## Frequently Asked Questions

### What directory contains Asio's main unit tests?

The core unit tests are located in `src/tests/unit/`. This directory contains individual test files for each component, such as [`basic_socket.cpp`](https://github.com/chriskohlhoff/asio/blob/main/basic_socket.cpp) for socket operations and [`any_io_executor.cpp`](https://github.com/chriskohlhoff/asio/blob/main/any_io_executor.cpp) for executor functionality.

### How do I run Asio's test suite after building from source?

Run `make check` from the build directory after executing `./configure` and `make`. This command executes the comprehensive test suite including unit tests and property checks. Alternatively, run `./test/asio_test` directly depending on your configuration.

### Are there performance benchmarks in the Asio repository?

Yes, the `src/tests/performance/` directory contains [`server.cpp`](https://github.com/chriskohlhoff/asio/blob/main/server.cpp) and [`client.cpp`](https://github.com/chriskohlhoff/asio/blob/main/client.cpp). These files implement reference networking applications used to measure throughput and latency under various load conditions.

### Where are the property-based tests for executors located?

Property-based tests for executor concepts reside in `src/tests/properties/`, subdivided by C++ standard version like `cpp11/`. Files such as [`require_static.cpp`](https://github.com/chriskohlhoff/asio/blob/main/require_static.cpp) and [`can_prefer_member_prefer.cpp`](https://github.com/chriskohlhoff/asio/blob/main/can_prefer_member_prefer.cpp) validate that executor properties behave correctly across different customization points.