@autobe/agent 0.9.1 → 0.10.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/lib/AutoBeAgent.js +16 -5
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +6 -4
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeTokenUsage.d.ts +15 -1
- package/lib/context/AutoBeTokenUsage.js +56 -1
- package/lib/context/AutoBeTokenUsage.js.map +1 -1
- package/lib/context/IAutoBeApplicationProps.d.ts +0 -61
- package/lib/factory/createAutoBeApplication.js +298 -773
- package/lib/factory/createAutoBeApplication.js.map +1 -1
- package/lib/index.mjs +5116 -7271
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +82 -319
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js +0 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeReviewer.js.map +1 -1
- package/lib/orchestrate/analyze/orchestrateAnalyze.js +97 -294
- package/lib/orchestrate/analyze/orchestrateAnalyze.js.map +1 -1
- package/lib/orchestrate/facade/transformFacadeStateMessage.js +2 -2
- package/lib/orchestrate/facade/transformFacadeStateMessage.js.map +1 -1
- package/lib/orchestrate/index.d.ts +2 -2
- package/lib/orchestrate/index.js +4 -4
- package/lib/orchestrate/index.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +9 -3
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js +56 -142
- package/lib/orchestrate/interface/orchestrateInterfaceComplement.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js +195 -199
- package/lib/orchestrate/interface/orchestrateInterfaceComponents.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js +75 -172
- package/lib/orchestrate/interface/orchestrateInterfaceEndpoints.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js +772 -1097
- package/lib/orchestrate/interface/orchestrateInterfaceOperations.js.map +1 -1
- package/lib/orchestrate/interface/transformInterfaceHistories.js +2 -0
- package/lib/orchestrate/interface/transformInterfaceHistories.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js +64 -175
- package/lib/orchestrate/prisma/orchestratePrismaComponent.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +552 -1073
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js +571 -1119
- package/lib/orchestrate/prisma/orchestratePrismaSchema.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js +9 -0
- package/lib/orchestrate/prisma/transformPrismaComponentsHistories.js.map +1 -1
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js +8 -0
- package/lib/orchestrate/prisma/transformPrismaSchemaHistories.js.map +1 -1
- package/lib/orchestrate/realize/orchestrateRealize.d.ts +11 -0
- package/lib/orchestrate/realize/orchestrateRealize.js +109 -0
- package/lib/orchestrate/realize/orchestrateRealize.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.d.ts +25 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js +337 -0
- package/lib/orchestrate/realize/orchestrateRealizeCoder.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.d.ts +52 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js +57 -0
- package/lib/orchestrate/realize/orchestrateRealizeIntegrator.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.d.ts +80 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js +53 -0
- package/lib/orchestrate/realize/orchestrateRealizePlanner.js.map +1 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.d.ts +46 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js +37 -0
- package/lib/orchestrate/realize/orchestrateRealizeValidator.js.map +1 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.d.ts +33 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js +3 -0
- package/lib/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.js.map +1 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.d.ts +5 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js +127 -0
- package/lib/orchestrate/realize/transformRealizeCoderHistories.js.map +1 -0
- package/lib/orchestrate/test/compile/completeTestCode.d.ts +2 -0
- package/lib/orchestrate/test/compile/completeTestCode.js +21 -0
- package/lib/orchestrate/test/compile/completeTestCode.js.map +1 -0
- package/lib/orchestrate/test/{filterTestFileName.js → compile/filterTestFileName.js} +1 -1
- package/lib/orchestrate/test/compile/filterTestFileName.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.d.ts +3 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js +27 -0
- package/lib/orchestrate/test/compile/getTestExternalDeclarations.js.map +1 -0
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.d.ts +5 -0
- package/lib/orchestrate/test/{compileTestScenario.js → compile/getTestScenarioArtifacts.js} +11 -5
- package/lib/orchestrate/test/compile/getTestScenarioArtifacts.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTest.js +14 -9
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js +150 -349
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.js +323 -566
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +3 -2
- package/lib/orchestrate/test/orchestrateTestWrite.js +139 -76
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.d.ts +121 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestCorrectApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.d.ts +8 -0
- package/lib/{utils/types/BackoffOptions.js → orchestrate/test/structures/IAutoBeTestFunction.js} +1 -1
- package/lib/orchestrate/test/structures/IAutoBeTestFunction.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +32 -22
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +2 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.d.ts +112 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.d.ts +7 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestWriteResult.js.map +1 -0
- package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +3 -2
- package/lib/orchestrate/test/transformTestCorrectHistories.js +28 -41
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +5 -4
- package/lib/orchestrate/test/transformTestWriteHistories.js +169 -32
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -1
- package/lib/structures/IAutoBeConfig.d.ts +11 -0
- package/lib/structures/IAutoBeProps.d.ts +12 -1
- package/lib/utils/backoffRetry.d.ts +4 -7
- package/lib/utils/backoffRetry.js +19 -37
- package/lib/utils/backoffRetry.js.map +1 -1
- package/lib/utils/forceRetry.d.ts +1 -0
- package/lib/{orchestrate/orchestrateRealize.js → utils/forceRetry.js} +15 -8
- package/lib/utils/forceRetry.js.map +1 -0
- package/package.json +8 -8
- package/src/AutoBeAgent.ts +26 -4
- package/src/constants/AutoBeSystemPromptConstant.ts +6 -4
- package/src/context/AutoBeTokenUsage.ts +85 -1
- package/src/context/IAutoBeApplicationProps.ts +0 -62
- package/src/factory/createAutoBeApplication.ts +2 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +8 -3
- package/src/orchestrate/analyze/AutoBeAnalyzeReviewer.ts +0 -1
- package/src/orchestrate/analyze/orchestrateAnalyze.ts +8 -37
- package/src/orchestrate/facade/transformFacadeStateMessage.ts +2 -1
- package/src/orchestrate/index.ts +2 -2
- package/src/orchestrate/interface/orchestrateInterface.ts +7 -0
- package/src/orchestrate/interface/orchestrateInterfaceComplement.ts +4 -3
- package/src/orchestrate/interface/orchestrateInterfaceComponents.ts +26 -23
- package/src/orchestrate/interface/orchestrateInterfaceEndpoints.ts +6 -4
- package/src/orchestrate/interface/orchestrateInterfaceOperations.ts +14 -11
- package/src/orchestrate/interface/transformInterfaceHistories.ts +2 -0
- package/src/orchestrate/prisma/orchestratePrismaComponent.ts +10 -5
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +11 -5
- package/src/orchestrate/prisma/orchestratePrismaSchema.ts +16 -8
- package/src/orchestrate/prisma/transformPrismaComponentsHistories.ts +9 -0
- package/src/orchestrate/prisma/transformPrismaSchemaHistories.ts +8 -0
- package/src/orchestrate/realize/orchestrateRealize.ts +169 -0
- package/src/orchestrate/realize/orchestrateRealizeCoder.ts +156 -0
- package/src/orchestrate/realize/orchestrateRealizeIntegrator.ts +75 -0
- package/src/orchestrate/realize/orchestrateRealizePlanner.ts +115 -0
- package/src/orchestrate/realize/orchestrateRealizeValidator.ts +64 -0
- package/src/orchestrate/realize/structures/IAutoBeRealizeCoderApplication.ts +36 -0
- package/src/orchestrate/realize/transformRealizeCoderHistories.ts +136 -0
- package/src/orchestrate/test/compile/completeTestCode.ts +35 -0
- package/src/orchestrate/test/{filterTestFileName.ts → compile/filterTestFileName.ts} +1 -1
- package/src/orchestrate/test/compile/getTestExternalDeclarations.ts +24 -0
- package/src/orchestrate/test/{compileTestScenario.ts → compile/getTestScenarioArtifacts.ts} +17 -8
- package/src/orchestrate/test/experimental/orchestrateTestCorrect.ast +240 -0
- package/src/orchestrate/test/experimental/orchestrateTestWrite.ast +316 -0
- package/src/orchestrate/test/experimental/transformTestCorrectHistories.ast +52 -0
- package/src/orchestrate/test/orchestrateTest.ts +38 -16
- package/src/orchestrate/test/orchestrateTestCorrect.ts +111 -338
- package/src/orchestrate/test/orchestrateTestScenario.ts +114 -69
- package/src/orchestrate/test/orchestrateTestWrite.ts +55 -153
- package/src/orchestrate/test/structures/IAutoBeTestCorrectApplication.ts +126 -0
- package/src/orchestrate/test/structures/IAutoBeTestFunction.ts +10 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +32 -22
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +3 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteApplication.ts +117 -0
- package/src/orchestrate/test/structures/IAutoBeTestWriteResult.ts +9 -0
- package/src/orchestrate/test/transformTestCorrectHistories.ts +38 -43
- package/src/orchestrate/test/transformTestWriteHistories.ts +89 -35
- package/src/structures/IAutoBeConfig.ts +9 -0
- package/src/structures/IAutoBeProps.ts +17 -1
- package/src/utils/backoffRetry.ts +25 -36
- package/src/utils/forceRetry.ts +13 -0
- package/lib/factory/invertOpenApiDocument.d.ts +0 -3
- package/lib/factory/invertOpenApiDocument.js +0 -51
- package/lib/factory/invertOpenApiDocument.js.map +0 -1
- package/lib/orchestrate/orchestrateRealize.d.ts +0 -5
- package/lib/orchestrate/orchestrateRealize.js.map +0 -1
- package/lib/orchestrate/test/compileTestScenario.d.ts +0 -5
- package/lib/orchestrate/test/compileTestScenario.js.map +0 -1
- package/lib/orchestrate/test/filterTestFileName.js.map +0 -1
- package/lib/utils/StringUtil.d.ts +0 -4
- package/lib/utils/StringUtil.js +0 -43
- package/lib/utils/StringUtil.js.map +0 -1
- package/lib/utils/types/BackoffOptions.d.ts +0 -12
- package/lib/utils/types/BackoffOptions.js.map +0 -1
- package/src/factory/invertOpenApiDocument.ts +0 -63
- package/src/orchestrate/orchestrateRealize.ts +0 -18
- package/src/utils/StringUtil.ts +0 -45
- package/src/utils/types/BackoffOptions.ts +0 -15
- /package/lib/orchestrate/test/{filterTestFileName.d.ts → compile/filterTestFileName.d.ts} +0 -0
|
@@ -48,11 +48,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
48
48
|
exports.orchestrateTestScenario = orchestrateTestScenario;
|
|
49
49
|
const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js"));
|
|
50
50
|
const core_1 = require("@agentica/core");
|
|
51
|
+
const utils_1 = require("@autobe/utils");
|
|
52
|
+
const tstl_1 = require("tstl");
|
|
51
53
|
const typia_1 = __importDefault(require("typia"));
|
|
52
54
|
const uuid_1 = require("uuid");
|
|
53
55
|
const assertSchemaModel_1 = require("../../context/assertSchemaModel");
|
|
54
56
|
const divideArray_1 = require("../../utils/divideArray");
|
|
55
57
|
const enforceToolCall_1 = require("../../utils/enforceToolCall");
|
|
58
|
+
const forceRetry_1 = require("../../utils/forceRetry");
|
|
56
59
|
function orchestrateTestScenario(ctx) {
|
|
57
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
61
|
var _a, _b, _c, _d;
|
|
@@ -60,12 +63,26 @@ function orchestrateTestScenario(ctx) {
|
|
|
60
63
|
if (operations.length === 0) {
|
|
61
64
|
throw new Error("Cannot write test scenarios because these are no operations.");
|
|
62
65
|
}
|
|
66
|
+
const dict = new tstl_1.HashMap(operations.map((op) => new tstl_1.Pair({
|
|
67
|
+
path: op.path,
|
|
68
|
+
method: op.method,
|
|
69
|
+
}, op)), utils_1.AutoBeEndpointComparator.hashCode, utils_1.AutoBeEndpointComparator.equals);
|
|
70
|
+
const endpointNotFound = [
|
|
71
|
+
`You have to select one of the endpoints below`,
|
|
72
|
+
"",
|
|
73
|
+
" method | path ",
|
|
74
|
+
"--------|------",
|
|
75
|
+
...operations.map((op) => `\`${op.method}\` | \`${op.path}\``).join("\n"),
|
|
76
|
+
].join("\n");
|
|
63
77
|
const exclude = [];
|
|
64
78
|
let include = Array.from(operations);
|
|
65
79
|
do {
|
|
66
|
-
const matrix = (0, divideArray_1.divideArray)({
|
|
67
|
-
|
|
68
|
-
|
|
80
|
+
const matrix = (0, divideArray_1.divideArray)({
|
|
81
|
+
array: include,
|
|
82
|
+
capacity: 5,
|
|
83
|
+
});
|
|
84
|
+
yield Promise.all(matrix.map((include) => __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
exclude.push(...(yield (0, forceRetry_1.forceRetry)(() => execute(ctx, dict, endpointNotFound, operations, include, exclude.map((x) => x.endpoint)))));
|
|
69
86
|
})));
|
|
70
87
|
include = include.filter((op) => {
|
|
71
88
|
if (exclude.some((pg) => pg.endpoint.method === op.method && pg.endpoint.path === op.path)) {
|
|
@@ -83,7 +100,7 @@ function orchestrateTestScenario(ctx) {
|
|
|
83
100
|
endpoint: pg.endpoint,
|
|
84
101
|
draft: plan.draft,
|
|
85
102
|
functionName: plan.functionName,
|
|
86
|
-
dependencies: plan.
|
|
103
|
+
dependencies: plan.dependencies,
|
|
87
104
|
};
|
|
88
105
|
});
|
|
89
106
|
}),
|
|
@@ -91,7 +108,7 @@ function orchestrateTestScenario(ctx) {
|
|
|
91
108
|
};
|
|
92
109
|
});
|
|
93
110
|
}
|
|
94
|
-
const execute = (ctx,
|
|
111
|
+
const execute = (ctx, dict, endpointNotFound, entire, include, exclude) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
112
|
var _a;
|
|
96
113
|
const pointer = {
|
|
97
114
|
value: [],
|
|
@@ -102,11 +119,12 @@ const execute = (ctx, ops, include, exclude) => __awaiter(void 0, void 0, void 0
|
|
|
102
119
|
config: Object.assign(Object.assign({}, ((_a = ctx.config) !== null && _a !== void 0 ? _a : {})), { executor: {
|
|
103
120
|
describe: null,
|
|
104
121
|
} }),
|
|
105
|
-
|
|
106
|
-
histories: createHistoryProperties(ops, include, exclude),
|
|
122
|
+
histories: createHistoryProperties(entire, include, exclude),
|
|
107
123
|
controllers: [
|
|
108
124
|
createApplication({
|
|
109
125
|
model: ctx.model,
|
|
126
|
+
endpointNotFound,
|
|
127
|
+
dict,
|
|
110
128
|
build: (next) => {
|
|
111
129
|
var _a;
|
|
112
130
|
(_a = pointer.value) !== null && _a !== void 0 ? _a : (pointer.value = []);
|
|
@@ -116,35 +134,42 @@ const execute = (ctx, ops, include, exclude) => __awaiter(void 0, void 0, void 0
|
|
|
116
134
|
],
|
|
117
135
|
});
|
|
118
136
|
(0, enforceToolCall_1.enforceToolCall)(agentica);
|
|
119
|
-
yield agentica.conversate(`create test scenarios.`)
|
|
137
|
+
yield agentica.conversate(`create test scenarios.`).finally(() => {
|
|
138
|
+
const tokenUsage = agentica.getTokenUsage();
|
|
139
|
+
ctx.usage().record(tokenUsage, ["test"]);
|
|
140
|
+
});
|
|
120
141
|
if (pointer.value.length === 0) {
|
|
121
142
|
throw new Error("Failed to create test plans.");
|
|
122
143
|
}
|
|
123
144
|
return pointer.value;
|
|
124
145
|
});
|
|
125
|
-
const createHistoryProperties = (
|
|
146
|
+
const createHistoryProperties = (entire, include, exclude) => [
|
|
126
147
|
{
|
|
127
148
|
id: (0, uuid_1.v4)(),
|
|
128
149
|
created_at: new Date().toISOString(),
|
|
129
150
|
type: "systemMessage",
|
|
130
|
-
text: "You are the AutoAPI Test Scenario Generator.\n\nYour job is to analyze an array of API operation objects and generate realistic, structured test scenario drafts for each operation.\n\n---\n\n## Input Format\n\nYou will receive an array of `Operation` objects structured like this:\n\n```ts\n{\n method: \"post\" | \"get\" | \"put\" | \"patch\" | \"delete\",\n path: \"/path/to/resource\",\n specification: string, // API specification with business logic and constraints\n description: string, // Multi-paragraph description\n summary: string, // One-line summary\n parameters: [...], // List of path/query/body parameters\n requestBody?: {\n typeName: string,\n description: string\n },\n responseBody: {\n typeName: string,\n description: string\n }\n}\n```\n\n---\n\n## Output Format\n\nYour output must be an array of grouped test plans, using the following structure:\n\n```ts\n[\n {\n method: \"post\",\n path: \"/shopping/products\",\n plans: [\n {\n draft: \"Test product creation by submitting two requests with the same product.pid. Confirm that the second request returns a uniqueness constraint error.\",\n dependsOn: [\n {\n method: \"post\",\n path: \"/shopping/categories\",\n purpose: \"Create a category beforehand so the product can reference it.\"\n },\n {\n method: \"get\",\n path: \"/users/me\",\n purpose: \"Verify a valid user session and obtain user context for the test.\"\n }\n ]\n },\n {\n draft: \"Verify that missing required fields like 'name' or 'price' trigger appropriate validation errors.\",\n dependsOn: []\n }\n ]\n },\n {\n method: \"patch\",\n path: \"/shopping/products/{productId}\",\n plans: [\n {\n draft: \"Attempt to update a product with an invalid productId and expect a 404 error.\",\n dependsOn: []\n }\n ]\n }\n]\n```\n\n- Each top-level object is a **plan group** for a single unique endpoint (`method + path`).\n- The `plans` array contains **one or more test drafts** for that endpoint.\n- Each `draft` may list its **prerequisite API calls** in the `dependsOn` array, which includes `method`, `path`, and a `purpose` for context.\n\n---\n\n### \u2705 **Uniqueness Rule**\n\n> \u26A0\uFE0F **Each `{method} + {path}` combination must appear only once** in the output array.\n> This means **you must not create multiple plan groups with the same HTTP method and path.**\n\n* Treat each `{method} + {path}` pair as a **unique test identifier**.\n* All test plans (`plans`) related to the same endpoint must be **grouped under a single PlanGroup object**.\n* Duplicating PlanGroups for the same endpoint will lead to invalid output.\n\n**\u2705 Good:**\n\n```ts\n[\n {\n method: \"patch\",\n path: \"/blog/posts/{postId}\",\n plans: [\n { draft: \"...\", dependsOn: [...] },\n { draft: \"...\", dependsOn: [...] }\n ]\n }\n]\n```\n\n**\u274C Bad:**\n\n```ts\n[\n {\n method: \"patch\",\n path: \"/blog/posts/{postId}\",\n plans: [ ... ]\n },\n {\n method: \"patch\",\n path: \"/blog/posts/{postId}\", // Duplicate! Not allowed.\n plans: [ ... ]\n }\n]\n```\n\n---\n\n## Writing Guidelines\n\n1. **draft**:\n - Write a clear and realistic test plan for the operation.\n - Include both success and failure cases where applicable.\n - Incorporate constraints mentioned in the API description such as uniqueness, foreign key requirements, or authentication.\n - For complex operations, include multiple steps within the same `draft` string (e.g., create \u2192 verify \u2192 delete).\n\n2. **dependsOn**:\n - List other API operations that must be invoked before this test can be executed.\n - Each item must include `method`, `path`, and `purpose`.\n - The `purpose` field should explain *why* the dependency is needed in the test setup.\n\n3. Treat each `{method} + {path}` combination as a unique test identifier.\n\n---\n\n## Purpose\n\nThese test scenario objects are designed to support QA engineers and backend developers in planning automated or manual tests. Each test draft reflects the core functionality and business rules of the API to ensure robust system behavior." /* AutoBeSystemPromptConstant.TEST_SCENARIO */,
|
|
151
|
+
text: "# API Test Scenario Generator AI Agent System Prompt\n\n## 1. Overview\n\nYou are a specialized AI Agent for generating comprehensive API test scenarios based on provided API operation definitions. Your core mission is to analyze API endpoints and create realistic, business-logic-focused test scenario drafts that will later be used by developers to implement actual E2E test functions.\n\n\nYou will receive an array of API operation objects along with their specifications, descriptions, and parameters. Based on these materials, you must generate structured test scenario groups that encompass both success and failure cases, considering real-world business constraints and user workflows.\n\nYour role is **scenario planning**. You must think like a QA engineer who understands business logic and user journeys, creating comprehensive test plans that cover edge cases, validation rules, and complex multi-step processes.\n\nThe final deliverable must be a structured output containing scenario groups with detailed test drafts, dependency mappings, and clear function naming that reflects user-centric perspectives.\n\n## 2. Input Material Composition\n\n### 2.1. API Operations Array\n\n* Complete API operation definitions with summary, method and path\n* Business logic descriptions and constraints embedded in summary\n\n**Deep Analysis Requirements:**\n\n* **Business Domain Understanding**: Identify the business domain (e-commerce, content management, user authentication, etc.) and understand typical user workflows\n* **Entity Relationship Discovery**: Map relationships between different entities (users, products, orders, reviews, etc.) and understand their dependencies\n* **Workflow Pattern Recognition**: Identify common patterns like CRUD operations, authentication flows, approval processes, and multi-step transactions\n* **Constraint and Validation Rule Extraction**: Extract business rules, validation constraints, uniqueness requirements, and permission-based access controls\n* **User Journey Mapping**: Understand complete user journeys that span multiple API calls and identify realistic test scenarios\n\n### 2.2. Include/Exclude Lists\n\n* **Include List**: API endpoints that must be covered in the test scenarios being generated. These are the primary targets of the current test generation.\n* **Exclude List**: Endpoints that do not require new test scenarios in this iteration. However, these endpoints may still be referenced as **dependencies** in the scenario drafts if the current tests logically depend on their outcomes or data.\n\n**Deep Analysis Requirements:**\n\n* **Dependency Identification**: Understand which excluded endpoints can serve as prerequisites for included endpoints\n* **Coverage Gap Analysis**: Ensure all included endpoints have comprehensive test coverage without redundancy\n* **Cross-Reference Mapping**: Map relationships between included endpoints and available excluded endpoints for dependency planning\n\n\uBB3C\uB860\uC785\uB2C8\uB2E4. \uC544\uB798\uB294 \uC2DC\uC2A4\uD15C \uD504\uB86C\uD504\uD2B8\uC5D0 \uC801\uD569\uD558\uB3C4\uB85D \uB2E4\uB4EC\uC740 \uC601\uC5B4 \uBC88\uC5ED\uC785\uB2C8\uB2E4:\n\n---\n\n## 3. Output: `IAutoBeTestScenarioApplication.IProps` Structure\n\nThe final output must strictly follow the `IAutoBeTestScenarioApplication.IProps` structure. This consists of a top-level array called `scenarioGroups`, where each group corresponds to a single, uniquely identifiable API `endpoint` (a combination of `method` and `path`). Each group contains a list of user-centric test `scenarios` that target the same endpoint.\n\n> \u26A0\uFE0F **Important:** Each `endpoint` in the `scenarioGroups` array must be **globally unique** based on its `method` + `path` combination. **You must not define the same endpoint across multiple scenario groups.** If multiple test scenarios are needed for a single endpoint, they must all be included in **one and only one** scenario group. Duplicate endpoint declarations across groups will lead to incorrect merging or misclassification of test plans and must be avoided at all costs.\n\nEach `scenario` contains a natural-language test description (`draft`), a clearly defined function name (`functionName`), and a list of prerequisite API calls (`dependencies`) needed to set up the test environment. This structured format ensures that the output can be reliably consumed for downstream automated test code generation.\n\n### 3.1. Output Example\n\n```ts\n{\n scenarioGroups: [\n {\n endpoint: { method: \"post\", path: \"/products\" }, // Must be globally unique\n scenarios: [\n {\n functionName: \"test_create_product_with_duplicate_sku\",\n draft:\n \"Test product creation failure caused by attempting to create a product with a duplicate SKU. First, create a seller account authorized to create products. Then, create an initial product with a specific SKU to set up the conflict condition. Finally, attempt to create another product with the same SKU and verify that the system returns a conflict error indicating SKU uniqueness violation.\",\n dependencies: [\n {\n endpoint: { method: \"post\", path: \"/shopping/sellers/auth/join\" },\n purpose:\n \"Create a seller account with permission to create products. This must be done first to ensure proper authorization.\"\n },\n {\n endpoint: { method: \"post\", path: \"/shopping/sellers/sales\" },\n purpose:\n \"Create the first product with a specific SKU to establish the conflict condition. This must be done after seller creation.\"\n }\n ]\n }\n ]\n }\n ]\n}\n```\n\nThis example demonstrates the correct structure for grouping multiple test scenarios under a single unique endpoint (`POST /products`). By consolidating scenarios within a single group and maintaining endpoint uniqueness across the entire output, the structure ensures consistency and prevents duplication during test plan generation.\n\n## 4. Core Scenario Generation Principles\n\n### 4.1. Business Logic Focus Principle\n\n* **Real-World Scenarios**: Generate scenarios that reflect actual user workflows and business processes\n* **End-to-End Thinking**: Consider complete user journeys that may span multiple API calls\n* **Business Rule Validation**: Include scenarios that test business constraints, validation rules, and edge cases\n* **User Perspective**: Write scenarios from the user's perspective, focusing on what users are trying to accomplish\n\n### 4.2. Comprehensive Coverage Principle\n\n* **Success Path Coverage**: Ensure all primary business functions are covered with successful execution scenarios\n* **Failure Path Coverage**: Include validation failures, permission errors, resource not found cases, and business rule violations\n* **Edge Case Identification**: Consider boundary conditions, race conditions, and unusual but valid user behaviors\n* **State Transition Testing**: Test different states of entities and valid/invalid state transitions\n\n### 4.3. Dependency Management Principle\n\n* **Prerequisite Identification**: Clearly identify all API calls that must precede the target operation (only when explicitly required)\n* **Data Setup Requirements**: Understand what data must exist before testing specific scenarios\n* **Authentication Context**: Include necessary authentication and authorization setup steps\n* **Logical Ordering**: Ensure dependencies are listed in the correct execution order if step-by-step execution is required\n\n> \u26A0\uFE0F **Note**: The `dependencies` field in a scenario is not a sequential execution plan. It is an indicative reference to other endpoints that this scenario relies on for logical or data setup context. If execution order is relevant, describe it explicitly in the `purpose` field of each dependency.\n\n### 4.4. Realistic Scenario Principle\n\n* **Authentic User Stories**: Create scenarios that represent real user needs and workflows\n* **Business Context Integration**: Embed scenarios within realistic business contexts (e.g., e-commerce purchase flows, content publication workflows)\n* **Multi-Step Process Modeling**: Model complex business processes that require multiple coordinated API calls\n* **Error Recovery Scenarios**: Include scenarios for how users recover from errors or complete alternative workflows\n\n### 4.5. Clear Communication Principle\n\n* **Descriptive Draft Writing**: Write clear, detailed scenario descriptions that developers can easily understand and implement\n* **Function Naming Clarity**: Create function names that immediately convey the user scenario being tested\n* **Dependency Purpose Explanation**: Clearly explain why each dependency is necessary for the test scenario\n* **Business Justification**: Explain the business value and importance of each test scenario\n\n## 5. Detailed Scenario Generation Guidelines\n\n### 5.1. API Analysis Methodology\n\n* **Domain Context Discovery**: Identify the business domain and understand typical user workflows within that domain\n* **Entity Relationship Mapping**: Map relationships between different entities and understand their lifecycle dependencies\n* **Permission Model Understanding**: Understand user roles, permissions, and access control patterns\n* **Business Process Identification**: Identify multi-step business processes that span multiple API endpoints\n* **Validation Rule Extraction**: Extract all validation rules, constraints, and business logic from API specifications\n\n### 5.2. Scenario Draft Structure\n\nEach scenario draft should include:\n\n* **Context Setting**: Brief explanation of the business context and user motivation\n* **Step-by-Step Process**: Detailed description of the testing process, including all necessary steps\n* **Expected Outcomes**: Clear description of what should happen in both success and failure cases\n* **Business Rule Validation**: Specific business rules or constraints being tested\n* **Data Requirements**: What data needs to be prepared or validated during testing\n\n### 5.3. Function Naming Guidelines\n\nFollow the user-centric naming convention:\n\n* **Prefix**: Must start with `test_`\n* **User Action**: Primary action the user is performing (create, get, update, delete, search, etc.)\n* **Target Resource**: What the user is interacting with (user, product, order, review, etc.)\n* **Scenario Context**: Specific situation or condition (valid\\_data, invalid\\_email, not\\_found, permission\\_denied, etc.)\n\n**Examples:**\n\n* `test_create_product_with_valid_data`\n* `test_update_product_price_without_permission`\n* `test_search_products_with_empty_results`\n* `test_delete_product_that_does_not_exist`\n\n### 5.4. Dependency Identification Process\n\n* **Prerequisite Data Creation**: Identify what entities must be created before testing the target endpoint\n* **Authentication Setup**: Determine necessary authentication and authorization steps\n* **State Preparation**: Understand what system state must be established before testing\n* **Resource Relationship**: Map relationships between resources and identify dependent resource creation\n\n### 5.5. Multi-Scenario Planning\n\nFor complex endpoints, generate multiple scenarios covering:\n\n* **Happy Path**: Successful execution with valid data\n* **Validation Errors**: Various types of input validation failures\n* **Permission Errors**: Unauthorized access attempts\n* **Resource State Errors**: Operations on resources in invalid states\n* **Business Rule Violations**: Attempts to violate domain-specific business rules\n\n## 6. Dependency Purpose Guidelines\n\n* **The `dependencies` array refers to relevant API calls this scenario logically depends on, whether or not they are in the include list.**\n* **The presence of a dependency does not imply that it must be executed immediately beforehand.**\n* **Execution order, if required, should be explained in the `purpose`.**\n\nExample:\n\n```yaml\n dependencies:\n - endpoint: { method: \"post\", path: \"/posts\" }\n functionName: \"test_create_post_with_valid_data\"\n purpose: \"Create a post and extract postId for use in voting scenario\"\n```\n\n## 7. Error Scenario Guidelines\n\n### 7.1. Purpose and Importance of Error Scenarios\n\nTest scenarios must cover not only successful business flows but also various error conditions to ensure robust system behavior. Error scenarios help verify that appropriate responses are returned for invalid inputs, unauthorized access, resource conflicts, and business rule violations.\n\n### 7.2. Error Scenario Categories\n\n* **Validation Errors**: Invalid input data, missing required fields, format violations\n* **Authentication/Authorization Errors**: Unauthorized access, insufficient permissions, expired sessions\n* **Resource State Errors**: Operations on non-existent resources, invalid state transitions\n* **Business Rule Violations**: Attempts to violate domain-specific constraints and rules\n* **System Constraint Violations**: Duplicate resource creation, referential integrity violations\n\n### 7.3. Error Scenario Writing Guidelines\n\n* **Specific Error Conditions**: Clearly define the error condition being tested\n* **Expected Error Response**: Specify what type of error response should be returned\n* **Realistic Error Situations**: Model error conditions that actually occur in real usage\n* **Recovery Scenarios**: Consider how users might recover from or handle error conditions\n\n\n### 7.4. Error Scenario Example\n\n```ts\n// scenarioGroups.scenarios[*]\n{\n draft: \"Test product creation failure caused by attempting to create a product with a duplicate SKU. First, create a seller account authorized to create products. Then, create an initial product with a specific SKU to set up the conflict condition. Finally, attempt to create another product with the same SKU and verify that the system returns a conflict error indicating SKU uniqueness violation. Note that these steps must be executed in order to properly simulate the scenario.\",\n functionName: \"test_create_product_with_duplicate_sku\",\n dependencies: [\n {\n endpoint: { method: \"post\", path: \"/shopping/sellers/auth/join\" },\n purpose: \"Create a seller account with permission to create products. This must be done first to ensure proper authorization.\"\n },\n {\n endpoint: { method: \"post\", path: \"/shopping/sellers/sales\" },\n purpose: \"Create the first product with a specific SKU to establish the conflict condition. This must be done after seller creation.\"\n }\n ]\n}\n```\n\n\n**Additional Notes:**\n\n* It is critical to explicitly declare *all* prerequisite API calls necessary to prepare the test context within the `dependencies` array.\n* Dependencies represent logical requirements for the scenario and may or may not require strict execution order.\n* When there *is* a required sequence, such as creating a user before creating a product tied to that user, you **must** clearly indicate this order either in the scenario\u2019s `draft` description or in the `purpose` explanation of each dependency.\n* This explicit approach prevents using placeholder or fake data (like dummy UUIDs) and instead ensures that all data setup is conducted via real API calls, increasing test reliability and maintainability.\n* Providing clear and detailed `draft` text describing the full user workflow and error expectations helps downstream agents or developers generate complete and realistic test implementations.\n\nBy following these guidelines, generated test scenarios will be comprehensive, accurate, and fully grounded in the actual API ecosystem and business logic.\n\n## 8. Final Checklist\n\n### 8.1. Essential Element Verification\n\n* [ ] Are all included endpoints covered with appropriate scenarios?\n* [ ] Do scenarios reflect realistic business workflows and user journeys?\n* [ ] Are function names descriptive and follow the user-centric naming convention?\n* [ ] Are all necessary dependencies identified and properly ordered?\n* [ ] Do dependency purposes clearly explain why each prerequisite is needed?\n* [ ] Are both success and failure scenarios included for complex operations?\n* [ ] Do scenarios test relevant business rules and validation constraints?\n\n### 8.2. Quality Element Verification\n\n* [ ] Are scenario descriptions detailed enough for developers to implement?\n* [ ] Do scenarios represent authentic user needs and workflows?\n* [ ] Is the business context clearly explained for each scenario?\n* [ ] Are error scenarios realistic and cover important failure conditions?\n* [ ] Do multi-step scenarios include all necessary intermediate steps?\n* [ ] Are scenarios grouped logically by endpoint and functionality?\n\n### 8.3. Structural Verification\n\n* [ ] Does the output follow the correct IAutoBeTestScenarioApplication.IProps structure?\n* [ ] Are all endpoint objects properly formatted with method and path?\n* [ ] Do all scenarios include required fields (draft, functionName, dependencies)?\n* [ ] Are dependency objects complete with endpoint and purpose information?\n* [ ] Is each endpoint method/path combination unique in the scenario groups?" /* AutoBeSystemPromptConstant.TEST_SCENARIO */,
|
|
131
152
|
},
|
|
132
153
|
{
|
|
133
154
|
id: (0, uuid_1.v4)(),
|
|
134
155
|
created_at: new Date().toISOString(),
|
|
135
156
|
type: "systemMessage",
|
|
136
157
|
text: [
|
|
158
|
+
"# Operations",
|
|
137
159
|
"Below are the full operations. Please refer to this.",
|
|
138
160
|
"Your role is to draft all test cases for each given Operation.",
|
|
139
161
|
"It is also permissible to write multiple test codes on a single endpoint.",
|
|
140
162
|
"However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.",
|
|
141
163
|
"",
|
|
164
|
+
"Please carefully analyze each operation to identify all dependencies required for testing.",
|
|
165
|
+
"For example, if you want to test liking and then deleting a post,",
|
|
166
|
+
"you might think to test post creation, liking, and unlike operations.",
|
|
167
|
+
"However, even if not explicitly mentioned, user registration and login are essential prerequisites.",
|
|
168
|
+
"Pay close attention to IDs and related values in the API,",
|
|
169
|
+
"and ensure you identify all dependencies between endpoints.",
|
|
170
|
+
"",
|
|
142
171
|
"```json",
|
|
143
|
-
JSON.stringify(
|
|
144
|
-
path: el.path,
|
|
145
|
-
method: el.method,
|
|
146
|
-
summary: el.summary,
|
|
147
|
-
}))),
|
|
172
|
+
JSON.stringify(entire.map((el) => (Object.assign(Object.assign({}, el), { specification: undefined })))),
|
|
148
173
|
"```",
|
|
149
174
|
].join("\n"),
|
|
150
175
|
},
|
|
@@ -172,7 +197,7 @@ function createApplication(props) {
|
|
|
172
197
|
(0, assertSchemaModel_1.assertSchemaModel)(props.model);
|
|
173
198
|
const application = collection[props.model];
|
|
174
199
|
application.functions[0].validate = (next) => {
|
|
175
|
-
const result = (() => { const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every(elem => "object" === typeof elem && null !== elem && _io3(elem))); const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.
|
|
200
|
+
const result = (() => { const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every(elem => "object" === typeof elem && null !== elem && _io3(elem))); const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependencies) && input.dependencies.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
176
201
|
path: _path + ".scenarioGroups",
|
|
177
202
|
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
178
203
|
value: input.scenarioGroups
|
|
@@ -228,22 +253,22 @@ function createApplication(props) {
|
|
|
228
253
|
path: _path + ".functionName",
|
|
229
254
|
expected: "string",
|
|
230
255
|
value: input.functionName
|
|
231
|
-
}), (Array.isArray(input.
|
|
232
|
-
path: _path + ".
|
|
233
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
234
|
-
value: input.
|
|
235
|
-
})) && input.
|
|
236
|
-
path: _path + ".
|
|
237
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
256
|
+
}), (Array.isArray(input.dependencies) || _report(_exceptionable, {
|
|
257
|
+
path: _path + ".dependencies",
|
|
258
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
259
|
+
value: input.dependencies
|
|
260
|
+
})) && input.dependencies.map((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
261
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
262
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
238
263
|
value: elem
|
|
239
|
-
})) && _vo4(elem, _path + ".
|
|
240
|
-
path: _path + ".
|
|
241
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
264
|
+
})) && _vo4(elem, _path + ".dependencies[" + _index6 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
265
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
266
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
242
267
|
value: elem
|
|
243
268
|
})).every(flag => flag) || _report(_exceptionable, {
|
|
244
|
-
path: _path + ".
|
|
245
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
246
|
-
value: input.
|
|
269
|
+
path: _path + ".dependencies",
|
|
270
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
271
|
+
value: input.dependencies
|
|
247
272
|
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => [("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
248
273
|
path: _path + ".endpoint",
|
|
249
274
|
expected: "AutoBeOpenApi.IEndpoint",
|
|
@@ -286,40 +311,50 @@ function createApplication(props) {
|
|
|
286
311
|
}; })()(next);
|
|
287
312
|
if (result.success === false)
|
|
288
313
|
return result;
|
|
314
|
+
// merge to unique scenario groups
|
|
315
|
+
const scenarioGroups = [];
|
|
316
|
+
result.data.scenarioGroups.forEach((sg) => {
|
|
317
|
+
const created = scenarioGroups.find((el) => el.endpoint.method === sg.endpoint.method &&
|
|
318
|
+
el.endpoint.path === sg.endpoint.path);
|
|
319
|
+
if (created) {
|
|
320
|
+
created.scenarios.push(...sg.scenarios);
|
|
321
|
+
}
|
|
322
|
+
else {
|
|
323
|
+
scenarioGroups.push(sg);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
// validate endpoints
|
|
289
327
|
const errors = [];
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
});
|
|
302
|
-
}
|
|
303
|
-
if (!errors.some((el) => el.path !== `planGroups[${j}].method` &&
|
|
304
|
-
el.value !== target.endpoint.method)) {
|
|
328
|
+
scenarioGroups.forEach((group, i) => {
|
|
329
|
+
if (props.dict.has(group.endpoint) === false)
|
|
330
|
+
errors.push({
|
|
331
|
+
value: group.endpoint,
|
|
332
|
+
path: `$input.scenarioGroups[${i}].endpoint`,
|
|
333
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
334
|
+
description: props.endpointNotFound,
|
|
335
|
+
});
|
|
336
|
+
group.scenarios.forEach((s, j) => {
|
|
337
|
+
s.dependencies.forEach((dep, k) => {
|
|
338
|
+
if (props.dict.has(dep.endpoint) === false)
|
|
305
339
|
errors.push({
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
340
|
+
value: dep.endpoint,
|
|
341
|
+
path: `$input.scenarioGroups[${i}].scenarios[${j}].dependencies[${k}].endpoint`,
|
|
342
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
343
|
+
description: props.endpointNotFound,
|
|
309
344
|
});
|
|
310
|
-
|
|
311
|
-
}
|
|
345
|
+
});
|
|
312
346
|
});
|
|
313
347
|
});
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
348
|
+
return errors.length === 0
|
|
349
|
+
? {
|
|
350
|
+
success: true,
|
|
351
|
+
data: scenarioGroups,
|
|
352
|
+
}
|
|
353
|
+
: {
|
|
317
354
|
success: false,
|
|
355
|
+
data: scenarioGroups,
|
|
318
356
|
errors,
|
|
319
|
-
data: next,
|
|
320
357
|
};
|
|
321
|
-
}
|
|
322
|
-
return result;
|
|
323
358
|
};
|
|
324
359
|
return {
|
|
325
360
|
protocol: "class",
|
|
@@ -350,129 +385,7 @@ const claude = {
|
|
|
350
385
|
description: "Array of test scenario groups.",
|
|
351
386
|
type: "array",
|
|
352
387
|
items: {
|
|
353
|
-
|
|
354
|
-
type: "object",
|
|
355
|
-
properties: {
|
|
356
|
-
endpoint: {
|
|
357
|
-
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
358
|
-
type: "object",
|
|
359
|
-
properties: {
|
|
360
|
-
path: {
|
|
361
|
-
title: "HTTP path of the API operation",
|
|
362
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.",
|
|
363
|
-
type: "string"
|
|
364
|
-
},
|
|
365
|
-
method: {
|
|
366
|
-
title: "HTTP method of the API operation",
|
|
367
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
368
|
-
oneOf: [
|
|
369
|
-
{
|
|
370
|
-
"const": "get"
|
|
371
|
-
},
|
|
372
|
-
{
|
|
373
|
-
"const": "post"
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
"const": "put"
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
"const": "delete"
|
|
380
|
-
},
|
|
381
|
-
{
|
|
382
|
-
"const": "patch"
|
|
383
|
-
}
|
|
384
|
-
]
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
required: [
|
|
388
|
-
"path",
|
|
389
|
-
"method"
|
|
390
|
-
]
|
|
391
|
-
},
|
|
392
|
-
scenarios: {
|
|
393
|
-
title: "Array of test scenarios",
|
|
394
|
-
description: "Array of test scenarios.",
|
|
395
|
-
type: "array",
|
|
396
|
-
items: {
|
|
397
|
-
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface extends `AutoBeOpenApi.IEndpoint`, inheriting its HTTP\n> method and path information, and adds two key properties:\n> \n> - `draft`: A free-form, human-readable test scenario description for the API\n> endpoint.\n> - `dependsOn`: A list of other API endpoints that must be invoked beforehand\n> in order to prepare the context for this test. Each dependency includes\n> the purpose of the dependency.\n> \n> This structure is intended to help organize test specifications for complex\n> workflows and ensure that all prerequisites are explicitly declared.",
|
|
398
|
-
type: "object",
|
|
399
|
-
properties: {
|
|
400
|
-
draft: {
|
|
401
|
-
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple test scenarios.",
|
|
402
|
-
type: "string"
|
|
403
|
-
},
|
|
404
|
-
functionName: {
|
|
405
|
-
title: "Descriptive function name derived from the user scenario",
|
|
406
|
-
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions",
|
|
407
|
-
type: "string"
|
|
408
|
-
},
|
|
409
|
-
dependsOn: {
|
|
410
|
-
description: "A list of other API endpoints that must be executed before this test\nscenario. This helps express dependencies such as data creation or\nauthentication steps required to reach the intended test state.",
|
|
411
|
-
type: "array",
|
|
412
|
-
items: {
|
|
413
|
-
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependsOn}",
|
|
414
|
-
type: "object",
|
|
415
|
-
properties: {
|
|
416
|
-
endpoint: {
|
|
417
|
-
description: "Target API endpoint that must be executed before the main operation.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
418
|
-
type: "object",
|
|
419
|
-
properties: {
|
|
420
|
-
path: {
|
|
421
|
-
title: "HTTP path of the API operation",
|
|
422
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.",
|
|
423
|
-
type: "string"
|
|
424
|
-
},
|
|
425
|
-
method: {
|
|
426
|
-
title: "HTTP method of the API operation",
|
|
427
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
428
|
-
oneOf: [
|
|
429
|
-
{
|
|
430
|
-
"const": "get"
|
|
431
|
-
},
|
|
432
|
-
{
|
|
433
|
-
"const": "post"
|
|
434
|
-
},
|
|
435
|
-
{
|
|
436
|
-
"const": "put"
|
|
437
|
-
},
|
|
438
|
-
{
|
|
439
|
-
"const": "delete"
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
"const": "patch"
|
|
443
|
-
}
|
|
444
|
-
]
|
|
445
|
-
}
|
|
446
|
-
},
|
|
447
|
-
required: [
|
|
448
|
-
"path",
|
|
449
|
-
"method"
|
|
450
|
-
]
|
|
451
|
-
},
|
|
452
|
-
purpose: {
|
|
453
|
-
description: "A concise exscenarioation of why this API call is required before\nexecuting the test for the main operation.\n\nExample: \"Creates a category so that a product can be linked to it during\ncreation.\"",
|
|
454
|
-
type: "string"
|
|
455
|
-
}
|
|
456
|
-
},
|
|
457
|
-
required: [
|
|
458
|
-
"endpoint",
|
|
459
|
-
"purpose"
|
|
460
|
-
]
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
},
|
|
464
|
-
required: [
|
|
465
|
-
"draft",
|
|
466
|
-
"functionName",
|
|
467
|
-
"dependsOn"
|
|
468
|
-
]
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
},
|
|
472
|
-
required: [
|
|
473
|
-
"endpoint",
|
|
474
|
-
"scenarios"
|
|
475
|
-
]
|
|
388
|
+
$ref: "#/$defs/IAutoBeTestScenarioApplication.IScenarioGroup"
|
|
476
389
|
}
|
|
477
390
|
}
|
|
478
391
|
},
|
|
@@ -480,10 +393,115 @@ const claude = {
|
|
|
480
393
|
"scenarioGroups"
|
|
481
394
|
],
|
|
482
395
|
additionalProperties: false,
|
|
483
|
-
$defs: {
|
|
396
|
+
$defs: {
|
|
397
|
+
"IAutoBeTestScenarioApplication.IScenarioGroup": {
|
|
398
|
+
type: "object",
|
|
399
|
+
properties: {
|
|
400
|
+
endpoint: {
|
|
401
|
+
title: "Target API endpoint to test",
|
|
402
|
+
description: "Target API endpoint to test.\n\nThis must be **unique** across all scenario groups. An endpoint is\nidentified by its `path` and `method` combination.\n\nMultiple test scenarios may exist for a single endpoint.",
|
|
403
|
+
$ref: "#/$defs/AutoBeOpenApi.IEndpoint"
|
|
404
|
+
},
|
|
405
|
+
scenarios: {
|
|
406
|
+
title: "An array of test scenarios associated with the given endpoint",
|
|
407
|
+
description: "An array of test scenarios associated with the given endpoint.\n\nEach scenario represents a specific test case for the same `path` and\n`method`.",
|
|
408
|
+
type: "array",
|
|
409
|
+
items: {
|
|
410
|
+
$ref: "#/$defs/IAutoBeTestScenarioApplication.IScenario"
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
required: [
|
|
415
|
+
"endpoint",
|
|
416
|
+
"scenarios"
|
|
417
|
+
]
|
|
418
|
+
},
|
|
419
|
+
"AutoBeOpenApi.IEndpoint": {
|
|
420
|
+
description: "API endpoint information.",
|
|
421
|
+
type: "object",
|
|
422
|
+
properties: {
|
|
423
|
+
path: {
|
|
424
|
+
title: "HTTP path of the API operation",
|
|
425
|
+
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.",
|
|
426
|
+
type: "string"
|
|
427
|
+
},
|
|
428
|
+
method: {
|
|
429
|
+
title: "HTTP method of the API operation",
|
|
430
|
+
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
431
|
+
oneOf: [
|
|
432
|
+
{
|
|
433
|
+
"const": "get"
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"const": "post"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"const": "put"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"const": "delete"
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"const": "patch"
|
|
446
|
+
}
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
},
|
|
450
|
+
required: [
|
|
451
|
+
"path",
|
|
452
|
+
"method"
|
|
453
|
+
]
|
|
454
|
+
},
|
|
455
|
+
"IAutoBeTestScenarioApplication.IScenario": {
|
|
456
|
+
description: "Represents a test scenario for a single API operation.\n\nThis interface defines a structured, user-centric test draft that includes\na descriptive function name, a detailed scenario draft, and logical\ndependencies on other endpoints required for context or setup.",
|
|
457
|
+
type: "object",
|
|
458
|
+
properties: {
|
|
459
|
+
draft: {
|
|
460
|
+
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple concrete test cases.",
|
|
461
|
+
type: "string"
|
|
462
|
+
},
|
|
463
|
+
functionName: {
|
|
464
|
+
title: "Descriptive function name derived from the user scenario",
|
|
465
|
+
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions",
|
|
466
|
+
type: "string"
|
|
467
|
+
},
|
|
468
|
+
dependencies: {
|
|
469
|
+
title: "A list of other API endpoints that this scenario logically depends on",
|
|
470
|
+
description: "A list of other API endpoints that this scenario logically depends on.\n\nThese dependencies represent context or prerequisite conditions, such as\nauthentication, resource creation, or data setup, that are relevant to\nthe test. This list is not a strict execution order \u2014 if ordering is\nimportant, it must be described explicitly in the `purpose`.",
|
|
471
|
+
type: "array",
|
|
472
|
+
items: {
|
|
473
|
+
$ref: "#/$defs/IAutoBeTestScenarioApplication.IDependencies"
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
required: [
|
|
478
|
+
"draft",
|
|
479
|
+
"functionName",
|
|
480
|
+
"dependencies"
|
|
481
|
+
]
|
|
482
|
+
},
|
|
483
|
+
"IAutoBeTestScenarioApplication.IDependencies": {
|
|
484
|
+
type: "object",
|
|
485
|
+
properties: {
|
|
486
|
+
endpoint: {
|
|
487
|
+
title: "Target API endpoint that this scenario depends on",
|
|
488
|
+
description: "Target API endpoint that this scenario depends on.",
|
|
489
|
+
$ref: "#/$defs/AutoBeOpenApi.IEndpoint"
|
|
490
|
+
},
|
|
491
|
+
purpose: {
|
|
492
|
+
description: "A concise explanation of why this API call is relevant or required for\nthe main test scenario.\n\nThis should describe the contextual or setup role of the dependency, such\nas creating necessary data or establishing user authentication.\n\nExample: \"Creates a category so that a product can be linked to it during\ncreation.\"",
|
|
493
|
+
type: "string"
|
|
494
|
+
}
|
|
495
|
+
},
|
|
496
|
+
required: [
|
|
497
|
+
"endpoint",
|
|
498
|
+
"purpose"
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
}
|
|
484
502
|
},
|
|
485
503
|
description: "Make test scenarios for the given endpoints.",
|
|
486
|
-
validate: (() => { const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every(elem => "object" === typeof elem && null !== elem && _io3(elem))); const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.
|
|
504
|
+
validate: (() => { const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every(elem => "object" === typeof elem && null !== elem && _io3(elem))); const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependencies) && input.dependencies.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
487
505
|
path: _path + ".scenarioGroups",
|
|
488
506
|
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
489
507
|
value: input.scenarioGroups
|
|
@@ -539,22 +557,22 @@ const claude = {
|
|
|
539
557
|
path: _path + ".functionName",
|
|
540
558
|
expected: "string",
|
|
541
559
|
value: input.functionName
|
|
542
|
-
}), (Array.isArray(input.
|
|
543
|
-
path: _path + ".
|
|
544
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
545
|
-
value: input.
|
|
546
|
-
})) && input.
|
|
547
|
-
path: _path + ".
|
|
548
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
560
|
+
}), (Array.isArray(input.dependencies) || _report(_exceptionable, {
|
|
561
|
+
path: _path + ".dependencies",
|
|
562
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
563
|
+
value: input.dependencies
|
|
564
|
+
})) && input.dependencies.map((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
565
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
566
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
549
567
|
value: elem
|
|
550
|
-
})) && _vo4(elem, _path + ".
|
|
551
|
-
path: _path + ".
|
|
552
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
568
|
+
})) && _vo4(elem, _path + ".dependencies[" + _index6 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
569
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
570
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
553
571
|
value: elem
|
|
554
572
|
})).every(flag => flag) || _report(_exceptionable, {
|
|
555
|
-
path: _path + ".
|
|
556
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
557
|
-
value: input.
|
|
573
|
+
path: _path + ".dependencies",
|
|
574
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
575
|
+
value: input.dependencies
|
|
558
576
|
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => [("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
559
577
|
path: _path + ".endpoint",
|
|
560
578
|
expected: "AutoBeOpenApi.IEndpoint",
|
|
@@ -618,111 +636,7 @@ const collection = {
|
|
|
618
636
|
description: "Array of test scenario groups.",
|
|
619
637
|
type: "array",
|
|
620
638
|
items: {
|
|
621
|
-
|
|
622
|
-
type: "object",
|
|
623
|
-
properties: {
|
|
624
|
-
endpoint: {
|
|
625
|
-
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
626
|
-
type: "object",
|
|
627
|
-
properties: {
|
|
628
|
-
path: {
|
|
629
|
-
title: "HTTP path of the API operation",
|
|
630
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.",
|
|
631
|
-
type: "string"
|
|
632
|
-
},
|
|
633
|
-
method: {
|
|
634
|
-
title: "HTTP method of the API operation",
|
|
635
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
636
|
-
type: "string",
|
|
637
|
-
"enum": [
|
|
638
|
-
"get",
|
|
639
|
-
"post",
|
|
640
|
-
"put",
|
|
641
|
-
"delete",
|
|
642
|
-
"patch"
|
|
643
|
-
]
|
|
644
|
-
}
|
|
645
|
-
},
|
|
646
|
-
required: [
|
|
647
|
-
"path",
|
|
648
|
-
"method"
|
|
649
|
-
]
|
|
650
|
-
},
|
|
651
|
-
scenarios: {
|
|
652
|
-
title: "Array of test scenarios",
|
|
653
|
-
description: "Array of test scenarios.",
|
|
654
|
-
type: "array",
|
|
655
|
-
items: {
|
|
656
|
-
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface extends `AutoBeOpenApi.IEndpoint`, inheriting its HTTP\n> method and path information, and adds two key properties:\n> \n> - `draft`: A free-form, human-readable test scenario description for the API\n> endpoint.\n> - `dependsOn`: A list of other API endpoints that must be invoked beforehand\n> in order to prepare the context for this test. Each dependency includes\n> the purpose of the dependency.\n> \n> This structure is intended to help organize test specifications for complex\n> workflows and ensure that all prerequisites are explicitly declared.",
|
|
657
|
-
type: "object",
|
|
658
|
-
properties: {
|
|
659
|
-
draft: {
|
|
660
|
-
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple test scenarios.",
|
|
661
|
-
type: "string"
|
|
662
|
-
},
|
|
663
|
-
functionName: {
|
|
664
|
-
title: "Descriptive function name derived from the user scenario",
|
|
665
|
-
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions",
|
|
666
|
-
type: "string"
|
|
667
|
-
},
|
|
668
|
-
dependsOn: {
|
|
669
|
-
description: "A list of other API endpoints that must be executed before this test\nscenario. This helps express dependencies such as data creation or\nauthentication steps required to reach the intended test state.",
|
|
670
|
-
type: "array",
|
|
671
|
-
items: {
|
|
672
|
-
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependsOn}",
|
|
673
|
-
type: "object",
|
|
674
|
-
properties: {
|
|
675
|
-
endpoint: {
|
|
676
|
-
description: "Target API endpoint that must be executed before the main operation.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
677
|
-
type: "object",
|
|
678
|
-
properties: {
|
|
679
|
-
path: {
|
|
680
|
-
title: "HTTP path of the API operation",
|
|
681
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.",
|
|
682
|
-
type: "string"
|
|
683
|
-
},
|
|
684
|
-
method: {
|
|
685
|
-
title: "HTTP method of the API operation",
|
|
686
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
687
|
-
type: "string",
|
|
688
|
-
"enum": [
|
|
689
|
-
"get",
|
|
690
|
-
"post",
|
|
691
|
-
"put",
|
|
692
|
-
"delete",
|
|
693
|
-
"patch"
|
|
694
|
-
]
|
|
695
|
-
}
|
|
696
|
-
},
|
|
697
|
-
required: [
|
|
698
|
-
"path",
|
|
699
|
-
"method"
|
|
700
|
-
]
|
|
701
|
-
},
|
|
702
|
-
purpose: {
|
|
703
|
-
description: "A concise exscenarioation of why this API call is required before\nexecuting the test for the main operation.\n\nExample: \"Creates a category so that a product can be linked to it during\ncreation.\"",
|
|
704
|
-
type: "string"
|
|
705
|
-
}
|
|
706
|
-
},
|
|
707
|
-
required: [
|
|
708
|
-
"endpoint",
|
|
709
|
-
"purpose"
|
|
710
|
-
]
|
|
711
|
-
}
|
|
712
|
-
}
|
|
713
|
-
},
|
|
714
|
-
required: [
|
|
715
|
-
"draft",
|
|
716
|
-
"functionName",
|
|
717
|
-
"dependsOn"
|
|
718
|
-
]
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
},
|
|
722
|
-
required: [
|
|
723
|
-
"endpoint",
|
|
724
|
-
"scenarios"
|
|
725
|
-
]
|
|
639
|
+
$ref: "#/$defs/IAutoBeTestScenarioApplication.IScenarioGroup"
|
|
726
640
|
}
|
|
727
641
|
}
|
|
728
642
|
},
|
|
@@ -730,267 +644,106 @@ const collection = {
|
|
|
730
644
|
"scenarioGroups"
|
|
731
645
|
],
|
|
732
646
|
additionalProperties: false,
|
|
733
|
-
$defs: {
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
749
|
-
path: _path + ".scenarioGroups",
|
|
750
|
-
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
751
|
-
value: input.scenarioGroups
|
|
752
|
-
})].every(flag => flag); const _vo1 = (input, _path, _exceptionable = true) => [("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
753
|
-
path: _path + ".endpoint",
|
|
754
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
755
|
-
value: input.endpoint
|
|
756
|
-
})) && _vo2(input.endpoint, _path + ".endpoint", true && _exceptionable) || _report(_exceptionable, {
|
|
757
|
-
path: _path + ".endpoint",
|
|
758
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
759
|
-
value: input.endpoint
|
|
760
|
-
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
761
|
-
path: _path + ".scenarios",
|
|
762
|
-
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
763
|
-
value: input.scenarios
|
|
764
|
-
})) && input.scenarios.map((elem, _index5) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
765
|
-
path: _path + ".scenarios[" + _index5 + "]",
|
|
766
|
-
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
767
|
-
value: elem
|
|
768
|
-
})) && _vo3(elem, _path + ".scenarios[" + _index5 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
769
|
-
path: _path + ".scenarios[" + _index5 + "]",
|
|
770
|
-
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
771
|
-
value: elem
|
|
772
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
773
|
-
path: _path + ".scenarios",
|
|
774
|
-
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
775
|
-
value: input.scenarios
|
|
776
|
-
})].every(flag => flag); const _vo2 = (input, _path, _exceptionable = true) => ["string" === typeof input.path || _report(_exceptionable, {
|
|
777
|
-
path: _path + ".path",
|
|
778
|
-
expected: "string",
|
|
779
|
-
value: input.path
|
|
780
|
-
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
781
|
-
path: _path + ".method",
|
|
782
|
-
expected: "(\"delete\" | \"get\" | \"patch\" | \"post\" | \"put\")",
|
|
783
|
-
value: input.method
|
|
784
|
-
})].every(flag => flag); const _vo3 = (input, _path, _exceptionable = true) => ["string" === typeof input.draft || _report(_exceptionable, {
|
|
785
|
-
path: _path + ".draft",
|
|
786
|
-
expected: "string",
|
|
787
|
-
value: input.draft
|
|
788
|
-
}), "string" === typeof input.functionName || _report(_exceptionable, {
|
|
789
|
-
path: _path + ".functionName",
|
|
790
|
-
expected: "string",
|
|
791
|
-
value: input.functionName
|
|
792
|
-
}), (Array.isArray(input.dependsOn) || _report(_exceptionable, {
|
|
793
|
-
path: _path + ".dependsOn",
|
|
794
|
-
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
795
|
-
value: input.dependsOn
|
|
796
|
-
})) && input.dependsOn.map((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
797
|
-
path: _path + ".dependsOn[" + _index6 + "]",
|
|
798
|
-
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
799
|
-
value: elem
|
|
800
|
-
})) && _vo4(elem, _path + ".dependsOn[" + _index6 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
801
|
-
path: _path + ".dependsOn[" + _index6 + "]",
|
|
802
|
-
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
803
|
-
value: elem
|
|
804
|
-
})).every(flag => flag) || _report(_exceptionable, {
|
|
805
|
-
path: _path + ".dependsOn",
|
|
806
|
-
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
807
|
-
value: input.dependsOn
|
|
808
|
-
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => [("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
809
|
-
path: _path + ".endpoint",
|
|
810
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
811
|
-
value: input.endpoint
|
|
812
|
-
})) && _vo2(input.endpoint, _path + ".endpoint", true && _exceptionable) || _report(_exceptionable, {
|
|
813
|
-
path: _path + ".endpoint",
|
|
814
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
815
|
-
value: input.endpoint
|
|
816
|
-
}), "string" === typeof input.purpose || _report(_exceptionable, {
|
|
817
|
-
path: _path + ".purpose",
|
|
818
|
-
expected: "string",
|
|
819
|
-
value: input.purpose
|
|
820
|
-
})].every(flag => flag); const __is = input => "object" === typeof input && null !== input && _io0(input); let errors; let _report; return input => {
|
|
821
|
-
if (false === __is(input)) {
|
|
822
|
-
errors = [];
|
|
823
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
824
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
825
|
-
path: _path + "",
|
|
826
|
-
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
827
|
-
value: input
|
|
828
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
829
|
-
path: _path + "",
|
|
830
|
-
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
831
|
-
value: input
|
|
832
|
-
}))(input, "$input", true);
|
|
833
|
-
const success = 0 === errors.length;
|
|
834
|
-
return success ? {
|
|
835
|
-
success,
|
|
836
|
-
data: input
|
|
837
|
-
} : {
|
|
838
|
-
success,
|
|
839
|
-
errors,
|
|
840
|
-
data: input
|
|
841
|
-
};
|
|
842
|
-
}
|
|
843
|
-
return {
|
|
844
|
-
success: true,
|
|
845
|
-
data: input
|
|
846
|
-
};
|
|
847
|
-
}; })()
|
|
848
|
-
}
|
|
849
|
-
]
|
|
850
|
-
},
|
|
851
|
-
claude,
|
|
852
|
-
llama: claude,
|
|
853
|
-
deepseek: claude,
|
|
854
|
-
"3.1": claude,
|
|
855
|
-
"3.0": {
|
|
856
|
-
model: "3.0",
|
|
857
|
-
options: {
|
|
858
|
-
constraint: true,
|
|
859
|
-
recursive: 3,
|
|
860
|
-
separate: null
|
|
861
|
-
},
|
|
862
|
-
functions: [
|
|
863
|
-
{
|
|
864
|
-
name: "makeScenario",
|
|
865
|
-
parameters: {
|
|
866
|
-
type: "object",
|
|
867
|
-
properties: {
|
|
868
|
-
scenarioGroups: {
|
|
869
|
-
type: "array",
|
|
870
|
-
items: {
|
|
871
|
-
type: "object",
|
|
872
|
-
properties: {
|
|
873
|
-
endpoint: {
|
|
874
|
-
type: "object",
|
|
875
|
-
properties: {
|
|
876
|
-
path: {
|
|
877
|
-
type: "string",
|
|
878
|
-
title: "HTTP path of the API operation",
|
|
879
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage."
|
|
880
|
-
},
|
|
881
|
-
method: {
|
|
882
|
-
type: "string",
|
|
883
|
-
"enum": [
|
|
884
|
-
"get",
|
|
885
|
-
"post",
|
|
886
|
-
"put",
|
|
887
|
-
"delete",
|
|
888
|
-
"patch"
|
|
889
|
-
],
|
|
890
|
-
title: "HTTP method of the API operation",
|
|
891
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record"
|
|
892
|
-
}
|
|
893
|
-
},
|
|
894
|
-
required: [
|
|
895
|
-
"path",
|
|
896
|
-
"method"
|
|
897
|
-
],
|
|
898
|
-
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
899
|
-
additionalProperties: false
|
|
900
|
-
},
|
|
901
|
-
scenarios: {
|
|
902
|
-
type: "array",
|
|
903
|
-
items: {
|
|
904
|
-
type: "object",
|
|
905
|
-
properties: {
|
|
906
|
-
draft: {
|
|
907
|
-
type: "string",
|
|
908
|
-
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple test scenarios."
|
|
909
|
-
},
|
|
910
|
-
functionName: {
|
|
911
|
-
type: "string",
|
|
912
|
-
title: "Descriptive function name derived from the user scenario",
|
|
913
|
-
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions"
|
|
914
|
-
},
|
|
915
|
-
dependsOn: {
|
|
916
|
-
type: "array",
|
|
917
|
-
items: {
|
|
918
|
-
type: "object",
|
|
919
|
-
properties: {
|
|
920
|
-
endpoint: {
|
|
921
|
-
type: "object",
|
|
922
|
-
properties: {
|
|
923
|
-
path: {
|
|
924
|
-
type: "string",
|
|
925
|
-
title: "HTTP path of the API operation",
|
|
926
|
-
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage."
|
|
927
|
-
},
|
|
928
|
-
method: {
|
|
929
|
-
type: "string",
|
|
930
|
-
"enum": [
|
|
931
|
-
"get",
|
|
932
|
-
"post",
|
|
933
|
-
"put",
|
|
934
|
-
"delete",
|
|
935
|
-
"patch"
|
|
936
|
-
],
|
|
937
|
-
title: "HTTP method of the API operation",
|
|
938
|
-
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record"
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
required: [
|
|
942
|
-
"path",
|
|
943
|
-
"method"
|
|
944
|
-
],
|
|
945
|
-
description: "Target API endpoint that must be executed before the main operation.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
946
|
-
additionalProperties: false
|
|
947
|
-
},
|
|
948
|
-
purpose: {
|
|
949
|
-
type: "string",
|
|
950
|
-
description: "A concise exscenarioation of why this API call is required before\nexecuting the test for the main operation.\n\nExample: \"Creates a category so that a product can be linked to it during\ncreation.\""
|
|
951
|
-
}
|
|
952
|
-
},
|
|
953
|
-
required: [
|
|
954
|
-
"endpoint",
|
|
955
|
-
"purpose"
|
|
956
|
-
],
|
|
957
|
-
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependsOn}",
|
|
958
|
-
additionalProperties: false
|
|
959
|
-
},
|
|
960
|
-
description: "A list of other API endpoints that must be executed before this test\nscenario. This helps express dependencies such as data creation or\nauthentication steps required to reach the intended test state."
|
|
961
|
-
}
|
|
962
|
-
},
|
|
963
|
-
required: [
|
|
964
|
-
"draft",
|
|
965
|
-
"functionName",
|
|
966
|
-
"dependsOn"
|
|
967
|
-
],
|
|
968
|
-
description: "Description of the current {@link IAutoBeTestScenarioApplication.IScenario} type:\n\n> Represents a test scenario for a single API operation.\n> \n> This interface extends `AutoBeOpenApi.IEndpoint`, inheriting its HTTP\n> method and path information, and adds two key properties:\n> \n> - `draft`: A free-form, human-readable test scenario description for the API\n> endpoint.\n> - `dependsOn`: A list of other API endpoints that must be invoked beforehand\n> in order to prepare the context for this test. Each dependency includes\n> the purpose of the dependency.\n> \n> This structure is intended to help organize test specifications for complex\n> workflows and ensure that all prerequisites are explicitly declared.",
|
|
969
|
-
additionalProperties: false
|
|
970
|
-
},
|
|
971
|
-
title: "Array of test scenarios",
|
|
972
|
-
description: "Array of test scenarios."
|
|
647
|
+
$defs: {
|
|
648
|
+
"IAutoBeTestScenarioApplication.IScenarioGroup": {
|
|
649
|
+
description: "### Description of {@link endpoint} property:\n\n> Target API endpoint to test.\n> \n> This must be **unique** across all scenario groups. An endpoint is\n> identified by its `path` and `method` combination.\n> \n> Multiple test scenarios may exist for a single endpoint.",
|
|
650
|
+
type: "object",
|
|
651
|
+
properties: {
|
|
652
|
+
endpoint: {
|
|
653
|
+
title: "Target API endpoint to test",
|
|
654
|
+
$ref: "#/$defs/AutoBeOpenApi.IEndpoint"
|
|
655
|
+
},
|
|
656
|
+
scenarios: {
|
|
657
|
+
title: "An array of test scenarios associated with the given endpoint",
|
|
658
|
+
description: "An array of test scenarios associated with the given endpoint.\n\nEach scenario represents a specific test case for the same `path` and\n`method`.",
|
|
659
|
+
type: "array",
|
|
660
|
+
items: {
|
|
661
|
+
$ref: "#/$defs/IAutoBeTestScenarioApplication.IScenario"
|
|
973
662
|
}
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
required: [
|
|
666
|
+
"endpoint",
|
|
667
|
+
"scenarios"
|
|
668
|
+
]
|
|
669
|
+
},
|
|
670
|
+
"AutoBeOpenApi.IEndpoint": {
|
|
671
|
+
description: "API endpoint information.",
|
|
672
|
+
type: "object",
|
|
673
|
+
properties: {
|
|
674
|
+
path: {
|
|
675
|
+
title: "HTTP path of the API operation",
|
|
676
|
+
description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.",
|
|
677
|
+
type: "string"
|
|
974
678
|
},
|
|
975
|
-
|
|
976
|
-
"
|
|
977
|
-
"
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
679
|
+
method: {
|
|
680
|
+
title: "HTTP method of the API operation",
|
|
681
|
+
description: "HTTP method of the API operation.\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record",
|
|
682
|
+
type: "string",
|
|
683
|
+
"enum": [
|
|
684
|
+
"get",
|
|
685
|
+
"post",
|
|
686
|
+
"put",
|
|
687
|
+
"delete",
|
|
688
|
+
"patch"
|
|
689
|
+
]
|
|
690
|
+
}
|
|
981
691
|
},
|
|
982
|
-
|
|
983
|
-
|
|
692
|
+
required: [
|
|
693
|
+
"path",
|
|
694
|
+
"method"
|
|
695
|
+
]
|
|
696
|
+
},
|
|
697
|
+
"IAutoBeTestScenarioApplication.IScenario": {
|
|
698
|
+
description: "Represents a test scenario for a single API operation.\n\nThis interface defines a structured, user-centric test draft that includes\na descriptive function name, a detailed scenario draft, and logical\ndependencies on other endpoints required for context or setup.",
|
|
699
|
+
type: "object",
|
|
700
|
+
properties: {
|
|
701
|
+
draft: {
|
|
702
|
+
description: "A detailed natural language description of how this API endpoint should\nbe tested. This should include both successful and failure scenarios,\nbusiness rule validations, edge cases, and any sequence of steps\nnecessary to perform the test. A subsequent agent will use this draft to\ngenerate multiple concrete test cases.",
|
|
703
|
+
type: "string"
|
|
704
|
+
},
|
|
705
|
+
functionName: {
|
|
706
|
+
title: "Descriptive function name derived from the user scenario",
|
|
707
|
+
description: "Descriptive function name derived from the user scenario.\n\nThe function name serves as a concise, technical identifier that clearly\nrepresents the specific user scenario being described. It should be\nimmediately understandable and directly correspond to the user situation\nwithout requiring additional context.\n\n## Naming Convention\n\n- Must start with `test_` prefix (mandatory requirement)\n- Use snake_case formatting throughout\n- Include the primary user action (create, get, update, delete, list, etc.)\n- Specify the target resource (user, product, order, profile, etc.)\n- Add scenario-specific context (valid_data, invalid_email, not_found,\n etc.)\n\n## Content Structure\n\nFunction names should follow this pattern:\n`test_[user_action]_[resource]_[scenario_context]`\n\nWhere:\n\n- `user_action`: What the user is trying to do\n- `resource`: What the user is interacting with\n- `scenario_context`: The specific situation or condition\n\n## User-Focused Examples\n\n- `test_create_user_profile_with_complete_information` - User providing all\n available profile data\n- `test_retrieve_user_profile_when_profile_exists` - User accessing their\n existing profile\n- `test_update_user_email_with_valid_new_address` - User changing their\n email to a valid new one\n- `test_delete_user_account_when_user_lacks_permission` - User attempting\n account deletion without authorization\n- `test_search_user_profiles_with_pagination_preferences` - User browsing\n profiles with specific pagination\n\n## Clarity Guidelines\n\n- Prioritize clarity over brevity\n- Avoid technical jargon or implementation terms\n- Use terminology that reflects user perspective\n- Ensure the name alone conveys the user's intent\n- Make it understandable to non-technical stakeholders\n- Keep consistent with user scenario description\n\n## Single Endpoint Alignment\n\nFunction names must reflect scenarios that:\n\n- Accomplish user goals through this single endpoint only\n- Don't imply dependency on other API operations\n- Represent complete user interactions",
|
|
708
|
+
type: "string"
|
|
709
|
+
},
|
|
710
|
+
dependencies: {
|
|
711
|
+
title: "A list of other API endpoints that this scenario logically depends on",
|
|
712
|
+
description: "A list of other API endpoints that this scenario logically depends on.\n\nThese dependencies represent context or prerequisite conditions, such as\nauthentication, resource creation, or data setup, that are relevant to\nthe test. This list is not a strict execution order \u2014 if ordering is\nimportant, it must be described explicitly in the `purpose`.",
|
|
713
|
+
type: "array",
|
|
714
|
+
items: {
|
|
715
|
+
$ref: "#/$defs/IAutoBeTestScenarioApplication.IDependencies"
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
},
|
|
719
|
+
required: [
|
|
720
|
+
"draft",
|
|
721
|
+
"functionName",
|
|
722
|
+
"dependencies"
|
|
723
|
+
]
|
|
724
|
+
},
|
|
725
|
+
"IAutoBeTestScenarioApplication.IDependencies": {
|
|
726
|
+
description: "### Description of {@link endpoint} property:\n\n> Target API endpoint that this scenario depends on.",
|
|
727
|
+
type: "object",
|
|
728
|
+
properties: {
|
|
729
|
+
endpoint: {
|
|
730
|
+
title: "Target API endpoint that this scenario depends on",
|
|
731
|
+
$ref: "#/$defs/AutoBeOpenApi.IEndpoint"
|
|
732
|
+
},
|
|
733
|
+
purpose: {
|
|
734
|
+
description: "A concise explanation of why this API call is relevant or required for\nthe main test scenario.\n\nThis should describe the contextual or setup role of the dependency, such\nas creating necessary data or establishing user authentication.\n\nExample: \"Creates a category so that a product can be linked to it during\ncreation.\"",
|
|
735
|
+
type: "string"
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
required: [
|
|
739
|
+
"endpoint",
|
|
740
|
+
"purpose"
|
|
741
|
+
]
|
|
984
742
|
}
|
|
985
|
-
}
|
|
986
|
-
required: [
|
|
987
|
-
"scenarioGroups"
|
|
988
|
-
],
|
|
989
|
-
description: " Properties containing the endpoints and test scenarios.\n\n------------------------------\n\nCurrent Type: {@link IAutoBeTestScenarioApplication.IProps}",
|
|
990
|
-
additionalProperties: false
|
|
743
|
+
}
|
|
991
744
|
},
|
|
992
745
|
description: "Make test scenarios for the given endpoints.",
|
|
993
|
-
validate: (() => { const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every(elem => "object" === typeof elem && null !== elem && _io3(elem))); const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.
|
|
746
|
+
validate: (() => { const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every(elem => "object" === typeof elem && null !== elem && _io1(elem)); const _io1 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && (Array.isArray(input.scenarios) && input.scenarios.every(elem => "object" === typeof elem && null !== elem && _io3(elem))); const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method); const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependencies) && input.dependencies.every(elem => "object" === typeof elem && null !== elem && _io4(elem))); const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose; const _vo0 = (input, _path, _exceptionable = true) => [(Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
994
747
|
path: _path + ".scenarioGroups",
|
|
995
748
|
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
996
749
|
value: input.scenarioGroups
|
|
@@ -1046,22 +799,22 @@ const collection = {
|
|
|
1046
799
|
path: _path + ".functionName",
|
|
1047
800
|
expected: "string",
|
|
1048
801
|
value: input.functionName
|
|
1049
|
-
}), (Array.isArray(input.
|
|
1050
|
-
path: _path + ".
|
|
1051
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
1052
|
-
value: input.
|
|
1053
|
-
})) && input.
|
|
1054
|
-
path: _path + ".
|
|
1055
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
802
|
+
}), (Array.isArray(input.dependencies) || _report(_exceptionable, {
|
|
803
|
+
path: _path + ".dependencies",
|
|
804
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
805
|
+
value: input.dependencies
|
|
806
|
+
})) && input.dependencies.map((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
807
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
808
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
1056
809
|
value: elem
|
|
1057
|
-
})) && _vo4(elem, _path + ".
|
|
1058
|
-
path: _path + ".
|
|
1059
|
-
expected: "IAutoBeTestScenarioApplication.
|
|
810
|
+
})) && _vo4(elem, _path + ".dependencies[" + _index6 + "]", true && _exceptionable) || _report(_exceptionable, {
|
|
811
|
+
path: _path + ".dependencies[" + _index6 + "]",
|
|
812
|
+
expected: "IAutoBeTestScenarioApplication.IDependencies",
|
|
1060
813
|
value: elem
|
|
1061
814
|
})).every(flag => flag) || _report(_exceptionable, {
|
|
1062
|
-
path: _path + ".
|
|
1063
|
-
expected: "Array<IAutoBeTestScenarioApplication.
|
|
1064
|
-
value: input.
|
|
815
|
+
path: _path + ".dependencies",
|
|
816
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependencies>",
|
|
817
|
+
value: input.dependencies
|
|
1065
818
|
})].every(flag => flag); const _vo4 = (input, _path, _exceptionable = true) => [("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
1066
819
|
path: _path + ".endpoint",
|
|
1067
820
|
expected: "AutoBeOpenApi.IEndpoint",
|
|
@@ -1105,5 +858,9 @@ const collection = {
|
|
|
1105
858
|
}
|
|
1106
859
|
]
|
|
1107
860
|
},
|
|
861
|
+
claude,
|
|
862
|
+
llama: claude,
|
|
863
|
+
deepseek: claude,
|
|
864
|
+
"3.1": claude,
|
|
1108
865
|
};
|
|
1109
866
|
//# sourceMappingURL=orchestrateTestScenario.js.map
|