Skip to content

Commit ebf882b

Browse files
committed
Added description to agent and usage command tests , add .gitignore
1 parent f2b936a commit ebf882b

File tree

3 files changed

+40
-14
lines changed

3 files changed

+40
-14
lines changed

e2etests/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
qcli_test_summary*.json
2+
qcli_test_summary*.html

e2etests/tests/agent/test_agent_commands.rs

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ const TEST_NAMES: &[&str] = &[
2020
#[allow(dead_code)]
2121
const TOTAL_TESTS: usize = TEST_NAMES.len();
2222

23+
/// Tests the /agent command without subcommands to display help information
24+
/// Verifies agent management description, usage, available subcommands, and options
2325
#[test]
24-
#[cfg(all(feature = "agent", any(feature = "sanity"))]
26+
#[cfg(all(feature = "agent", feature = "sanity"))]
2527
fn agent_without_subcommand() -> Result<(), Box<dyn std::error::Error>> {
26-
println!("🔍 Testing /agent command...");
28+
println!("🔍 Testing /agent command... | Description: Tests the /agent command without subcommands to display help information. Verifies agent management description, usage, available subcommands, and options");
2729

2830
let session = get_chat_session();
2931
let mut chat = session.lock().unwrap();
@@ -71,10 +73,12 @@ fn agent_without_subcommand() -> Result<(), Box<dyn std::error::Error>> {
7173
Ok(())
7274
}
7375

76+
/// Tests the /agent create command to create a new agent with specified name
77+
/// Verifies agent creation process, file system operations, and cleanup
7478
#[test]
7579
#[cfg(all(feature = "agent", feature = "sanity"))]
7680
fn test_agent_create_command() -> Result<(), Box<dyn std::error::Error>> {
77-
println!("🔍 Testing /agent create --name <agent_name> command...");
81+
println!("🔍 Testing /agent create --name <agent_name> command... | Description: Tests the /agent create command to create a new agent with specified name. Verifies agent creation process, file system operations, and cleanup");
7882

7983
let timestamp = std::time::SystemTime::now()
8084
.duration_since(std::time::UNIX_EPOCH)
@@ -138,10 +142,12 @@ fn test_agent_create_command() -> Result<(), Box<dyn std::error::Error>> {
138142
Ok(())
139143
}
140144

145+
/// Tests the /agent create command without required arguments to verify error handling
146+
/// Verifies proper error messages, usage information, and help suggestions
141147
#[test]
142148
#[cfg(all(feature = "agent", feature = "sanity"))]
143149
fn test_agent_create_missing_args() -> Result<(), Box<dyn std::error::Error>> {
144-
println!("🔍 Testing /agent create without required arguments...");
150+
println!("🔍 Testing /agent create without required arguments... | Description: Tests the /agent create command without required arguments to verify error handling. Verifies proper error messages, usage information, and help suggestions");
145151

146152
let session = get_chat_session();
147153
let mut chat = session.lock().unwrap();
@@ -187,10 +193,12 @@ fn test_agent_create_missing_args() -> Result<(), Box<dyn std::error::Error>> {
187193
Ok(())
188194
}
189195

196+
/// Tests the /agent help command to display comprehensive agent help information
197+
/// Verifies agent descriptions, usage notes, launch instructions, and configuration paths
190198
#[test]
191199
#[cfg(all(feature = "agent", feature = "sanity"))]
192200
fn test_agent_help_command() -> Result<(), Box<dyn std::error::Error>> {
193-
println!("🔍 Testing /agent help...");
201+
println!("🔍 Testing /agent help... | Description: Tests the /agent help command to display comprehensive agent help information. Verifies agent descriptions, usage notes, launch instructions, and configuration paths");
194202

195203
let session = get_chat_session();
196204
let mut chat = session.lock().unwrap();
@@ -242,10 +250,12 @@ fn test_agent_help_command() -> Result<(), Box<dyn std::error::Error>> {
242250
Ok(())
243251
}
244252

253+
/// Tests the /agent command with invalid subcommand to verify error handling
254+
/// Verifies that invalid commands display help information with available commands and options
245255
#[test]
246256
#[cfg(all(feature = "agent", feature = "sanity"))]
247257
fn test_agent_invalid_command() -> Result<(), Box<dyn std::error::Error>> {
248-
println!("🔍 Testing /agent invalidcommand...");
258+
println!("🔍 Testing /agent invalidcommand... | Description: Tests the /agent command with invalid subcommand to verify error handling. Verifies that invalid commands display help information with available commands and options");
249259

250260
let session = get_chat_session();
251261
let mut chat = session.lock().unwrap();
@@ -279,10 +289,12 @@ fn test_agent_invalid_command() -> Result<(), Box<dyn std::error::Error>> {
279289
Ok(())
280290
}
281291

292+
/// Tests the /agent list command to display all available agents
293+
/// Verifies agent listing format and presence of default agent
282294
#[test]
283295
#[cfg(all(feature = "agent", feature = "sanity"))]
284296
fn test_agent_list_command() -> Result<(), Box<dyn std::error::Error>> {
285-
println!("🔍 Testing /agent list command...");
297+
println!("🔍 Testing /agent list command... | Description: Tests the /agent list command to display all available agents. Verifies agent listing format and presence of default agent");
286298

287299
let session = get_chat_session();
288300
let mut chat = session.lock().unwrap();
@@ -311,10 +323,12 @@ fn test_agent_list_command() -> Result<(), Box<dyn std::error::Error>> {
311323
Ok(())
312324
}
313325

326+
/// Tests the /agent schema command to display agent configuration schema
327+
/// Verifies JSON schema structure with required keys and properties
314328
// #[test]
315329
// #[cfg(feature = "agent")]
316330
// fn test_agent_schema_command() -> Result<(), Box<dyn std::error::Error>> {
317-
// println!("🔍 Testing /agent schema...");
331+
// println!("🔍 Testing /agent schema... | Description: Tests the /agent schema command to display agent configuration schema. Verifies JSON schema structure with required keys and properties");
318332

319333
// let session = get_chat_session();
320334
// let mut chat = session.lock().unwrap();
@@ -350,10 +364,12 @@ fn test_agent_list_command() -> Result<(), Box<dyn std::error::Error>> {
350364
// Ok(())
351365
// }
352366

367+
/// Tests the /agent set-default command with valid arguments to set default agent
368+
/// Verifies success messages and confirmation of default agent configuration
353369
#[test]
354370
#[cfg(all(feature = "agent", feature = "sanity"))]
355371
fn test_agent_set_default_command() -> Result<(), Box<dyn std::error::Error>> {
356-
println!("🔍 Testing /agent set-default with valid arguments...");
372+
println!("🔍 Testing /agent set-default with valid arguments... | Description: Tests the /agent set-default command with valid arguments to set default agent. Verifies success messages and confirmation of default agent configuration");
357373

358374
let session = get_chat_session();
359375
let mut chat = session.lock().unwrap();
@@ -389,10 +405,12 @@ fn test_agent_set_default_command() -> Result<(), Box<dyn std::error::Error>> {
389405
Ok(())
390406
}
391407

408+
/// Tests the /agent set-default command without required arguments to verify error handling
409+
/// Verifies error messages, usage information, and available options display
392410
#[test]
393411
#[cfg(all(feature = "agent", feature = "sanity"))]
394412
fn test_agent_set_default_missing_args() -> Result<(), Box<dyn std::error::Error>> {
395-
println!("🔍 Testing /agent set-default without required arguments...");
413+
println!("🔍 Testing /agent set-default without required arguments... | Description: Tests the /agent set-default command without required arguments to verify error handling. Verifies error messages, usage information, and available options display");
396414

397415
let session = get_chat_session();
398416
let mut chat = session.lock().unwrap();

e2etests/tests/session_mgmt/test_usage_command.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ const TEST_NAMES: &[&str] = &[
1515
#[allow(dead_code)]
1616
const TOTAL_TESTS: usize = TEST_NAMES.len();
1717

18+
/// Tests the /usage command to display current context window usage
19+
/// Verifies token usage information, progress bar, breakdown sections, and Pro Tips
1820
#[test]
1921
#[cfg(all(feature = "usage", feature = "sanity"))]
2022
fn test_usage_command() -> Result<(), Box<dyn std::error::Error>> {
21-
println!("🔍 Testing /usage command...");
23+
println!("🔍 Testing /usage command... | Description: Tests the /usage command to display current context window usage. Verifies token usage information, progress bar, breakdown sections, and Pro Tips");
2224

2325
let session = get_chat_session();
2426
let mut chat = session.lock().unwrap();
@@ -74,10 +76,12 @@ fn test_usage_command() -> Result<(), Box<dyn std::error::Error>> {
7476
Ok(())
7577
}
7678

79+
/// Tests the /usage --help command to display help information for the usage command
80+
/// Verifies Usage section, Options section, and help flags (-h, --help)
7781
#[test]
7882
#[cfg(all(feature = "usage", feature = "sanity"))]
7983
fn test_usage_help_command() -> Result<(), Box<dyn std::error::Error>> {
80-
println!("🔍 Testing /usage --help command...");
84+
println!("🔍 Testing /usage --help command... | Description: Tests the /usage --help command to display help information for the usage command. Verifies Usage section, Options section, and help flags (-h, --help)");
8185

8286
let session = get_chat_session();
8387
let mut chat = session.lock().unwrap();
@@ -90,7 +94,7 @@ fn test_usage_help_command() -> Result<(), Box<dyn std::error::Error>> {
9094
println!("📝 END OUTPUT");
9195

9296
// Verify Usage section
93-
assert!(response.contains("Usage:"), "Missing Usage section");
97+
assert!(response.contains("Usage: XX "), "Missing Usage section");
9498
assert!(response.contains("/usage"), "Missing /usage command in usage section");
9599
println!("✅ Found Usage section with /usage command");
96100

@@ -115,10 +119,12 @@ fn test_usage_help_command() -> Result<(), Box<dyn std::error::Error>> {
115119
Ok(())
116120
}
117121

122+
/// Tests the /usage -h command (short form of --help)
123+
/// Verifies Usage section, Options section, and help flags (-h, --help)
118124
#[test]
119125
#[cfg(all(any(feature = "usage", feature = "session_mgmt"), feature = "regression"))]
120126
fn test_usage_h_command() -> Result<(), Box<dyn std::error::Error>> {
121-
println!("🔍 Testing /usage -h command...");
127+
println!("🔍 Testing /usage -h command... | Description: Tests the /usage -h command (short form of --help). Verifies Usage section, Options section, and help flags (-h, --help)");
122128

123129
let session = get_chat_session();
124130
let mut chat = session.lock().unwrap();

0 commit comments

Comments
 (0)