attach_json

Function attach_json 

Source
pub fn attach_json<T: Serialize>(name: impl Into<String>, value: &T)
Expand description

Attaches JSON content to the current test or step.

The value is serialized to JSON using serde.

ยงExample

use allure_core::runtime::{with_test_context, attach_json};
use serde::Serialize;

#[derive(Serialize)]
struct User {
    name: String,
    email: String,
}

with_test_context(|| {
    let user = User {
        name: "John".to_string(),
        email: "john@example.com".to_string(),
    };
    attach_json("User Data", &user);
});