在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用$pwd:
$ git log --oneline --stat
stars:10,251
forks:3,369
updated:2026年3月19日 18:38
SKILL.md
| name | gen-test |
| description | Generate idiomatic tests for Go packages and handlers in the Meshery project. |
| tools | ["search/changes","search/codebase","edit/editFiles","vscode/extensions","web/fetch","web/githubRepo","vscode/getProjectSetupInfo","vscode/installExtension","vscode/newWorkspace","vscode/runCommand","vscode/openSimpleBrowser","read/problems","execute/getTerminalOutput","execute/runInTerminal","read/terminalLastCommand","read/terminalSelection","execute/createAndRunTask","execute","execute/runTask","execute/runTests","search","search/searchResults","execute/testFailure","search/usages","vscode/vscodeAPI","github/*","memory"] |
Generate idiomatic tests for Go packages and handlers in the Meshery project.
Invoke this skill with a target file or package path:
/gen-test server/handlers/provider_handler.go/gen-test mesheryctl/internal/cli/root/system/start.go*_test.go files) to match the project's testing style.t.Run subtestsTest<FunctionName> or Test<Type>_<Method>testify/assert or testify/require if already used in the package; otherwise use standard libraryhttptest.NewRecorder() and httptest.NewRequest()<source_file>_test.go (or append to existing test file if one exists)For handlers (server/handlers/):
For models (server/models/):
For mesheryctl commands (mesheryctl/):
func TestHandlerName(t *testing.T) {
tests := []struct {
name string
method string
path string
body string
expectedStatus int
}{
{
name: "valid request",
method: http.MethodGet,
path: "/api/resource",
expectedStatus: http.StatusOK,
},
{
name: "missing required field",
method: http.MethodPost,
path: "/api/resource",
body: `{}`,
expectedStatus: http.StatusBadRequest,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
req := httptest.NewRequest(tt.method, tt.path, strings.NewReader(tt.body))
rec := httptest.NewRecorder()
handler.ServeHTTP(rec, req)
if rec.Code != tt.expectedStatus {
t.Errorf("expected status %d, got %d", tt.expectedStatus, rec.Code)
}
})
}
}