openfunctions_rs/cli/
test.rs

1//! The `test` command for running tests on tools and agents.
2
3use crate::core::{Config, TestRunner};
4use anyhow::Result;
5use clap::Args;
6
7/// A command for running tests on tools and agents.
8#[derive(Args, Debug)]
9pub struct TestCommand {
10    /// The specific test suite to run.
11    /// Can be "tools", "agents", or "integration". If not specified, all tests run.
12    pub suite: Option<String>,
13}
14
15impl TestCommand {
16    /// Executes the `test` command.
17    pub async fn execute(&self, config: &Config) -> Result<()> {
18        let mut runner = TestRunner::new(config);
19        let results = if let Some(suite) = &self.suite {
20            runner.run_suite(suite).await?
21        } else {
22            runner.run_all().await?
23        };
24        results.print_summary();
25        Ok(())
26    }
27}