-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmcp_test_planner.py
More file actions
152 lines (126 loc) · 4.52 KB
/
mcp_test_planner.py
File metadata and controls
152 lines (126 loc) · 4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
"""
MCP Test Planner for Customer Management App
This script uses Sequential Thinking MCP to plan and organize test cases
"""
import os
import sys
import json
from datetime import datetime
def plan_customer_add_test():
"""
Use sequential thinking to plan a test for adding customers
In actual implementation, this would use the MCP server. Here we simulate
the thought process manually.
"""
test_plan = []
# Simulating what would be done with MCP sequential thinking
# In real usage with MCP:
# mcp2_sequentialthinking(thought="Step 1: Setup test environment",
# thoughtNumber=1, totalThoughts=5, nextThoughtNeeded=True)
test_plan.append({
"thought": "Step 1: Setup test environment - Launch application and verify initial state",
"thoughtNumber": 1,
"actions": [
"Launch customer_manager.py",
"Verify customer list is displayed",
"Verify form is empty"
]
})
test_plan.append({
"thought": "Step 2: Test basic customer addition functionality",
"thoughtNumber": 2,
"actions": [
"Fill out name field with 'Test Customer'",
"Fill out email field with 'test@example.com'",
"Fill out phone field with '555-123-4567'",
"Select or create a directory",
"Click save button",
"Verify customer appears in list"
]
})
test_plan.append({
"thought": "Step 3: Test validation rules",
"thoughtNumber": 3,
"actions": [
"Attempt to save without name field",
"Verify appropriate error message",
"Attempt to save with invalid email format",
"Verify appropriate error message"
]
})
test_plan.append({
"thought": "Step 4: Test customer editing",
"thoughtNumber": 4,
"actions": [
"Select previously created customer",
"Modify details",
"Save changes",
"Verify changes are reflected in list"
]
})
test_plan.append({
"thought": "Step 5: Test customer deletion",
"thoughtNumber": 5,
"actions": [
"Select customer to delete",
"Trigger delete action",
"Confirm deletion in dialog",
"Verify customer is removed from list"
]
})
return test_plan
def plan_case_folder_test():
"""Plan test cases for case folder functionality"""
test_plan = []
# Simulating sequential thinking for case folder testing
test_plan.append({
"thought": "Step 1: Setup test with existing customer",
"thoughtNumber": 1,
"actions": [
"Ensure at least one customer exists in system",
"Navigate to case folder tab",
"Select existing customer from dropdown"
]
})
test_plan.append({
"thought": "Step 2: Test case folder creation",
"thoughtNumber": 2,
"actions": [
"Enter case number 'TEST-001'",
"Enter description 'Test Case'",
"Select template from dropdown",
"Click create button",
"Verify case folder appears in list"
]
})
# Additional steps would continue here
return test_plan
def generate_test_report(test_plans):
"""Generate a formatted test plan report"""
report = "# Customer Management App Test Plan\n\n"
report += f"Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n\n"
for test_name, plan in test_plans.items():
report += f"## {test_name}\n\n"
for step in plan:
report += f"### {step['thought']}\n\n"
for i, action in enumerate(step['actions'], 1):
report += f"{i}. {action}\n"
report += "\n"
return report
def main():
"""Main function to generate test plans"""
# Generate test plans
test_plans = {
"Customer Addition Test": plan_customer_add_test(),
"Case Folder Test": plan_case_folder_test()
}
# Generate report
report = generate_test_report(test_plans)
# Save report to file
with open("test_plan.md", "w") as f:
f.write(report)
print(f"Test plan generated and saved to test_plan.md")
# In a real implementation, you could use Playwright MCP to execute these tests
# and GitHub MCP to track results or create issues for failed tests
if __name__ == "__main__":
main()