|
1 | 1 | # Test Plan for Agent365-Python SDK |
2 | 2 |
|
| 3 | +> **Note:** This plan is under active development. Keep updating as testing progresses. |
| 4 | +
|
3 | 5 | **Version:** 1.0 |
4 | 6 | **Date:** November 24, 2025 |
5 | | -**Status:** Draft |
6 | | -**Owner:** Team Review Required |
7 | | - |
8 | | ---- |
9 | | - |
10 | | -## Table of Contents |
11 | | - |
12 | | -1. [Overview](#overview) |
13 | | -2. [Testing Strategy](#testing-strategy) |
14 | | -3. [Phase 1: Unit Tests](#phase-1-unit-tests) |
15 | | -4. [Phase 2: Integration Tests](#phase-2-integration-tests) |
16 | | -5. [Phase 3: CI/CD Integration](#phase-3-cicd-integration) |
17 | | -6. [Success Criteria](#success-criteria) |
18 | | -7. [Implementation Roadmap](#implementation-roadmap) |
| 7 | +**Status:** Draft |
19 | 8 |
|
20 | 9 | --- |
21 | 10 |
|
22 | 11 | ## Overview |
23 | 12 |
|
24 | | -### Purpose |
25 | | -Establish comprehensive test coverage for the Agent365-Python SDK to ensure reliability, maintainability, and quality across all modules. |
26 | | - |
27 | 13 | ### Current State |
28 | | -- ✅ Some unit tests exist for `observability` module |
29 | | -- ⚠️ Partial coverage for `runtime` module |
| 14 | +- ✅ Unit tests exist for `observability` and `runtime` modules |
30 | 15 | - ❌ Missing tests for `tooling` and `notifications` modules |
31 | | -- ⚠️ Limited integration test coverage |
32 | | -- ❌ No automated coverage reporting in CI |
| 16 | +- ❌ No integration tests or CI/CD automation |
33 | 17 |
|
34 | 18 | ### Goals |
35 | | -1. Achieve **80%+ code coverage** across all modules |
36 | | -2. Implement unit tests following Python best practices (`unittest` framework) |
37 | | -3. Create integration tests for cross-module functionality |
38 | | -4. Integrate testing into CI/CD pipeline with automated coverage reporting |
39 | | -5. Establish testing standards for future development |
| 19 | +- Achieve **80%+ code coverage** across all modules |
| 20 | +- Implement integration tests for cross-module functionality |
| 21 | +- Integrate testing into CI/CD pipeline with coverage enforcement |
40 | 22 |
|
41 | 23 | --- |
42 | 24 |
|
43 | 25 | ## Testing Strategy |
44 | 26 |
|
45 | | -### Testing Pyramid |
46 | | - |
47 | | -``` |
48 | | - /\ |
49 | | - / \ Integration Tests |
50 | | - / \ - Module interactions |
51 | | - / \ - Mocked external services |
52 | | - /--------\ |
53 | | - / \ Unit Tests |
54 | | - / \ - Isolated function/class testing |
55 | | ----------------- - 80%+ coverage target |
56 | | -``` |
57 | | - |
58 | | -### Tools & Framework |
59 | | -- **Framework:** `unittest` + `pytest` runner |
60 | | -- **Coverage:** `pytest-cov` |
61 | | -- **Mocking:** `unittest.mock` |
62 | | -- **Async:** `pytest-asyncio` |
63 | | - |
64 | | -### Testing Principles |
65 | | -- **AAA Pattern:** Arrange → Act → Assert |
66 | | -- **FIRST:** Fast, Independent, Repeatable, Self-validating, Timely |
67 | | -- **Naming:** `test_<method>_<condition>_<expected_result>` |
| 27 | +**Framework:** `unittest` + `pytest` runner |
| 28 | +**Coverage:** `pytest-cov` |
| 29 | +**Mocking:** `unittest.mock` |
| 30 | +**Async:** `pytest-asyncio` |
| 31 | + |
| 32 | +**Test Pattern:** AAA (Arrange → Act → Assert) |
| 33 | +**Naming Convention:** `test_<method>_<condition>_<expected_result>` |
| 34 | + |
| 35 | +--- |
| 36 | + |
| 37 | +## Implementation Roadmap |
| 38 | + |
| 39 | +| Phase | Deliverables | Priority | |
| 40 | +|-------|-------------|----------| |
| 41 | +| 1.1 | Runtime unit tests | ✅ Complete | |
| 42 | +| 1.2 | Tooling unit tests | HIGH | |
| 43 | +| 1.3 | Notifications unit tests | HIGH | |
| 44 | +| 1.4 | Expand observability tests | MEDIUM | |
| 45 | +| 1.5 | Tooling extension tests | LOW | |
| 46 | +| 2 | Integration tests | MEDIUM | |
| 47 | +| 3 | CI/CD automation | HIGH | |
68 | 48 |
|
69 | 49 | --- |
70 | 50 |
|
71 | 51 | ## Phase 1: Unit Tests |
72 | 52 |
|
73 | | -### Phase 1.1: Runtime Module |
| 53 | +### 1.1 Runtime Module |
74 | 54 | **Priority:** HIGH |
75 | 55 |
|
76 | | -| Module | Test File | Status | Priority | |
77 | | -|--------|-----------|--------|----------| |
78 | | -| `power_platform_api_discovery.py` | `test_power_platform_api_discovery.py` | ✅ Exists | Review & Expand | |
79 | | -| `utility.py` | `test_utility.py` | ✅ Exists | Review & Expand | |
80 | | -| `environment_utils.py` | `test_environment_utils.py` | ❌ Missing | **HIGH** | |
81 | | -| `version_utils.py` | `test_version_utils.py` | ❌ Missing | Medium | |
82 | | - |
83 | | -**Key Areas to Test:** |
84 | | -- Environment detection and configuration |
85 | | -- Authentication scope resolution |
86 | | -- Version utilities with deprecation warnings |
87 | | -- Power Platform API discovery |
| 56 | +| Module | Test File | Status | |
| 57 | +|--------|-----------|--------| |
| 58 | +| `power_platform_api_discovery.py` | `test_power_platform_api_discovery.py` | ✅ Complete | |
| 59 | +| `utility.py` | `test_utility.py` | ✅ Complete | |
| 60 | +| `environment_utils.py` | `test_environment_utils.py` | ✅ Complete | |
| 61 | +| `version_utils.py` | `test_version_utils.py` | ✅ Complete | |
88 | 62 |
|
89 | 63 | --- |
90 | 64 |
|
91 | | -### Phase 1.2: Tooling Module |
| 65 | +### 1.2 Tooling Module |
92 | 66 | **Priority:** HIGH |
93 | 67 |
|
94 | | -**Directory Structure:** |
95 | | -``` |
96 | | -tests/tooling/ |
97 | | -├── utils/test_utility.py |
98 | | -├── models/test_mcp_server_config.py |
99 | | -└── services/test_mcp_tool_server_configuration_service.py |
100 | | -``` |
101 | | - |
102 | | -**Key Areas to Test:** |
103 | | -- MCP server configuration and validation |
104 | | -- Environment-based URL generation |
105 | | -- Tools mode handling (Mock vs Platform) |
106 | | -- Gateway discovery and authentication |
107 | | -- Manifest file parsing |
| 68 | +| Module | Test File | Status | |
| 69 | +|--------|-----------|--------| |
| 70 | +| `utils/utility.py` | `test_utility.py` | ❌ Missing | |
| 71 | +| `models/mcp_server_config.py` | `test_mcp_server_config.py` | ❌ Missing | |
| 72 | +| `services/mcp_tool_server_configuration_service.py` | `test_mcp_tool_server_configuration_service.py` | ❌ Missing | |
108 | 73 |
|
109 | 74 | --- |
110 | 75 |
|
111 | | -### Phase 1.3: Notifications Module |
| 76 | +### 1.3 Notifications Module |
112 | 77 | **Priority:** HIGH |
113 | 78 |
|
114 | | -**Directory Structure:** |
115 | | -``` |
116 | | -tests/notifications/ |
117 | | -├── models/ |
118 | | -│ ├── test_agent_lifecycle_event.py |
119 | | -│ ├── test_agent_notification_activity.py |
120 | | -│ ├── test_email_reference.py |
121 | | -│ └── test_notification_types.py |
122 | | -└── test_agent_notification.py |
123 | | -``` |
124 | | - |
125 | | -**Key Areas to Test:** |
126 | | -- Activity parsing and entity extraction |
127 | | -- Notification routing and filtering |
128 | | -- Decorator functionality |
129 | | -- Channel and subchannel handling |
| 79 | +| Module | Test File | Status | |
| 80 | +|--------|-----------|--------| |
| 81 | +| `models/agent_lifecycle_event.py` | `test_agent_lifecycle_event.py` | ❌ Missing | |
| 82 | +| `models/agent_notification_activity.py` | `test_agent_notification_activity.py` | ❌ Missing | |
| 83 | +| `models/email_reference.py` | `test_email_reference.py` | ❌ Missing | |
| 84 | +| `agent_notification.py` | `test_agent_notification.py` | ❌ Missing | |
130 | 85 |
|
131 | 86 | --- |
132 | 87 |
|
133 | | -### Phase 1.4: Observability Extensions |
| 88 | +### 1.4 Observability Extensions |
134 | 89 | **Priority:** MEDIUM |
135 | 90 |
|
136 | | -| Extension | Action | Priority | |
137 | | -|-----------|--------|----------| |
138 | | -| `agentframework` | Expand existing tests | Medium | |
139 | | -| `langchain` | Expand existing tests | Medium | |
140 | | -| `openai` | Expand existing tests | Medium | |
141 | | -| `semantickernel` | Expand existing tests | Medium | |
142 | | - |
143 | | -**Key Areas to Test:** |
144 | | -- Wrapper functionality |
145 | | -- Trace processing |
146 | | -- Event handling |
| 91 | +| Extension | Status | |
| 92 | +|-----------|--------| |
| 93 | +| `agentframework` | ✅ Expand existing | |
| 94 | +| `langchain` | ✅ Expand existing | |
| 95 | +| `openai` | ✅ Expand existing | |
| 96 | +| `semantickernel` | ✅ Expand existing | |
147 | 97 |
|
148 | 98 | --- |
149 | 99 |
|
150 | | -### Phase 1.5: Tooling Extensions |
| 100 | +### 1.5 Tooling Extensions |
151 | 101 | **Priority:** LOW |
152 | 102 |
|
153 | | -**Extensions to Test:** |
154 | | -- Agent Framework tooling integration |
155 | | -- Azure AI Foundry tooling integration |
156 | | -- OpenAI tooling integration |
157 | | -- Semantic Kernel tooling integration |
| 103 | +| Extension | Status | |
| 104 | +|-----------|--------| |
| 105 | +| Agent Framework | ❌ Missing | |
| 106 | +| Azure AI Foundry | ❌ Missing | |
| 107 | +| OpenAI | ❌ Missing | |
| 108 | +| Semantic Kernel | ❌ Missing | |
158 | 109 |
|
159 | 110 | --- |
160 | 111 |
|
161 | 112 | ## Phase 2: Integration Tests |
162 | 113 |
|
163 | | -### Phase 2.1: Module Integration |
164 | | -**Priority:** HIGH |
165 | | - |
166 | | -**Test Scenarios:** |
167 | | -- Runtime + Observability integration |
168 | | -- Tooling + Runtime integration |
169 | | -- Notifications + Runtime integration |
170 | | -- End-to-end workflow scenarios |
171 | | - |
172 | | -**Focus:** |
173 | | -- Cross-module interactions |
174 | | -- Mocked external dependencies |
175 | | -- Configuration propagation |
176 | | -- Error handling across boundaries |
177 | | - |
178 | | ---- |
179 | | - |
180 | | -### Phase 2.2: Extension Integration |
181 | 114 | **Priority:** MEDIUM |
182 | 115 |
|
183 | | -**Test Scenarios:** |
184 | | -- Agent Framework full flow |
185 | | -- LangChain full flow |
186 | | -- OpenAI Agents full flow |
187 | | -- Semantic Kernel full flow |
188 | | - |
189 | | -**Focus:** |
190 | | -- End-to-end agent execution with observability |
191 | | -- Tool invocation with MCP servers |
192 | | -- Notification delivery |
193 | | -- Cross-extension compatibility |
| 116 | +| Integration | Status | |
| 117 | +|-------------|--------| |
| 118 | +| Runtime + Observability | ❌ Missing | |
| 119 | +| Tooling + Runtime | ❌ Missing | |
| 120 | +| Notifications + Runtime | ❌ Missing | |
| 121 | +| Agent Framework full flow | ❌ Missing | |
| 122 | +| LangChain full flow | ❌ Missing | |
194 | 123 |
|
195 | 124 | --- |
196 | 125 |
|
197 | 126 | ## Phase 3: CI/CD Integration |
198 | 127 |
|
199 | | -### Phase 3.1: Test Automation |
200 | 128 | **Priority:** HIGH |
201 | 129 |
|
202 | | -**Setup:** |
203 | | -- GitHub Actions workflow for automated testing |
204 | | -- Multi-version Python matrix (3.9, 3.10, 3.11, 3.12) |
205 | | -- Automated coverage reporting with Codecov |
206 | | -- PR blocking on test failures |
207 | | - |
208 | | ---- |
209 | | - |
210 | | -### Phase 3.2: Coverage Requirements |
211 | | -**Priority:** HIGH |
212 | | - |
213 | | -**Configuration:** |
214 | | -- Minimum 80% code coverage enforcement |
215 | | -- Coverage reports in XML, HTML, and terminal formats |
216 | | -- Branch protection rules requiring passing tests |
217 | | -- Coverage trend tracking |
218 | | - |
219 | | ---- |
220 | | - |
221 | | -### Phase 3.3: Pre-commit Hooks |
222 | | -**Priority:** MEDIUM |
223 | | - |
224 | | -**Setup:** |
225 | | -- Code formatting checks (ruff) |
226 | | -- Test execution before commit |
227 | | -- YAML validation |
228 | | -- Trailing whitespace cleanup |
| 130 | +| Component | Status | |
| 131 | +|-----------|--------| |
| 132 | +| GitHub Actions workflow | ❌ Missing | |
| 133 | +| Python matrix (3.9-3.12) | ❌ Missing | |
| 134 | +| Coverage enforcement (80%+) | ❌ Missing | |
| 135 | +| Codecov integration | ❌ Missing | |
| 136 | +| PR blocking on failures | ❌ Missing | |
229 | 137 |
|
230 | 138 | --- |
231 | 139 |
|
232 | 140 | ## Success Criteria |
233 | 141 |
|
234 | | -### Phase 1: Unit Tests |
235 | 142 | - ✅ 80%+ code coverage for all modules |
236 | | -- ✅ All tests follow AAA pattern |
237 | | -- ✅ Tests run independently in any order |
238 | | -- ✅ Full suite completes in < 30 seconds |
239 | | - |
240 | | -### Phase 2: Integration Tests |
241 | | -- ✅ All major integration points tested |
242 | | -- ✅ 99%+ test reliability |
243 | | -- ✅ External services properly mocked |
244 | | -- ✅ Integration scenarios documented |
245 | | - |
246 | | -### Phase 3: CI/CD |
| 143 | +- ✅ All tests pass independently |
| 144 | +- ✅ Full suite completes in < 30 seconds (unit) / < 5 minutes (full) |
247 | 145 | - ✅ Automated test execution on all PRs |
248 | 146 | - ✅ Coverage reports visible and enforced |
249 | | -- ✅ PR merge blocked on test failures or coverage drops |
250 | | -- ✅ Tests pass on Python 3.9-3.12 |
251 | | -- ✅ Full suite completes in < 5 minutes |
252 | | - |
253 | | ---- |
254 | | - |
255 | | -## Implementation Roadmap |
256 | | - |
257 | | -| Phase | Focus | Deliverables | Owner | |
258 | | -|-------|-------|-------------|-------| |
259 | | -| 1.1 | Runtime Module | `test_environment_utils.py`, `test_version_utils.py` | TBD | |
260 | | -| 1.2 | Tooling Module | All tooling test files | TBD | |
261 | | -| 1.3 | Notifications Module | All notifications test files | TBD | |
262 | | -| 1.4 | Observability Extensions | Expand existing tests | TBD | |
263 | | -| 1.5 | Tooling Extensions | Extension test files | TBD | |
264 | | -| 2.1 | Module Integration | Integration test suite | TBD | |
265 | | -| 2.2 | Extension Integration | Full flow tests | TBD | |
266 | | -| 3 | CI/CD Setup | GitHub Actions, coverage, pre-commit | TBD | |
267 | | - |
268 | | -### Key Milestones |
269 | | -- **M1:** Runtime tests complete, baseline coverage established |
270 | | -- **M2:** All core module unit tests complete |
271 | | -- **M3:** Integration test framework in place |
272 | | -- **M4:** Full CI/CD integration, coverage enforcement |
273 | | - |
274 | | ---- |
275 | | - |
276 | | -## References |
277 | | - |
278 | | -- [Python unittest Documentation](https://docs.python.org/3/library/unittest.html) |
279 | | -- [pytest Documentation](https://docs.pytest.org/) |
280 | | -- [unittest.mock Guide](https://docs.python.org/3/library/unittest.mock.html) |
281 | | -- Existing tests: `tests/observability/core/` and `tests/runtime/` |
0 commit comments