Skip to main content

test

Attribute Macro test 

Source
#[test]
Expand description

Annotate an end-to-end test to be run with Doco

The #[doco::test] attribute is used to annotate an asynchronous test function that should be executed by Doco as an end-to-end test. The test function is passed a [doco::Client] that can be used to interact with the web application, and it should return a [doco::Result].

§Example

use doco::{Client, Result};

#[doco::test]
async fn visit_root_path(client: Client) -> Result<()> {
    client.goto("/").await?;

    let body = client.source().await?;

    assert!(body.contains("Hello World"));

    Ok(())
}