Expand description
🦕 Doco
Doco is a test runner and library for writing end-to-tests of web applications. It is designed to be framework-agnostic and easy to use, both locally and in CI/CD pipelines.
Under the hood, Doco uses containers to create ephemeral, isolated environments for each test. This prevents state to leak between tests and ensures that each test is run with a known and predictable environment.
Doco has a very simple, yet powerful API to make it easy to write tests. In a main
function,
the environment for tests is defined and configured. Most importantly, Doco is told about the
server and its dependencies. Then, tests are written just like with any other Rust test. The
tests are passed a Client
that can be used to interact with a website, making it easy to
simulate user interactions and write assertions against the web application.
§Example
use doco::{Client, Doco, Result, Server, Service, WaitFor};
#[doco::test]
async fn visit_root_path(client: Client) -> Result<()> {
client.goto("/").await?;
let body = client.source().await?;
assert!(body.contains("Hello World"));
Ok(())
}
#[doco::main]
async fn main() -> Doco {
let server = Server::builder()
.image("crccheck/hello-world")
.tag("v1.0.0")
.port(8000)
.build();
Doco::builder().server(server).build()
}
Re-exports§
pub use inventory;
Macros§
- anyhow
- Construct an ad-hoc error from a string or existing non-
anyhow
error value.
Structs§
- Client
- WebDriver client that interacts with the web application
- Doco
- Configuration for end-to-end tests with Doco
- Error
- The
Error
type, a wrapper around a dynamic error type. - Server
- Server for the web application that is being tested
- Service
- Auxiliary service required by the server
- Test
Runner - Test runner for Doco’s end-to-end tests
Enums§
- Locator
- An element locator.
- WaitFor
- Represents a condition that needs to be met before a container is considered ready.
Traits§
- Context
- Provides the
context
method forResult
.
Type Aliases§
- Result
Result<T, Error>