Skip to content

Commit 00ef595

Browse files
committed
Added Precondition and steps in schema
1 parent 56b1954 commit 00ef595

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

src/tools/testmanagement-utils/update-testcase.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,13 @@ export interface TestCaseUpdateRequest {
1313
test_case_identifier: string;
1414
name?: string;
1515
description?: string;
16+
preconditions?: string;
17+
test_case_steps?: Array<{
18+
step: string;
19+
result: string;
20+
}>;
1621
}
1722

18-
1923
export const UpdateTestCaseSchema = z.object({
2024
project_identifier: z
2125
.string()
@@ -32,9 +36,21 @@ export const UpdateTestCaseSchema = z.object({
3236
.string()
3337
.optional()
3438
.describe("Updated brief description of the test case."),
39+
preconditions: z
40+
.string()
41+
.optional()
42+
.describe("Updated preconditions for the test case."),
43+
test_case_steps: z
44+
.array(
45+
z.object({
46+
step: z.string().describe("The action to perform in this step."),
47+
result: z.string().describe("The expected result of this step."),
48+
}),
49+
)
50+
.optional()
51+
.describe("Updated list of test case steps with expected results."),
3552
});
3653

37-
3854
/**
3955
* Updates an existing test case in BrowserStack Test Management.
4056
*/
@@ -56,6 +72,14 @@ export async function updateTestCase(
5672
testCaseBody.description = params.description;
5773
}
5874

75+
if (params.preconditions !== undefined) {
76+
testCaseBody.preconditions = params.preconditions;
77+
}
78+
79+
if (params.test_case_steps !== undefined) {
80+
testCaseBody.steps = params.test_case_steps;
81+
}
82+
5983
const body = { test_case: testCaseBody };
6084

6185
try {

src/tools/testmanagement.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
import {
1818
updateTestCase as updateTestCaseAPI,
1919
TestCaseUpdateRequest,
20-
sanitizeUpdateArgs,
2120
UpdateTestCaseSchema,
2221
} from "./testmanagement-utils/update-testcase.js";
2322

@@ -145,16 +144,14 @@ export async function updateTestCaseTool(
145144
config: BrowserStackConfig,
146145
server: McpServer,
147146
): Promise<CallToolResult> {
148-
// Sanitize input arguments
149-
const cleanedArgs = sanitizeUpdateArgs(args);
150147
try {
151148
trackMCP(
152149
"updateTestCase",
153150
server.server.getClientVersion()!,
154151
undefined,
155152
config,
156153
);
157-
return await updateTestCaseAPI(cleanedArgs, config);
154+
return await updateTestCaseAPI(args, config);
158155
} catch (err) {
159156
logger.error("Failed to update test case: %s", err);
160157
trackMCP("updateTestCase", server.server.getClientVersion()!, err, config);

0 commit comments

Comments
 (0)