Struct actix_web::test::TestServer[][src]

pub struct TestServer { /* fields omitted */ }

The TestServer type.

TestServer is very simple test server that simplify process of writing integration tests cases for actix web applications.

Examples

use actix_web::test::TestServer;

let mut srv = TestServer::new(|app| app.handler(my_handler));

let req = srv.get().finish().unwrap();
let response = srv.execute(req.send()).unwrap();
assert!(response.status().is_success());

Methods

impl TestServer
[src]

Start new test server

This method accepts configuration method. You can add middlewares or set handlers for test application.

Create test server builder

Create test server builder with specific state factory

This method can be used for constructing application state. Also it can be used for external dependency initialization, like creating sync actors for diesel integration.

Start new test server with application factory

Get firat available unused address

Construct test server url

Construct test server url

Execute future on current core

Connect to websocket server

Create GET request

Create POST request

Create HEAD request

Connect to test http server

Trait Implementations

impl Drop for TestServer
[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl !Send for TestServer

impl !Sync for TestServer