@smartbear/mcp 0.30.0 → 0.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bearq/client.js +2 -6
- package/dist/bearq/tool/tasks/delete-test-cases.js +53 -0
- package/dist/package.json.js +1 -1
- package/dist/qtm4j/client.js +14 -0
- package/dist/qtm4j/config/constants.js +83 -2
- package/dist/qtm4j/config/field-resolution.types.js +12 -2
- package/dist/qtm4j/http/api-client.js +30 -4
- package/dist/qtm4j/http/auth-service.js +3 -2
- package/dist/qtm4j/resolver/resolver-registry.js +37 -1
- package/dist/qtm4j/resolver/resolvers/build-resolver.js +51 -0
- package/dist/qtm4j/resolver/resolvers/common-attribute-resolver.js +1 -3
- package/dist/qtm4j/resolver/resolvers/component-resolver.js +1 -1
- package/dist/qtm4j/resolver/resolvers/defect-id-resolver.js +44 -0
- package/dist/qtm4j/resolver/resolvers/defect-priority-resolver.js +55 -0
- package/dist/qtm4j/resolver/resolvers/defect-status-resolver.js +55 -0
- package/dist/qtm4j/resolver/resolvers/environment-resolver.js +51 -0
- package/dist/qtm4j/resolver/resolvers/execution-context-resolver.js +58 -0
- package/dist/qtm4j/resolver/resolvers/label-resolver.js +1 -1
- package/dist/qtm4j/resolver/resolvers/requirement-id-resolver.js +3 -4
- package/dist/qtm4j/resolver/resolvers/step-execution-context-resolver.js +62 -0
- package/dist/qtm4j/resolver/resolvers/test-case-uid-resolver.js +3 -4
- package/dist/qtm4j/resolver/resolvers/test-cycle-uid-resolver.js +3 -4
- package/dist/qtm4j/schema/get-bugs.schema.js +101 -0
- package/dist/qtm4j/schema/get-test-case.schema.js +3 -3
- package/dist/qtm4j/schema/link-bugs.schema.js +63 -0
- package/dist/qtm4j/schema/start-execution.schema.js +45 -0
- package/dist/qtm4j/schema/test-cycle.link.schema.js +10 -1
- package/dist/qtm4j/schema/update-test-case-execution.schema.js +41 -0
- package/dist/qtm4j/schema/update-test-step-execution.schema.js +41 -0
- package/dist/qtm4j/tool/project/get-projects.js +3 -3
- package/dist/qtm4j/tool/project/set-project-context.js +1 -1
- package/dist/qtm4j/tool/test-automation/get-automation-history.js +4 -7
- package/dist/qtm4j/tool/test-automation/upload-automation-result.js +4 -2
- package/dist/qtm4j/tool/test-execution/get-test-case-bugs.js +119 -0
- package/dist/qtm4j/tool/test-execution/get-test-step-bugs.js +122 -0
- package/dist/qtm4j/tool/test-execution/link-test-case-bugs.js +135 -0
- package/dist/qtm4j/tool/test-execution/link-test-step-bugs.js +140 -0
- package/dist/qtm4j/tool/test-execution/start-execution.js +150 -0
- package/dist/qtm4j/tool/test-execution/update-test-case-execution.js +123 -0
- package/dist/qtm4j/tool/test-execution/update-test-step-execution.js +126 -0
- package/dist/swagger/client/api.js +8 -1
- package/dist/swagger/client/functional-testing-api.js +5 -9
- package/dist/swagger/client/user-management-types.js +2 -1
- package/package.json +1 -1
- package/dist/bearq/tool/tasks/refine-all-draft-tests.js +0 -28
- package/dist/bearq/tool/tasks/refine-test-cases.js +0 -31
- package/dist/bearq/tool/tasks/refine-tests-in-functional-areas.js +0 -35
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Tool, ToolError } from "../../../common/tools.js";
|
|
2
|
+
import { TOOL_NAMES, TOOLSETS, ENDPOINTS } from "../../config/constants.js";
|
|
3
|
+
import { ResolverKeys } from "../../config/field-resolution.types.js";
|
|
4
|
+
import { UpdateTestCaseExecutionResponse, UpdateTestCaseExecutionBody } from "../../schema/update-test-case-execution.schema.js";
|
|
5
|
+
const FIELD_CONFIG = {
|
|
6
|
+
executionResultId: ResolverKeys.CommonAttribute.EXECUTION_RESULT,
|
|
7
|
+
environmentId: ResolverKeys.SearchableField.ENVIRONMENT,
|
|
8
|
+
buildId: ResolverKeys.SearchableField.BUILD
|
|
9
|
+
};
|
|
10
|
+
class UpdateTestCaseExecution extends Tool {
|
|
11
|
+
specification = {
|
|
12
|
+
title: TOOL_NAMES.UPDATE_TEST_CASE_EXECUTION.TITLE,
|
|
13
|
+
toolset: TOOLSETS.TEST_EXECUTIONS,
|
|
14
|
+
summary: TOOL_NAMES.UPDATE_TEST_CASE_EXECUTION.SUMMARY,
|
|
15
|
+
readOnly: false,
|
|
16
|
+
idempotent: true,
|
|
17
|
+
inputSchema: UpdateTestCaseExecutionBody,
|
|
18
|
+
outputSchema: UpdateTestCaseExecutionResponse,
|
|
19
|
+
purpose: "Update an existing test case execution.",
|
|
20
|
+
useCases: [
|
|
21
|
+
"Set a test case execution result (e.g. Pass, Fail, Blocked)",
|
|
22
|
+
"Update comment, environment, build, assignee, planned date, or actual time on an execution"
|
|
23
|
+
],
|
|
24
|
+
examples: [
|
|
25
|
+
{
|
|
26
|
+
description: "Mark test case as Pass",
|
|
27
|
+
parameters: {
|
|
28
|
+
testCycleKey: "PROJ-TR-101",
|
|
29
|
+
testCaseKey: "PROJ-TC-42",
|
|
30
|
+
executionResultId: "Pass"
|
|
31
|
+
},
|
|
32
|
+
expectedOutput: "{ testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', updated: true }"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
description: "Update with comment, environment, and actual time",
|
|
36
|
+
parameters: {
|
|
37
|
+
testCycleKey: "PROJ-TR-101",
|
|
38
|
+
testCaseKey: "PROJ-TC-42",
|
|
39
|
+
executionResultId: "Pass",
|
|
40
|
+
comment: "All smoke tests passed.",
|
|
41
|
+
environmentId: "Production",
|
|
42
|
+
actualTime: "01:30:00"
|
|
43
|
+
},
|
|
44
|
+
expectedOutput: "{ testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', updated: true }"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
description: "Clear comment",
|
|
48
|
+
parameters: {
|
|
49
|
+
testCycleKey: "PROJ-TR-101",
|
|
50
|
+
testCaseKey: "PROJ-TC-42",
|
|
51
|
+
comment: null
|
|
52
|
+
},
|
|
53
|
+
expectedOutput: "{ testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', updated: true }"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
hints: [
|
|
57
|
+
"Call set_project_context before this tool.",
|
|
58
|
+
"At least one updatable field must be provided.",
|
|
59
|
+
"environmentId and buildId accept environment/build name as strings that are resolved to numeric IDs; unresolved names are dropped and a warning is returned.",
|
|
60
|
+
"actualTime must be in 'HH:mm:ss' format (e.g. '01:30:00'). Always include seconds"
|
|
61
|
+
],
|
|
62
|
+
outputDescription: "Confirmation object with testCycleKey, testCaseKey, and updated: true. Warnings are returned in content if any resolvable field (executionResultId, environmentId, buildId) could not be resolved and was dropped."
|
|
63
|
+
};
|
|
64
|
+
handle = async (rawArgs) => {
|
|
65
|
+
const { testCycleKey, testCaseKey, ...bodyArgs } = UpdateTestCaseExecutionBody.parse(rawArgs);
|
|
66
|
+
if (!Object.values(bodyArgs).some((v) => v !== void 0)) {
|
|
67
|
+
throw new ToolError("Provide at least one updatable field.");
|
|
68
|
+
}
|
|
69
|
+
const fieldResolver = this.client.getResolverRegistry();
|
|
70
|
+
const context = fieldResolver.requireProjectContext();
|
|
71
|
+
const warnings = [];
|
|
72
|
+
const testCaseExecutionId = await this.resolveTestCaseExecutionId(
|
|
73
|
+
fieldResolver,
|
|
74
|
+
context,
|
|
75
|
+
testCycleKey,
|
|
76
|
+
testCaseKey
|
|
77
|
+
);
|
|
78
|
+
const body = { ...bodyArgs };
|
|
79
|
+
await Promise.all(
|
|
80
|
+
Object.entries(FIELD_CONFIG).map(
|
|
81
|
+
([inputField, resolverKey]) => fieldResolver.getResolver(resolverKey).resolve(inputField, resolverKey, body, context, warnings)
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
if (Object.keys(body).length === 0) {
|
|
85
|
+
throw new ToolError(
|
|
86
|
+
`No updatable fields remain after resolution. ${warnings.join(" | ")}`
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
await this.client.getApiClient().put(
|
|
90
|
+
ENDPOINTS.UPDATE_TEST_CASE_EXECUTION(testCycleKey, testCaseExecutionId),
|
|
91
|
+
body
|
|
92
|
+
);
|
|
93
|
+
const validated = UpdateTestCaseExecutionResponse.parse({
|
|
94
|
+
testCycleKey,
|
|
95
|
+
testCaseKey,
|
|
96
|
+
updated: true
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
structuredContent: validated,
|
|
100
|
+
content: warnings.length > 0 ? [{ type: "text", text: `Note: ${warnings.join(" | ")}` }] : []
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
async resolveTestCaseExecutionId(fieldResolver, context, testCycleKey, testCaseKey) {
|
|
104
|
+
const result = await fieldResolver.getResolver(ResolverKeys.SearchableField.EXECUTION_CONTEXT).resolveAndReturn(context.projectKey, context.projectId, testCycleKey, [
|
|
105
|
+
testCaseKey
|
|
106
|
+
]);
|
|
107
|
+
const entry = result[testCaseKey];
|
|
108
|
+
if (!entry) {
|
|
109
|
+
throw new ToolError(
|
|
110
|
+
`Test case '${testCaseKey}' is not linked to test cycle '${testCycleKey}'. Verify the key and ensure it belongs to the cycle.`
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
if (entry.testCaseExecutionId == null) {
|
|
114
|
+
throw new ToolError(
|
|
115
|
+
`No execution has been started for test case '${testCaseKey}' in cycle '${testCycleKey}'. Use start_new_execution first.`
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return entry.testCaseExecutionId;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
export {
|
|
122
|
+
UpdateTestCaseExecution
|
|
123
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Tool, ToolError } from "../../../common/tools.js";
|
|
2
|
+
import { TOOL_NAMES, TOOLSETS, ENDPOINTS } from "../../config/constants.js";
|
|
3
|
+
import { ResolverKeys } from "../../config/field-resolution.types.js";
|
|
4
|
+
import { UpdateTestStepExecutionResponse, UpdateTestStepExecutionBody } from "../../schema/update-test-step-execution.schema.js";
|
|
5
|
+
const FIELD_CONFIG = {
|
|
6
|
+
executionResultId: ResolverKeys.CommonAttribute.EXECUTION_RESULT
|
|
7
|
+
};
|
|
8
|
+
class UpdateTestStepExecution extends Tool {
|
|
9
|
+
specification = {
|
|
10
|
+
title: TOOL_NAMES.UPDATE_TEST_STEP_EXECUTION.TITLE,
|
|
11
|
+
toolset: TOOLSETS.TEST_EXECUTIONS,
|
|
12
|
+
summary: TOOL_NAMES.UPDATE_TEST_STEP_EXECUTION.SUMMARY,
|
|
13
|
+
readOnly: false,
|
|
14
|
+
idempotent: true,
|
|
15
|
+
inputSchema: UpdateTestStepExecutionBody,
|
|
16
|
+
outputSchema: UpdateTestStepExecutionResponse,
|
|
17
|
+
purpose: "Update an existing test step execution.",
|
|
18
|
+
useCases: [
|
|
19
|
+
"Set a test step execution result (e.g. Pass, Fail, Blocked)",
|
|
20
|
+
"Update actualResult or comment on a test step execution"
|
|
21
|
+
],
|
|
22
|
+
examples: [
|
|
23
|
+
{
|
|
24
|
+
description: "Mark step 2 as Pass",
|
|
25
|
+
parameters: {
|
|
26
|
+
testCycleKey: "PROJ-TR-101",
|
|
27
|
+
testCaseKey: "PROJ-TC-42",
|
|
28
|
+
testStepSeqNo: 2,
|
|
29
|
+
executionResultId: "Pass"
|
|
30
|
+
},
|
|
31
|
+
expectedOutput: "{ testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', testStepSeqNo: 2, executionResultName: 'Pass', updated: true }"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
description: "Update step 3 with actualResult and comment",
|
|
35
|
+
parameters: {
|
|
36
|
+
testCycleKey: "PROJ-TR-101",
|
|
37
|
+
testCaseKey: "PROJ-TC-42",
|
|
38
|
+
testStepSeqNo: 3,
|
|
39
|
+
executionResultId: "Fail",
|
|
40
|
+
actualResult: "Button not found on page.",
|
|
41
|
+
comment: "Reproduced consistently in Chrome."
|
|
42
|
+
},
|
|
43
|
+
expectedOutput: "{ testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', testStepSeqNo: 3, executionResultName: 'Fail', updated: true }"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
description: "Clear actualResult on step 1",
|
|
47
|
+
parameters: {
|
|
48
|
+
testCycleKey: "PROJ-TR-101",
|
|
49
|
+
testCaseKey: "PROJ-TC-42",
|
|
50
|
+
testStepSeqNo: 1,
|
|
51
|
+
actualResult: null
|
|
52
|
+
},
|
|
53
|
+
expectedOutput: "{ testCycleKey: 'PROJ-TR-101', testCaseKey: 'PROJ-TC-42', testStepSeqNo: 1, updated: true }"
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
hints: [
|
|
57
|
+
"Call set_project_context before this tool.",
|
|
58
|
+
"At least one updatable field must be provided."
|
|
59
|
+
],
|
|
60
|
+
outputDescription: "Confirmation object with testCycleKey, testCaseKey, testStepSeqNo, and updated: true. executionResultName is included when the server returns it. Warnings are returned in content if executionResultId name could not be resolved."
|
|
61
|
+
};
|
|
62
|
+
handle = async (rawArgs) => {
|
|
63
|
+
const { testCycleKey, testCaseKey, testStepSeqNo, ...bodyArgs } = UpdateTestStepExecutionBody.parse(rawArgs);
|
|
64
|
+
if (!Object.values(bodyArgs).some((v) => v !== void 0)) {
|
|
65
|
+
throw new ToolError("Provide at least one updatable field.");
|
|
66
|
+
}
|
|
67
|
+
const fieldResolver = this.client.getResolverRegistry();
|
|
68
|
+
const context = fieldResolver.requireProjectContext();
|
|
69
|
+
const warnings = [];
|
|
70
|
+
const testStepExecutionId = await this.resolveTestStepExecutionId(
|
|
71
|
+
fieldResolver,
|
|
72
|
+
context,
|
|
73
|
+
testCycleKey,
|
|
74
|
+
testCaseKey,
|
|
75
|
+
testStepSeqNo
|
|
76
|
+
);
|
|
77
|
+
const body = { ...bodyArgs };
|
|
78
|
+
await Promise.all(
|
|
79
|
+
Object.entries(FIELD_CONFIG).map(
|
|
80
|
+
([inputField, resolverKey]) => fieldResolver.getResolver(resolverKey).resolve(inputField, resolverKey, body, context, warnings)
|
|
81
|
+
)
|
|
82
|
+
);
|
|
83
|
+
if (Object.keys(body).length === 0) {
|
|
84
|
+
throw new ToolError(
|
|
85
|
+
`No updatable fields remain after resolution. ${warnings.join(" | ")}`
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
const apiResponse = await this.client.getApiClient().put(
|
|
89
|
+
ENDPOINTS.UPDATE_TEST_STEP_EXECUTION(testCycleKey, testStepExecutionId),
|
|
90
|
+
body
|
|
91
|
+
);
|
|
92
|
+
const validated = UpdateTestStepExecutionResponse.parse({
|
|
93
|
+
testCycleKey,
|
|
94
|
+
testCaseKey,
|
|
95
|
+
testStepSeqNo,
|
|
96
|
+
...apiResponse?.executionResultName !== void 0 && {
|
|
97
|
+
executionResultName: apiResponse.executionResultName
|
|
98
|
+
},
|
|
99
|
+
updated: true
|
|
100
|
+
});
|
|
101
|
+
return {
|
|
102
|
+
structuredContent: validated,
|
|
103
|
+
content: warnings.length > 0 ? [{ type: "text", text: `Note: ${warnings.join(" | ")}` }] : []
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
async resolveTestStepExecutionId(fieldResolver, context, testCycleKey, testCaseKey, testStepSeqNo) {
|
|
107
|
+
const stepCtxResult = await fieldResolver.getResolver(ResolverKeys.SearchableField.STEP_EXECUTION_CONTEXT).resolveAndReturn(
|
|
108
|
+
context.projectKey,
|
|
109
|
+
context.projectId,
|
|
110
|
+
testCycleKey,
|
|
111
|
+
testCaseKey,
|
|
112
|
+
[testStepSeqNo]
|
|
113
|
+
);
|
|
114
|
+
const stepMap = stepCtxResult[testCaseKey] ?? {};
|
|
115
|
+
const testStepExecutionId = stepMap[testStepSeqNo];
|
|
116
|
+
if (testStepExecutionId == null) {
|
|
117
|
+
throw new ToolError(
|
|
118
|
+
`Step ${testStepSeqNo} was not found in this execution.`
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return testStepExecutionId;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
UpdateTestStepExecution
|
|
126
|
+
};
|
|
@@ -129,7 +129,14 @@ class SwaggerAPI {
|
|
|
129
129
|
response,
|
|
130
130
|
defaultResponse
|
|
131
131
|
);
|
|
132
|
-
|
|
132
|
+
const list = result;
|
|
133
|
+
if (list.items) {
|
|
134
|
+
list.items = list.items.map((org) => {
|
|
135
|
+
const { email: _email, ...rest } = org;
|
|
136
|
+
return rest;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return list;
|
|
133
140
|
}
|
|
134
141
|
async createPortal(body) {
|
|
135
142
|
const response = await fetch(`${this.config.portalBasePath}/portals`, {
|
|
@@ -120,10 +120,11 @@ class FunctionalTestingAPI {
|
|
|
120
120
|
...data,
|
|
121
121
|
executions: {
|
|
122
122
|
data: data.executions.data.map(
|
|
123
|
-
({ executionId, status, isFinished }) => ({
|
|
123
|
+
({ executionId, status, isFinished, url }) => ({
|
|
124
124
|
executionId,
|
|
125
125
|
status,
|
|
126
|
-
isFinished
|
|
126
|
+
isFinished,
|
|
127
|
+
url
|
|
127
128
|
})
|
|
128
129
|
)
|
|
129
130
|
}
|
|
@@ -181,7 +182,7 @@ class FunctionalTestingAPI {
|
|
|
181
182
|
},
|
|
182
183
|
errorMessageFor("run suite")
|
|
183
184
|
);
|
|
184
|
-
return
|
|
185
|
+
return response.json();
|
|
185
186
|
}
|
|
186
187
|
async getSuiteExecution(args) {
|
|
187
188
|
if (!args.suiteId) throw new ToolError("suiteId argument is required");
|
|
@@ -196,7 +197,7 @@ class FunctionalTestingAPI {
|
|
|
196
197
|
},
|
|
197
198
|
errorMessageFor("get suite execution status")
|
|
198
199
|
);
|
|
199
|
-
const data = await
|
|
200
|
+
const data = await response.json();
|
|
200
201
|
const testsData = data.tests?.data;
|
|
201
202
|
if (Array.isArray(testsData)) {
|
|
202
203
|
for (const test of testsData) {
|
|
@@ -230,11 +231,6 @@ class FunctionalTestingAPI {
|
|
|
230
231
|
);
|
|
231
232
|
return response.json();
|
|
232
233
|
}
|
|
233
|
-
async withoutField(field, response) {
|
|
234
|
-
const data = await response.json();
|
|
235
|
-
delete data[field];
|
|
236
|
-
return data;
|
|
237
|
-
}
|
|
238
234
|
}
|
|
239
235
|
function handleStatus(messages, defaultMessage) {
|
|
240
236
|
return (response) => messages.get(response.status) || defaultMessage(response);
|
|
@@ -16,7 +16,8 @@ const OrganizationsListOutputSchema = z.object({
|
|
|
16
16
|
z.looseObject({
|
|
17
17
|
id: z.string().optional(),
|
|
18
18
|
name: z.string().optional(),
|
|
19
|
-
|
|
19
|
+
description: z.string().optional(),
|
|
20
|
+
url: z.string().optional(),
|
|
20
21
|
memberCount: z.number().optional()
|
|
21
22
|
})
|
|
22
23
|
).optional()
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Tool, ToolError } from "../../../common/tools.js";
|
|
3
|
-
const inputSchema = z.object({});
|
|
4
|
-
class RefineAllDraftTests extends Tool {
|
|
5
|
-
specification = {
|
|
6
|
-
title: "Refine All Draft Tests",
|
|
7
|
-
toolset: "Tasks",
|
|
8
|
-
summary: "Refines every draft test case in the workspace. Use to push an entire draft backlog forward; may take multiple passes before all drafts are ready to be promoted to regression tests.",
|
|
9
|
-
inputSchema
|
|
10
|
-
};
|
|
11
|
-
handle = async (_args) => {
|
|
12
|
-
const res = await fetch(`${this.client.getBaseUrl()}/tasks`, {
|
|
13
|
-
method: "POST",
|
|
14
|
-
headers: this.client.getHeaders(),
|
|
15
|
-
body: JSON.stringify({ agent: "tester", mode: "refine" })
|
|
16
|
-
});
|
|
17
|
-
if (!res.ok)
|
|
18
|
-
throw new ToolError(
|
|
19
|
-
`POST /tasks failed: ${res.status} ${res.statusText}`
|
|
20
|
-
);
|
|
21
|
-
return {
|
|
22
|
-
content: [{ type: "text", text: JSON.stringify(await res.json()) }]
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
RefineAllDraftTests
|
|
28
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Tool, ToolError } from "../../../common/tools.js";
|
|
3
|
-
const inputSchema = z.object({
|
|
4
|
-
testCaseIds: z.array(z.number().int().positive()).min(1).describe("IDs of BearQ draft test cases to refine.")
|
|
5
|
-
});
|
|
6
|
-
class RefineTestCases extends Tool {
|
|
7
|
-
specification = {
|
|
8
|
-
title: "Refine Test Cases",
|
|
9
|
-
toolset: "Tasks",
|
|
10
|
-
summary: "Refines specific BearQ draft test cases — improves their steps so they can eventually be promoted to regression tests. Use when a draft is incomplete or has drifted from its intent.",
|
|
11
|
-
inputSchema
|
|
12
|
-
};
|
|
13
|
-
handle = async (args) => {
|
|
14
|
-
const { testCaseIds } = inputSchema.parse(args);
|
|
15
|
-
const res = await fetch(`${this.client.getBaseUrl()}/tasks`, {
|
|
16
|
-
method: "POST",
|
|
17
|
-
headers: this.client.getHeaders(),
|
|
18
|
-
body: JSON.stringify({ agent: "tester", mode: "refine", testCaseIds })
|
|
19
|
-
});
|
|
20
|
-
if (!res.ok)
|
|
21
|
-
throw new ToolError(
|
|
22
|
-
`POST /tasks failed: ${res.status} ${res.statusText}`
|
|
23
|
-
);
|
|
24
|
-
return {
|
|
25
|
-
content: [{ type: "text", text: JSON.stringify(await res.json()) }]
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
RefineTestCases
|
|
31
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Tool, ToolError } from "../../../common/tools.js";
|
|
3
|
-
const inputSchema = z.object({
|
|
4
|
-
functionalAreas: z.array(z.union([z.number().int().positive(), z.string().min(1)])).min(1).describe("Functional areas to target, by ID or name.")
|
|
5
|
-
});
|
|
6
|
-
class RefineTestsInFunctionalAreas extends Tool {
|
|
7
|
-
specification = {
|
|
8
|
-
title: "Refine Tests in Functional Areas",
|
|
9
|
-
toolset: "Tasks",
|
|
10
|
-
summary: "Refines every draft test case tagged with one or more functional areas. Functional areas can be given by ID or name. May take multiple passes before drafts are ready to be promoted to regression tests.",
|
|
11
|
-
inputSchema
|
|
12
|
-
};
|
|
13
|
-
handle = async (args) => {
|
|
14
|
-
const { functionalAreas } = inputSchema.parse(args);
|
|
15
|
-
const res = await fetch(`${this.client.getBaseUrl()}/tasks`, {
|
|
16
|
-
method: "POST",
|
|
17
|
-
headers: this.client.getHeaders(),
|
|
18
|
-
body: JSON.stringify({
|
|
19
|
-
agent: "tester",
|
|
20
|
-
mode: "refine",
|
|
21
|
-
functionalAreas
|
|
22
|
-
})
|
|
23
|
-
});
|
|
24
|
-
if (!res.ok)
|
|
25
|
-
throw new ToolError(
|
|
26
|
-
`POST /tasks failed: ${res.status} ${res.statusText}`
|
|
27
|
-
);
|
|
28
|
-
return {
|
|
29
|
-
content: [{ type: "text", text: JSON.stringify(await res.json()) }]
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
export {
|
|
34
|
-
RefineTestsInFunctionalAreas
|
|
35
|
-
};
|