# Technical Document Extraction: Automated Testing and Anomaly Injection Workflow
This document describes a three-phase technical workflow for generating workloads, designing anomalies, and executing automated data collection in a microservice environment.
## 1. High-Level Structure
The process is divided into three distinct horizontal phases, followed by a feedback loop for continuous data packaging.
* **Phase 1: Workload Generation** (Color-coded: Light Green)
* **Phase 2: Anomaly Design** (Color-coded: Orange)
* **Phase 3: Automated Execution & Collection** (Color-coded: Teal/Blue)
---
## 2. Phase 1: Workload Generation
This phase focuses on creating the baseline operational traffic for the system.
| Step | Component Name | Description/Details |
| :--- | :--- | :--- |
| 1.1 | **API Specification** | Uses Swagger/OpenAPI as the source. |
| 1.2 | **EvoMaster Test Generation** | Automated tool used to generate test cases based on the API spec. |
| 1.3 | **Workload (Success Tests)** | The final output of Phase 1, consisting of successful test scenarios. |
**Flow:** 1.1 $\rightarrow$ 1.2 $\rightarrow$ 1.3. The output of 1.3 feeds directly into the "Execute Workload" step in Phase 3.
---
## 3. Phase 2: Anomaly Design
This phase defines the faults that will be introduced into the system.
| Step | Component Name | Description/Details |
| :--- | :--- | :--- |
| 2.1 | **Fault Taxonomy** | Based on Industry Practice. |
| 2.2 | **Define Anomaly Case** | The process of specifying the parameters of the fault. |
| 2.3 | **Anomaly Library** | The final output of Phase 2, stored as YAML/Scripts. |
**Flow:** 2.1 $\rightarrow$ 2.2 $\rightarrow$ 2.3. The output of 2.3 feeds into the "Inject Anomaly" step in Phase 3.
---
## 4. Phase 3: Automated Execution & Collection
This phase represents the runtime environment where tests are executed and data is gathered.
### Linear Setup Sequence:
1. **System Reset & Cleanup:** Prepares the environment.
2. **Deploy Microservice system:** Initial deployment of the target architecture.
3. **Wait for pod/container stabilization:** Ensures the environment is ready before testing begins.
### Decision Logic and Execution:
Following stabilization, the process enters a decision diamond: **"Inject Anomaly?"**
* **If "Yes":**
* Proceeds to **Inject Anomaly** (utilizing the Anomaly Library from Phase 2).
* Then proceeds to **Execute Workload** (utilizing the Workload from Phase 1).
* **If "No":**
* Proceeds directly to **Execute Workload** (representing a "clean" or baseline run).
### Post-Execution and Data Collection:
After the workload is executed, the following steps occur in sequence:
1. **Collect 5 Modalities:** Gathering multi-dimensional system data.
2. **Terminate Anomaly & cleanup:** Returning the system to a neutral state.
3. **Package & Label Data:** Finalizing the dataset for analysis.
---
## 5. Feedback Loop and Iteration
* **Data Loop:** A dashed arrow points from "Package & Label Data" back to "System Reset & Cleanup," indicating an automated, iterative cycle for generating large datasets.
* **External Inputs:** The diagram shows that Phase 1 (Workload) and Phase 2 (Anomaly Library) provide the necessary "ingredients" that are injected into the Phase 3 runtime loop at specific execution points.
## 6. Component Summary
* **Total Phases:** 3
* **Decision Points:** 1 (Inject Anomaly?)
* **Data Modalities Collected:** 5
* **Primary Tools Mentioned:** Swagger/OpenAPI, EvoMaster, YAML/Scripts.