Skip to main content

Module testing

Module testing 

Source
Expand description

In-process testing without a network socket.

ⓘ
#[tokio::test]
async fn home_page() {
    let client = TestClient::new(my_app::routes());
    let res = client.get("/").await;
    assert_eq!(res.status, 200);
    assert!(res.text.contains("Hello"));
}

Structs§

TestClient
Sends requests to an App directly.
TestResponse
A collected response.

Functions§

layout_keys
Keys of the layouts marked in a page, outermost first.
strip_layout_markers
A page’s HTML without the layout markers used by partial navigation, for comparing markup in tests.