Common/Testing/
TestController.rs

1//! # TestController Trait
2//!
3//! Defines the abstract service trait for managing test controllers and test
4//! execution, mirroring the `vscode.test` API.
5
6use async_trait::async_trait;
7use serde_json::Value;
8
9use crate::{Environment::Environment::Environment, Error::CommonError::CommonError};
10
11/// An abstract service contract for an environment component that can manage
12/// test providers and test runs contributed by extensions.
13#[async_trait]
14pub trait TestController: Environment + Send + Sync {
15	/// Registers a new test controller from a sidecar (extension host).
16	///
17	/// # Parameters
18	/// * `ControllerId`: A unique identifier for the test controller.
19	/// * `Label`: A human-readable label for the test controller.
20	async fn RegisterTestController(&self, ControllerId:String, Label:String) -> Result<(), CommonError>;
21
22	/// Runs a set of tests.
23	///
24	/// # Parameters
25	/// * `ControllerId`: The ID of the controller that owns the tests to be
26	///   run.
27	/// * `TestRunRequest`: A DTO representing the request, including which
28	///   specific tests to run (or all if omitted) and whether it's a debug
29	///   run.
30	async fn RunTests(&self, ControllerId:String, TestRunRequest:Value) -> Result<(), CommonError>;
31}