API for automated test generation and execution. More...
#include <test_generation_api.h>
Classes | |
| struct | CoverageReport |
| Coverage report for tested code. More... | |
| struct | GenerationOptions |
| Options for test generation. More... | |
| struct | RecordedInteraction |
| Recorded interaction for test generation. More... | |
| struct | RecordingSession |
| Test recording session. More... | |
| struct | TestResult |
| Test execution result. More... | |
| struct | TestSpecification |
| Generate test from specification. More... | |
Public Types | |
| enum class | TestFramework { GTEST , CATCH2 , DOCTEST , IMGUI_TEST } |
| using | RecordingCallback = std::function<void(const RecordedInteraction&)> |
| using | GenerationCallback = std::function<void(const std::string& progress)> |
Public Member Functions | |
| absl::Status | StartRecording (const std::string &test_name, bool capture_state=true) |
| Start recording user interactions. | |
| absl::StatusOr< RecordingSession > | StopRecording () |
| Stop current recording session. | |
| void | PauseRecording () |
| Pause recording temporarily. | |
| void | ResumeRecording () |
| Resume paused recording. | |
| void | AnnotateRecording (const std::string &annotation) |
| Add annotation to current recording. | |
| absl::StatusOr< std::string > | GenerateTestFromRecording (const RecordingSession &session, const GenerationOptions &options={}) |
| Generate test code from recording. | |
| absl::StatusOr< std::string > | GenerateTestSuite (const TestSpecification &spec, const GenerationOptions &options={}) |
| Generate comprehensive test suite from specification. | |
| absl::StatusOr< std::string > | GenerateRegressionTest (const std::string &bug_description, const std::vector< std::string > &repro_steps, const std::string &expected_behavior, const GenerationOptions &options={}) |
| Generate regression test from bug report. | |
| absl::StatusOr< std::string > | GenerateFixture (app::editor::Editor *editor, const std::string &fixture_name) |
| Generate test fixture from current editor state. | |
| absl::StatusOr< std::string > | GenerateMock (const std::string &interface_name, const std::string &mock_name) |
| Generate mock object for testing. | |
| absl::StatusOr< TestResult > | ExecuteGeneratedTest (const std::string &test_code, bool compile_only=false) |
| Execute generated test code. | |
| absl::StatusOr< std::vector< TestResult > > | RunTestFile (const std::string &test_file, const std::string &filter="") |
| Run existing test file. | |
| absl::StatusOr< CoverageReport > | GenerateCoverageReport (const std::vector< TestResult > &test_results) |
| Generate coverage report for tests. | |
| std::vector< std::string > | ValidateTestCode (const std::string &test_code) |
| Validate generated test code. | |
| std::map< std::string, std::vector< std::string > > | CheckRequirementsCoverage (const std::string &test_code, const std::vector< std::string > &requirements) |
| Check if test covers specified requirements. | |
| absl::StatusOr< nlohmann::json > | SuggestTestCases (const std::string &code_under_test, const std::string &model_name="gemini") |
| Use AI model to suggest test cases. | |
| absl::StatusOr< std::string > | ImproveTest (const std::string &test_code, const std::vector< std::string > &improvement_goals) |
| Use AI to improve existing test. | |
| nlohmann::json | OrganizeTestSuites (const std::vector< std::string > &test_files) |
| Organize tests into suites. | |
| absl::StatusOr< std::string > | GenerateTestDocumentation (const std::string &test_file, const std::string &format="markdown") |
| Generate test documentation. | |
| void | SetRecordingCallback (RecordingCallback callback) |
| Set callback for recording events. | |
| void | SetGenerationCallback (GenerationCallback callback) |
| Set callback for generation progress. | |
Private Member Functions | |
| std::string | GenerateTestHeader (const GenerationOptions &options) const |
| std::string | GenerateTestBody (const RecordingSession &session, const GenerationOptions &options) const |
| std::string | GenerateAssertion (const RecordedInteraction &interaction, TestFramework framework) const |
| absl::Status | CompileTest (const std::string &test_code) const |
Private Attributes | |
| std::unique_ptr< RecordingSession > | current_recording_ |
| bool | is_recording_ = false |
| bool | is_paused_ = false |
| RecordingCallback | recording_callback_ |
| GenerationCallback | generation_callback_ |
API for automated test generation and execution.
Enables AI agents to generate, execute, and validate tests for YAZE components. Supports recording user interactions, generating regression tests, and creating comprehensive test suites.
Definition at line 26 of file test_generation_api.h.
| using yaze::cli::automation::TestGenerationAPI::RecordingCallback = std::function<void(const RecordedInteraction&)> |
Definition at line 318 of file test_generation_api.h.
| using yaze::cli::automation::TestGenerationAPI::GenerationCallback = std::function<void(const std::string& progress)> |
Definition at line 319 of file test_generation_api.h.
|
strong |
| Enumerator | |
|---|---|
| GTEST | |
| CATCH2 | |
| DOCTEST | |
| IMGUI_TEST | |
Definition at line 32 of file test_generation_api.h.
| absl::Status yaze::cli::automation::TestGenerationAPI::StartRecording | ( | const std::string & | test_name, |
| bool | capture_state = true ) |
Start recording user interactions.
| test_name | Name for the test being recorded |
| capture_state | If true, capture full editor state at each step |
| absl::StatusOr< RecordingSession > yaze::cli::automation::TestGenerationAPI::StopRecording | ( | ) |
Stop current recording session.
| void yaze::cli::automation::TestGenerationAPI::PauseRecording | ( | ) |
Pause recording temporarily.
| void yaze::cli::automation::TestGenerationAPI::ResumeRecording | ( | ) |
Resume paused recording.
| void yaze::cli::automation::TestGenerationAPI::AnnotateRecording | ( | const std::string & | annotation | ) |
Add annotation to current recording.
| annotation | Comment or description to add |
| absl::StatusOr< std::string > yaze::cli::automation::TestGenerationAPI::GenerateTestFromRecording | ( | const RecordingSession & | session, |
| const GenerationOptions & | options = {} ) |
Generate test code from recording.
| session | Recorded session to convert |
| options | Generation options |
| absl::StatusOr< std::string > yaze::cli::automation::TestGenerationAPI::GenerateTestSuite | ( | const TestSpecification & | spec, |
| const GenerationOptions & | options = {} ) |
Generate comprehensive test suite from specification.
| spec | Test specification |
| options | Generation options |
| absl::StatusOr< std::string > yaze::cli::automation::TestGenerationAPI::GenerateRegressionTest | ( | const std::string & | bug_description, |
| const std::vector< std::string > & | repro_steps, | ||
| const std::string & | expected_behavior, | ||
| const GenerationOptions & | options = {} ) |
Generate regression test from bug report.
| bug_description | Description of the bug |
| repro_steps | Steps to reproduce |
| expected_behavior | Expected correct behavior |
| options | Generation options |
| absl::StatusOr< std::string > yaze::cli::automation::TestGenerationAPI::GenerateFixture | ( | app::editor::Editor * | editor, |
| const std::string & | fixture_name ) |
Generate test fixture from current editor state.
| editor | Editor to capture state from |
| fixture_name | Name for the fixture class |
| absl::StatusOr< std::string > yaze::cli::automation::TestGenerationAPI::GenerateMock | ( | const std::string & | interface_name, |
| const std::string & | mock_name ) |
Generate mock object for testing.
| interface_name | Interface to mock |
| mock_name | Name for mock class |
| absl::StatusOr< TestResult > yaze::cli::automation::TestGenerationAPI::ExecuteGeneratedTest | ( | const std::string & | test_code, |
| bool | compile_only = false ) |
Execute generated test code.
| test_code | Generated test code |
| compile_only | If true, only compile without running |
| absl::StatusOr< std::vector< TestResult > > yaze::cli::automation::TestGenerationAPI::RunTestFile | ( | const std::string & | test_file, |
| const std::string & | filter = "" ) |
Run existing test file.
| test_file | Path to test file |
| filter | Optional test filter pattern |
| absl::StatusOr< CoverageReport > yaze::cli::automation::TestGenerationAPI::GenerateCoverageReport | ( | const std::vector< TestResult > & | test_results | ) |
Generate coverage report for tests.
| test_results | Results from test execution |
| std::vector< std::string > yaze::cli::automation::TestGenerationAPI::ValidateTestCode | ( | const std::string & | test_code | ) |
Validate generated test code.
| test_code | Code to validate |
| std::map< std::string, std::vector< std::string > > yaze::cli::automation::TestGenerationAPI::CheckRequirementsCoverage | ( | const std::string & | test_code, |
| const std::vector< std::string > & | requirements ) |
Check if test covers specified requirements.
| test_code | Test code to analyze |
| requirements | List of requirements to check |
| absl::StatusOr< nlohmann::json > yaze::cli::automation::TestGenerationAPI::SuggestTestCases | ( | const std::string & | code_under_test, |
| const std::string & | model_name = "gemini" ) |
Use AI model to suggest test cases.
| code_under_test | Code to generate tests for |
| model_name | AI model to use (e.g., "gemini", "ollama") |
| absl::StatusOr< std::string > yaze::cli::automation::TestGenerationAPI::ImproveTest | ( | const std::string & | test_code, |
| const std::vector< std::string > & | improvement_goals ) |
Use AI to improve existing test.
| test_code | Existing test code |
| improvement_goals | What to improve (coverage, performance, etc.) |
| nlohmann::json yaze::cli::automation::TestGenerationAPI::OrganizeTestSuites | ( | const std::vector< std::string > & | test_files | ) |
Organize tests into suites.
| test_files | List of test files |
| absl::StatusOr< std::string > yaze::cli::automation::TestGenerationAPI::GenerateTestDocumentation | ( | const std::string & | test_file, |
| const std::string & | format = "markdown" ) |
Generate test documentation.
| test_file | Test file to document |
| format | Documentation format (markdown, html, etc.) |
| void yaze::cli::automation::TestGenerationAPI::SetRecordingCallback | ( | RecordingCallback | callback | ) |
Set callback for recording events.
| void yaze::cli::automation::TestGenerationAPI::SetGenerationCallback | ( | GenerationCallback | callback | ) |
Set callback for generation progress.
|
private |
|
private |
|
private |
|
private |
|
private |
Definition at line 332 of file test_generation_api.h.
|
private |
Definition at line 333 of file test_generation_api.h.
|
private |
Definition at line 334 of file test_generation_api.h.
|
private |
Definition at line 335 of file test_generation_api.h.
|
private |
Definition at line 336 of file test_generation_api.h.