1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
use TokenStream;
/// Attribute client library tests to play back recordings, record sessions, or execute tests without recording.
///
/// # Arguments
///
/// * `live` - Run the test only in live mode. The test will be ignored unless `AZURE_TEST_MODE=live`.
/// * `playback` - Run the test only in playback mode. The test will be ignored unless `AZURE_TEST_MODE=playback`.
/// Note: Only use this for tests that validate playback-specific behavior. Most tests should not use this option.
///
/// # Examples
///
/// For live or recorded tests (the default), you must declare an async function that accepts a `TestContext` and returns a `Result<T, E>`.
///
/// ```no_run
/// use azure_core_test::{recorded, TestContext};
///
/// #[recorded::test]
/// async fn test(ctx: TestContext) -> Result<(), Box<dyn std::error::Error>> {
/// todo!()
/// }
/// ```
///
/// For live-only tests, you must declare an async function that may accept a `TestContext` and must return a `Result<T, E>`.
///
/// ```no_run
/// use azure_core_test::recorded;
///
/// #[recorded::test(live)]
/// async fn test() -> Result<(), Box<dyn std::error::Error>> {
/// todo!()
/// }
/// ```
///
/// Read documentation for `azure_core_test` for more information and examples.