-
Notifications
You must be signed in to change notification settings - Fork 20
/
test_plan.rs
64 lines (55 loc) · 2.05 KB
/
test_plan.rs
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
// test_plan.rs
// Getting test plan example
use anyhow::Result;
use azure_devops_rust_api::test_plan;
use std::env;
mod utils;
#[tokio::main]
async fn main() -> Result<()> {
// Get authentication credential
let credential = utils::get_credential()?;
// Get ADO server configuration via environment variables
let organization = env::var("ADO_ORGANIZATION").expect("Must define ADO_ORGANIZATION");
let project = env::var("ADO_PROJECT").expect("Must define ADO_PROJECT");
let test_plan_id_value = env::var("TEST_PLAN_ID").expect("Must define PLAN_ID for the test");
let test_plan_id: i32 = test_plan_id_value
.parse()
.expect("Failed to parse TEST_PLAN_ID");
// Create test_plan client
let test_plan_client = test_plan::ClientBuilder::new(credential).build();
// Get all test plans for project
println!("The test plan for project are:");
let test_plans = test_plan_client
.test_plans_client()
.list(&organization, &project)
.await?
.value;
println!("{:#?}", test_plans);
// Get all suites for a test plan for a project
println!("The suites for the a plan for project are:");
let test_suites = test_plan_client
.test_suites_client()
.get_test_suites_for_plan(&organization, &project, test_plan_id)
.await?
.value;
println!("{:#?}", test_suites);
// Get all test plan variables for project
println!("The test plans variables for project are:");
let test_plan_variables = test_plan_client
.variables_client()
.list(&organization, &project)
.await?
.value;
println!("{:#?}", test_plan_variables);
// Get all test plan configuration for project
println!("The test plan configuration for project are:");
let test_plan_configuration = test_plan_client
.configurations_client()
.list(&organization, &project)
.await?
.value;
println!("{:#?}", test_plan_configuration);
Ok(())
}