@autobe/agent 0.8.0 → 0.9.1
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.d.ts +183 -12
- package/lib/AutoBeAgent.js +247 -65
- package/lib/AutoBeAgent.js.map +1 -1
- package/lib/constants/AutoBeSystemPromptConstant.d.ts +4 -3
- package/lib/constants/AutoBeSystemPromptConstant.js.map +1 -1
- package/lib/context/AutoBeContext.d.ts +2 -2
- package/lib/factory/index.d.ts +0 -1
- package/lib/factory/index.js +0 -1
- package/lib/factory/index.js.map +1 -1
- package/lib/index.mjs +1195 -834
- package/lib/index.mjs.map +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js +1 -1
- package/lib/orchestrate/analyze/AutoBeAnalyzeAgent.js.map +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js +1 -1
- package/lib/orchestrate/interface/orchestrateInterface.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js +1 -1
- package/lib/orchestrate/prisma/orchestratePrisma.js.map +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js +1 -1
- package/lib/orchestrate/prisma/orchestratePrismaCorrect.js.map +1 -1
- package/lib/orchestrate/test/compileTestScenario.d.ts +5 -0
- package/lib/orchestrate/test/compileTestScenario.js +56 -0
- package/lib/orchestrate/test/compileTestScenario.js.map +1 -0
- package/lib/orchestrate/test/filterTestFileName.d.ts +1 -0
- package/lib/orchestrate/test/filterTestFileName.js +13 -0
- package/lib/orchestrate/test/filterTestFileName.js.map +1 -0
- package/lib/orchestrate/test/orchestrateTest.js +10 -11
- package/lib/orchestrate/test/orchestrateTest.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestCorrect.d.ts +2 -2
- package/lib/orchestrate/test/orchestrateTestCorrect.js +91 -73
- package/lib/orchestrate/test/orchestrateTestCorrect.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestScenario.d.ts +2 -2
- package/lib/orchestrate/test/orchestrateTestScenario.js +616 -237
- package/lib/orchestrate/test/orchestrateTestScenario.js.map +1 -1
- package/lib/orchestrate/test/orchestrateTestWrite.d.ts +4 -0
- package/lib/orchestrate/test/{orchestrateTestProgress.js → orchestrateTestWrite.js} +37 -51
- package/lib/orchestrate/test/orchestrateTestWrite.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.d.ts +123 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioApplication.js.map +1 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.d.ts +5 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.js +3 -0
- package/lib/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.js.map +1 -0
- package/lib/orchestrate/test/transformTestCorrectHistories.d.ts +2 -1
- package/lib/orchestrate/test/transformTestCorrectHistories.js +4 -4
- package/lib/orchestrate/test/transformTestCorrectHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestScenarioHistories.d.ts +1 -2
- package/lib/orchestrate/test/transformTestScenarioHistories.js +1 -77
- package/lib/orchestrate/test/transformTestScenarioHistories.js.map +1 -1
- package/lib/orchestrate/test/transformTestWriteHistories.d.ts +7 -0
- package/lib/orchestrate/test/transformTestWriteHistories.js +47 -0
- package/lib/orchestrate/test/transformTestWriteHistories.js.map +1 -0
- package/lib/structures/IAutoBeConfig.d.ts +48 -10
- package/lib/structures/IAutoBeProps.d.ts +87 -0
- package/lib/structures/IAutoBeVendor.d.ts +64 -22
- package/lib/utils/backoffRetry.d.ts +7 -0
- package/lib/utils/backoffRetry.js +73 -0
- package/lib/utils/backoffRetry.js.map +1 -0
- package/lib/utils/types/BackoffOptions.d.ts +12 -0
- package/lib/utils/types/BackoffOptions.js +3 -0
- package/lib/utils/types/BackoffOptions.js.map +1 -0
- package/package.json +4 -4
- package/src/AutoBeAgent.ts +251 -51
- package/src/constants/AutoBeSystemPromptConstant.ts +4 -3
- package/src/context/AutoBeContext.ts +7 -2
- package/src/factory/index.ts +0 -1
- package/src/orchestrate/analyze/AutoBeAnalyzeAgent.ts +1 -1
- package/src/orchestrate/interface/orchestrateInterface.ts +1 -1
- package/src/orchestrate/prisma/orchestratePrisma.ts +1 -0
- package/src/orchestrate/prisma/orchestratePrismaCorrect.ts +4 -2
- package/src/orchestrate/test/compileTestScenario.ts +63 -0
- package/src/orchestrate/test/filterTestFileName.ts +9 -0
- package/src/orchestrate/test/orchestrateTest.ts +11 -17
- package/src/orchestrate/test/orchestrateTestCorrect.ts +152 -100
- package/src/orchestrate/test/orchestrateTestScenario.ts +195 -151
- package/src/orchestrate/test/{orchestrateTestProgress.ts → orchestrateTestWrite.ts} +29 -44
- package/src/orchestrate/test/structures/IAutoBeTestScenarioApplication.ts +132 -0
- package/src/orchestrate/test/structures/IAutoBeTestScenarioArtifacts.ts +5 -0
- package/src/orchestrate/test/transformTestCorrectHistories.ts +4 -4
- package/src/orchestrate/test/transformTestScenarioHistories.ts +0 -79
- package/src/orchestrate/test/transformTestWriteHistories.ts +53 -0
- package/src/structures/IAutoBeConfig.ts +48 -10
- package/src/structures/IAutoBeProps.ts +91 -0
- package/src/structures/IAutoBeVendor.ts +64 -22
- package/src/utils/backoffRetry.ts +84 -0
- package/src/utils/types/BackoffOptions.ts +15 -0
- package/lib/orchestrate/test/orchestrateTestProgress.d.ts +0 -4
- package/lib/orchestrate/test/orchestrateTestProgress.js.map +0 -1
- package/lib/orchestrate/test/transformTestProgressHistories.d.ts +0 -2
- package/lib/orchestrate/test/transformTestProgressHistories.js +0 -47
- package/lib/orchestrate/test/transformTestProgressHistories.js.map +0 -1
- package/src/orchestrate/test/transformTestProgressHistories.ts +0 -51
package/lib/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import "typia";
|
|
|
10
10
|
|
|
11
11
|
import * as __typia_transform__accessExpressionAsString from "typia/lib/internal/_accessExpressionAsString.js";
|
|
12
12
|
|
|
13
|
-
import { OpenApiTypeChecker
|
|
13
|
+
import { OpenApiTypeChecker } from "@samchon/openapi";
|
|
14
14
|
|
|
15
15
|
import { OpenApiV3_1Emender } from "@samchon/openapi/lib/converters/OpenApiV3_1Emender";
|
|
16
16
|
|
|
@@ -140,7 +140,7 @@ class AutoBeAnalyzeAgent {
|
|
|
140
140
|
const lastMessage = response[response.length - 1];
|
|
141
141
|
if ("text" in lastMessage) {
|
|
142
142
|
this.ctx.dispatch({
|
|
143
|
-
type: "
|
|
143
|
+
type: "analyzeWrite",
|
|
144
144
|
files: this.fileMap,
|
|
145
145
|
created_at: (new Date).toISOString(),
|
|
146
146
|
step: this.ctx.state().analyze?.step ?? 0
|
|
@@ -2054,7 +2054,7 @@ async function orchestrateInterfaceComponents(ctx, operations, capacity = 12) {
|
|
|
2054
2054
|
schemas: {}
|
|
2055
2055
|
};
|
|
2056
2056
|
for (const y of await Promise.all(matrix.map((async it => {
|
|
2057
|
-
const row = await divideAndConquer$
|
|
2057
|
+
const row = await divideAndConquer$1(ctx, operations, it, 3, (count => {
|
|
2058
2058
|
progress += count;
|
|
2059
2059
|
}));
|
|
2060
2060
|
ctx.dispatch({
|
|
@@ -2073,7 +2073,7 @@ async function orchestrateInterfaceComponents(ctx, operations, capacity = 12) {
|
|
|
2073
2073
|
return x;
|
|
2074
2074
|
}
|
|
2075
2075
|
|
|
2076
|
-
async function divideAndConquer$
|
|
2076
|
+
async function divideAndConquer$1(ctx, operations, typeNames, retry, progress) {
|
|
2077
2077
|
const remained = new Set(typeNames);
|
|
2078
2078
|
const components = {
|
|
2079
2079
|
schemas: {}
|
|
@@ -2081,7 +2081,7 @@ async function divideAndConquer$2(ctx, operations, typeNames, retry, progress) {
|
|
|
2081
2081
|
for (let i = 0; i < retry; ++i) {
|
|
2082
2082
|
if (remained.size === 0) break;
|
|
2083
2083
|
const before = remained.size;
|
|
2084
|
-
const newbie = await process$
|
|
2084
|
+
const newbie = await process$4(ctx, operations, components, remained);
|
|
2085
2085
|
for (const key of Object.keys(newbie.schemas)) {
|
|
2086
2086
|
components.schemas[key] = newbie.schemas[key];
|
|
2087
2087
|
remained.delete(key);
|
|
@@ -2091,7 +2091,7 @@ async function divideAndConquer$2(ctx, operations, typeNames, retry, progress) {
|
|
|
2091
2091
|
return components;
|
|
2092
2092
|
}
|
|
2093
2093
|
|
|
2094
|
-
async function process$
|
|
2094
|
+
async function process$4(ctx, operations, oldbie, remained) {
|
|
2095
2095
|
const pointer = {
|
|
2096
2096
|
value: null
|
|
2097
2097
|
};
|
|
@@ -2959,7 +2959,7 @@ async function orchestrateInterfaceOperations(ctx, endpoints, capacity = 12) {
|
|
|
2959
2959
|
});
|
|
2960
2960
|
let completed = 0;
|
|
2961
2961
|
const operations = await Promise.all(matrix.map((async it => {
|
|
2962
|
-
const row = await divideAndConquer
|
|
2962
|
+
const row = await divideAndConquer(ctx, it, 3, (count => {
|
|
2963
2963
|
completed += count;
|
|
2964
2964
|
}));
|
|
2965
2965
|
ctx.dispatch({
|
|
@@ -2975,13 +2975,13 @@ async function orchestrateInterfaceOperations(ctx, endpoints, capacity = 12) {
|
|
|
2975
2975
|
return operations.flat();
|
|
2976
2976
|
}
|
|
2977
2977
|
|
|
2978
|
-
async function divideAndConquer
|
|
2978
|
+
async function divideAndConquer(ctx, endpoints, retry, progress) {
|
|
2979
2979
|
const remained = new HashSet(endpoints, OpenApiEndpointComparator.hashCode, OpenApiEndpointComparator.equals);
|
|
2980
2980
|
const operations = new HashMap(OpenApiEndpointComparator.hashCode, OpenApiEndpointComparator.equals);
|
|
2981
2981
|
for (let i = 0; i < retry; ++i) {
|
|
2982
2982
|
if (remained.empty() === true || operations.size() >= endpoints.length) break;
|
|
2983
2983
|
const before = operations.size();
|
|
2984
|
-
const newbie = await process$
|
|
2984
|
+
const newbie = await process$3(ctx, Array.from(remained));
|
|
2985
2985
|
for (const item of newbie) {
|
|
2986
2986
|
operations.set(item, item);
|
|
2987
2987
|
remained.erase(item);
|
|
@@ -2991,7 +2991,7 @@ async function divideAndConquer$1(ctx, endpoints, retry, progress) {
|
|
|
2991
2991
|
return operations.toJSON().map((it => it.second));
|
|
2992
2992
|
}
|
|
2993
2993
|
|
|
2994
|
-
async function process$
|
|
2994
|
+
async function process$3(ctx, endpoints) {
|
|
2995
2995
|
const pointer = {
|
|
2996
2996
|
value: null
|
|
2997
2997
|
};
|
|
@@ -4854,7 +4854,7 @@ const orchestrateInterface = ctx => async props => {
|
|
|
4854
4854
|
type: "interface",
|
|
4855
4855
|
id: v4(),
|
|
4856
4856
|
document,
|
|
4857
|
-
files: await ctx.compiler.interface(document),
|
|
4857
|
+
files: await ctx.compiler.interface.compile(document),
|
|
4858
4858
|
reason: props.reason,
|
|
4859
4859
|
step: ctx.state().analyze?.step ?? 0,
|
|
4860
4860
|
created_at: start.toISOString(),
|
|
@@ -5368,7 +5368,7 @@ function orchestratePrismaCorrect(ctx, application, life = 4) {
|
|
|
5368
5368
|
async function step$1(ctx, application, life) {
|
|
5369
5369
|
const result = await ctx.compiler.prisma.validate(application);
|
|
5370
5370
|
if (result.success) return result; else if (life <= 0) return result;
|
|
5371
|
-
const schemas = await ctx.compiler.prisma.write(application);
|
|
5371
|
+
const schemas = await ctx.compiler.prisma.write(application, "postgres");
|
|
5372
5372
|
ctx.dispatch({
|
|
5373
5373
|
type: "prismaValidate",
|
|
5374
5374
|
result,
|
|
@@ -7084,7 +7084,7 @@ async function orchestratePrismaSchemas(ctx, components) {
|
|
|
7084
7084
|
const total = components.reduce(((acc, c) => acc + c.tables.length), 0);
|
|
7085
7085
|
let i = 0;
|
|
7086
7086
|
return await Promise.all(components.map((async c => {
|
|
7087
|
-
const result = await process$
|
|
7087
|
+
const result = await process$2(ctx, {
|
|
7088
7088
|
filename: c.filename,
|
|
7089
7089
|
tables: c.tables,
|
|
7090
7090
|
entireTables
|
|
@@ -7102,7 +7102,7 @@ async function orchestratePrismaSchemas(ctx, components) {
|
|
|
7102
7102
|
})));
|
|
7103
7103
|
}
|
|
7104
7104
|
|
|
7105
|
-
async function process$
|
|
7105
|
+
async function process$2(ctx, component) {
|
|
7106
7106
|
const pointer = {
|
|
7107
7107
|
value: null
|
|
7108
7108
|
};
|
|
@@ -8886,7 +8886,7 @@ const orchestratePrisma = ctx => async props => {
|
|
|
8886
8886
|
const result = await orchestratePrismaCorrect(ctx, {
|
|
8887
8887
|
files: events.map((e => e.file))
|
|
8888
8888
|
});
|
|
8889
|
-
const schemas = await ctx.compiler.prisma.write(result.data);
|
|
8889
|
+
const schemas = await ctx.compiler.prisma.write(result.data, "postgres");
|
|
8890
8890
|
const history = {
|
|
8891
8891
|
type: "prisma",
|
|
8892
8892
|
id: v4(),
|
|
@@ -8914,47 +8914,146 @@ const orchestratePrisma = ctx => async props => {
|
|
|
8914
8914
|
return history;
|
|
8915
8915
|
};
|
|
8916
8916
|
|
|
8917
|
-
|
|
8917
|
+
async function randomBackoffRetry(fn, options = {}) {
|
|
8918
|
+
const {maxRetries = 5, baseDelay = 4e3, maxDelay = 6e4, jitter = .8, handleError = isRetryError} = options;
|
|
8919
|
+
let lastError;
|
|
8920
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
8921
|
+
try {
|
|
8922
|
+
return await fn();
|
|
8923
|
+
} catch (err) {
|
|
8924
|
+
lastError = err;
|
|
8925
|
+
if (attempt === maxRetries - 1) throw err;
|
|
8926
|
+
if (!handleError(err)) throw err;
|
|
8927
|
+
const tempDelay = Math.min(baseDelay * 2 ** attempt, maxDelay);
|
|
8928
|
+
const delay = tempDelay * (1 + Math.random() * jitter);
|
|
8929
|
+
await new Promise((res => setTimeout(res, delay)));
|
|
8930
|
+
}
|
|
8931
|
+
}
|
|
8932
|
+
throw lastError;
|
|
8933
|
+
}
|
|
8934
|
+
|
|
8935
|
+
function isRetryError(error) {
|
|
8936
|
+
if (error?.code === "insufficient_quota" || error?.error?.type === "insufficient_quota") {
|
|
8937
|
+
return false;
|
|
8938
|
+
}
|
|
8939
|
+
if (typeof error?.status === "number" && error.status >= 500 || error?.error?.type === "server_error") {
|
|
8940
|
+
return true;
|
|
8941
|
+
}
|
|
8942
|
+
if (error?.status === 429) {
|
|
8943
|
+
return true;
|
|
8944
|
+
}
|
|
8945
|
+
const code = error?.code || error?.cause?.code;
|
|
8946
|
+
if ([ "UND_ERR_SOCKET", "UND_ERR_CONNECT_TIMEOUT", "ETIMEDOUT", "ECONNRESET", "EPIPE" ].includes(code)) {
|
|
8947
|
+
return true;
|
|
8948
|
+
}
|
|
8949
|
+
if (error?.message === "terminated" || error?.name === "AbortError") {
|
|
8950
|
+
return true;
|
|
8951
|
+
}
|
|
8952
|
+
return false;
|
|
8953
|
+
}
|
|
8954
|
+
|
|
8955
|
+
async function compileTestScenario(ctx, scenario) {
|
|
8956
|
+
const document = filterDocument(scenario, ctx.state().interface.document);
|
|
8957
|
+
const entries = Object.entries(await ctx.compiler.interface.compile(document));
|
|
8958
|
+
const filter = prefix => Object.fromEntries(entries.filter((([key]) => key.startsWith(prefix))));
|
|
8959
|
+
return {
|
|
8960
|
+
sdk: filter("src/api/functional"),
|
|
8961
|
+
dto: filter("src/api/structures"),
|
|
8962
|
+
e2e: filter("test/features")
|
|
8963
|
+
};
|
|
8964
|
+
}
|
|
8965
|
+
|
|
8966
|
+
function filterDocument(scenario, document) {
|
|
8967
|
+
const operations = document.operations.filter((op => scenario.endpoint.method === op.method && scenario.endpoint.path === op.path || scenario.dependencies.some((dp => dp.endpoint.method === op.method && dp.endpoint.path === op.path))));
|
|
8968
|
+
const components = {
|
|
8969
|
+
schemas: {}
|
|
8970
|
+
};
|
|
8971
|
+
const visit = typeName => {
|
|
8972
|
+
OpenApiTypeChecker.visit({
|
|
8973
|
+
components: document.components,
|
|
8974
|
+
schema: {
|
|
8975
|
+
$ref: `#/components/schemas/${typeName}`
|
|
8976
|
+
},
|
|
8977
|
+
closure: s => {
|
|
8978
|
+
if (OpenApiTypeChecker.isReference(s)) {
|
|
8979
|
+
const key = s.$ref.split("/").pop();
|
|
8980
|
+
components.schemas[key] = document.components.schemas[key];
|
|
8981
|
+
}
|
|
8982
|
+
}
|
|
8983
|
+
});
|
|
8984
|
+
};
|
|
8985
|
+
for (const op of operations) {
|
|
8986
|
+
if (op.requestBody) visit(op.requestBody.typeName);
|
|
8987
|
+
if (op.responseBody) visit(op.responseBody.typeName);
|
|
8988
|
+
}
|
|
8989
|
+
return {
|
|
8990
|
+
operations,
|
|
8991
|
+
components
|
|
8992
|
+
};
|
|
8993
|
+
}
|
|
8994
|
+
|
|
8995
|
+
function filterTestFileName(key) {
|
|
8996
|
+
if (key.endsWith(".ts") === false) return false; else if (key.startsWith("src/") === true) return true;
|
|
8997
|
+
return key.startsWith("test/") === true && key.startsWith("test/features/") === false && key.startsWith("test/benchmark/") === false;
|
|
8998
|
+
}
|
|
8999
|
+
|
|
9000
|
+
const transformTestCorrectHistories = artifacts => [ {
|
|
8918
9001
|
id: v4(),
|
|
8919
9002
|
created_at: (new Date).toISOString(),
|
|
8920
9003
|
type: "systemMessage",
|
|
8921
|
-
text: '# Compiler Error Fix System Prompt\n\nYou are an expert TypeScript compiler error fixing agent specializing in resolving compilation errors in E2E test code that follows the `@nestia/e2e` testing framework conventions.\n\n## Your Role\n\n- Analyze the provided TypeScript code with compilation errors and generate the corrected version. \n- Focus specifically on the error location, message, and problematic code segment. \n- Maintain all existing functionality while resolving only the compilation issues. \n- Follow the established code patterns and conventions from the original E2E test code. \n- Use provided API Files and DTO Files to resolve module and type declaration issues. \n- **CRITICAL**: Apply comprehensive fixes to prevent circular error loops by addressing all related import issues in a single pass.\n\n## Default Working Language: English\n\n- Use the language specified by user in messages as the working language when explicitly provided \n- All thinking and responses must be in the working language \n- All model/field names must be in English regardless of working language \n\n## Input Format\n\nYou will receive: \n\n1. **Original Code**: TypeScript E2E test code with compilation errors \n2. **Error Information**: \n - Exact character position of the error \n - Detailed error message from TypeScript compiler \n - The specific problematic code segment \n3. **Instructions**: Specific guidance on what needs to be fixed \n4. **API Files**: Reference files containing available API functions and their paths \n5. **DTO Files**: Reference files containing available types and their import paths \n\n## Code Fixing Guidelines\n\n### 1. Module Resolution Errors (CRITICAL PRIORITY)\n\n#### Universal Module Import Pattern Recognition and Fix:\n\n**ALWAYS scan the ENTIRE code for ALL import statements that match these patterns and fix them ALL at once:**\n\n```typescript\n// WRONG PATTERNS - Fix ALL of these in one pass:\nimport api from "@nestia/PROJECT-api";\nimport api from "@wrtnlabs/PROJECT-api"; \nimport api from "@anyorganization/PROJECT-api";\nimport { Type } from "@nestia/PROJECT-api/lib/structures/Type";\nimport { Type } from "@wrtnlabs/PROJECT-api/lib/structures/Type";\nimport { Type } from "@anyorganization/PROJECT-api/lib/structures/Type";\n\n// CORRECT PATTERN - Replace with:\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { Type } from "@ORGANIZATION/PROJECT-api/lib/structures/Type";\n```\n\n#### Comprehensive Module Fix Strategy:\n\n1. **Pattern Detection**: Look for ANY import that contains: \n - `@[anything]/[project-name]-api` → Replace `@[anything]` with `@ORGANIZATION` \n - `@[project-name]-api` (missing org prefix) → Add `@ORGANIZATION/` prefix \n\n2. **Common Error Patterns to Fix ALL AT ONCE**: \n\n```typescript\n// Error Pattern 1: Wrong organization name\nCannot find module \'@wrtnlabs/template-api\'\nCannot find module \'@nestia/template-api\'\nCannot find module \'@anyorg/template-api\'\n// Fix: Replace with @ORGANIZATION/template-api\n\n// Error Pattern 2: Missing organization prefix \nCannot find module \'@template-api\'\nCannot find module \'template-api\'\n// Fix: Add @ORGANIZATION/ prefix\n\n// Error Pattern 3: Structure imports with wrong org\nCannot find module \'@wrtnlabs/template-api/lib/structures/IType\'\nCannot find module \'@nestia/template-api/lib/structures/IType\'\n// Fix: Replace with @ORGANIZATION/template-api/lib/structures/IType\n``` \n\n3. **Comprehensive Import Scan and Fix**: \n - **BEFORE fixing the reported error**, scan ALL import statements in the code \n - Identify ALL imports that follow incorrect patterns \n - Fix ALL of them simultaneously to prevent error loops \n - Ensure consistent `@ORGANIZATION/PROJECT-api` pattern throughout \n\n#### Module Resolution Fix Examples:\n\n```typescript\n// BEFORE (Multiple wrong patterns in same file):\nimport api from "@nestia/template-api";\nimport { IBbsArticle } from "@wrtnlabs/template-api/lib/structures/IBbsArticle";\nimport { IAttachmentFile } from "@template-api/lib/structures/IAttachmentFile";\n\n// AFTER (All fixed consistently):\nimport api from "@ORGANIZATION/template-api";\nimport { IBbsArticle } from "@ORGANIZATION/template-api/lib/structures/IBbsArticle";\nimport { IAttachmentFile } from "@ORGANIZATION/template-api/lib/structures/IAttachmentFile";\n``` \n\n### 2. Error Loop Prevention Strategy\n\n**CRITICAL**: To prevent 1 → 2 → 3 → 1 error loops: \n\n1. **Holistic Code Analysis**: Before fixing the specific error, analyze ALL import statements in the entire code \n2. **Batch Import Fixes**: Fix ALL import-related issues in a single pass, not just the reported error \n3. **Pattern Consistency**: Ensure ALL imports follow the same `@ORGANIZATION/PROJECT-api` pattern \n4. **Preemptive Fixes**: Look for and fix potential related errors that might surface after the current fix \n\n**Implementation Approach**: \n\n```typescript\n// Step 1: Scan entire code for ALL these patterns\nconst problemPatterns = [\n /@[^/]+\\/[^-]+-api(?!\\/)/g, // Wrong org prefix\n /@[^-]+-api(?!\\/)/g, // Missing org prefix \n /from\\s+["\']@[^/]+\\/[^-]+-api/g, // Wrong org in imports\n /from\\s+["\']@[^-]+-api/g // Missing org in imports\n];\n\n// Step 2: Replace ALL matches with @ORGANIZATION/PROJECT-api pattern\n// Step 3: Then fix the specific reported error\n``` \n\n### 3. API Function Usage Corrections\n\n- Ensure proper `import api from "@ORGANIZATION/PROJECT-api";` format (verify against API Files) \n- Fix API function call patterns to follow: \n\n ```ts\n api.functional.[...].methodName(...)\n ``` \n\n- Correct connection parameter usage (avoid adding extra properties): \n\n ```ts\n // Correct\n await api.functional.bbs.articles.post(connection, { body: articleBody });\n ``` \n\n- **Cross-reference API Files** to ensure function paths and method names are accurate \n\n### 4. DTO Type Import Corrections\n\n- Fix import statements to use proper format based on **DTO Files**: \n\n ```ts\n import { ITypeName } from "@ORGANIZATION/PROJECT-api/lib/structures/[...].ts";\n ``` \n\n- Ensure `@ORGANIZATION` prefix is maintained in import paths \n- **Verify type names and paths** against provided DTO Files \n- Correct missing or incorrect type imports \n- Fix type annotation errors \n\n### 5. Test Function Structure Fixes\n\n- Ensure test functions follow the pattern: \n\n ```ts\n export async function test_api_xxx(...): Promise<void> { ... }\n ``` \n\n- Fix async/await usage errors \n- Correct function parameter types (especially `connection: api.IConnection`) \n\n### 6. Test Validator Usage Corrections\n\n- Fix `TestValidator` method calls: \n\n ```ts\n TestValidator.equals("title", exceptionFunction)(expected)(actual);\n TestValidator.predicate("title")(condition);\n TestValidator.error("title")(task);\n ``` \n\n- Correct currying function usage \n- Fix assertion patterns \n\n### 7. Typia Assert Corrections\n\n- Ensure proper `typia.assert<T>(value)` usage \n- Fix generic type parameters \n- Correct assertion patterns for response validation \n\n### 8. Array Type Corrections\n\n```\nerror: Argument of type \'IBbsArticleComment[]\' is not assignable to parameter of type \'never[]\'.\n``` \n\n- To Resolve above Array parameter Error, If you declare empty array like `[]`, You must define the type of array together. \n\nExample: \n\n ```typescript\n TestValidator.equals("message")(\n [] as IBbsArticleComment[],\n )(data);\n ``` \n\n### 9. Common TypeScript Error Fixes\n\n- **Import/Export errors**: Fix module resolution issues using API Files and DTO Files as reference \n- **Type mismatches**: Align variable types with expected interfaces from DTO Files \n- **Missing properties**: Add required properties to objects \n- **Async/Promise errors**: Fix Promise handling and async function signatures \n- **Generic type errors**: Correct generic type parameters \n- **Null/undefined handling**: Add proper null checks or optional chaining \n- **Interface compliance**: Ensure objects conform to their declared interfaces \n\n## Error Resolution Strategy\n\n1. **Full Code Analysis**: FIRST perform comprehensive analysis of ENTIRE codebase for ALL potential TypeScript issues \n2. **Error Chain Identification**: Identify cascading error patterns and relationships between different parts of code \n3. **Holistic Fix Planning**: Plan fixes for ALL related errors that could cause loops, not just the reported error \n4. **Reference File Consultation**: \n - For module errors: Consult API Files for correct import paths \n - For type errors: Consult DTO Files for correct type import paths \n - For function calls: Verify method signatures and parameters \n5. **Batch Error Resolution**: Fix ALL identified issues simultaneously in logical groups: \n - All import/module issues together \n - All type declaration issues together \n - All function signature issues together \n - All usage/call site issues together \n6. **Context Preservation**: Maintain the original test logic and flow \n7. **Comprehensive Validation**: Ensure no new compilation errors or cascading issues are introduced \n8. **Pattern Consistency**: Keep existing code style and conventions throughout all fixes \n\n## Output Requirements\n\n- Return **only** the corrected TypeScript code \n- Maintain all original functionality and test logic \n- Preserve code formatting and style \n- Ensure the fix addresses ALL related compilation errors (not just the reported one) \n- **CRITICAL**: Fix ALL import pattern issues in a single pass to prevent error loops \n- Do not add explanations, comments, or additional features \n\n## Priority Error Handling\n\n1. **Comprehensive Analysis** (HIGHEST priority): \n - Scan ENTIRE codebase for ALL potential TypeScript compilation issues \n - Identify cascading error patterns and relationships \n - Map error chains that commonly cause loops (import → type → usage → validation) \n\n2. **Batch Error Resolution** (CRITICAL): \n - Group related errors into logical fix batches: \n - **Module/Import Batch**: All import paths, module resolution, missing dependencies \n - **Type Batch**: All type declarations, interfaces, generic constraints \n - **Function Batch**: All function signatures, parameters, return types \n - **Usage Batch**: All variable assignments, method calls, property access \n - **Test Batch**: All TestValidator calls, assertion patterns, validation logic \n - Fix entire batches simultaneously to prevent cascading failures \n\n3. **Specific Error Resolution**: \n - After comprehensive fixes, verify the originally reported error is resolved \n - Use DTO Files for type corrections and API Files for function signatures \n - Ensure consistency with established patterns \n\n4. **General TypeScript Compilation**: \n - Apply standard TypeScript error resolution techniques \n - Maintain type safety throughout all fixes \n\n## Error Loop Prevention Protocol\n\n**MANDATORY STEPS to prevent error loops:** \n\n1. **Pre-Analysis**: Before fixing reported error, scan entire code for ALL import statements \n2. **Pattern Matching**: Identify ALL imports matching problematic patterns: \n - `@[anything-except-ORGANIZATION]/[project]-api` \n - Missing `@ORGANIZATION/` prefix \n - Inconsistent organization naming \n3. **Comprehensive Fix**: Replace ALL problematic imports with correct `@ORGANIZATION/PROJECT-api` pattern \n4. **Validation**: Ensure ALL imports in the file follow consistent pattern \n5. **Specific Fix**: Then address the specific reported compilation error \n\n**Example of Comprehensive Fix Approach:** \n\n```typescript\n// Input code with multiple potential issues:\nimport api from "@nestia/template-api"; // Issue 1\nimport { IBbsArticle } from "@wrtnlabs/template-api/lib/structures/IBbsArticle"; // Issue 2 \nimport { IUser } from "@template-api/lib/structures/IUser"; // Issue 3\n\n// Output: ALL issues fixed simultaneously:\nimport api from "@ORGANIZATION/template-api";\nimport { IBbsArticle } from "@ORGANIZATION/template-api/lib/structures/IBbsArticle";\nimport { IUser } from "@ORGANIZATION/template-api/lib/structures/IUser";\n```'
|
|
9004
|
+
text: '# Compiler Error Fix System Prompt\n\nYou are an expert TypeScript compiler error fixing agent specializing in resolving compilation errors in E2E test code that follows the `@nestia/e2e` testing framework conventions.\n\n## Your Role\n\n- Analyze the provided TypeScript code with compilation errors and generate the corrected version. \n- Focus specifically on the error location, message, and problematic code segment. \n- Maintain all existing functionality while resolving only the compilation issues. \n- Follow the established code patterns and conventions from the original E2E test code. \n- Use provided API Files and DTO Files to resolve module and type declaration issues. \n- **CRITICAL**: Apply comprehensive fixes to prevent circular error loops by addressing all related import issues in a single pass.\n\n## Default Working Language: English\n\n- Use the language specified by user in messages as the working language when explicitly provided \n- All thinking and responses must be in the working language \n- All model/field names must be in English regardless of working language \n\n## Input Format\n\nYou will receive: \n\n1. **Original Code**: TypeScript E2E test code with compilation errors \n2. **Error Information**: \n - Exact character position of the error \n - Detailed error message from TypeScript compiler \n - The specific problematic code segment \n3. **Instructions**: Specific guidance on what needs to be fixed \n4. **API Files**: Reference files containing available API functions and their paths \n5. **DTO Files**: Reference files containing available types and their import paths \n\n## Code Fixing Guidelines\n\n### 1. Module Resolution Errors (CRITICAL PRIORITY)\n\n#### Universal Module Import Pattern Recognition and Fix:\n\n**ALWAYS scan the ENTIRE code for ALL import statements that match these patterns and fix them ALL at once:**\n\n```typescript\n// WRONG PATTERNS - Fix ALL of these in one pass:\nimport api from "@nestia/PROJECT-api";\nimport api from "@wrtnlabs/PROJECT-api"; \nimport api from "@anyorganization/PROJECT-api";\nimport { Type } from "@nestia/PROJECT-api/lib/structures/Type";\nimport { Type } from "@wrtnlabs/PROJECT-api/lib/structures/Type";\nimport { Type } from "@anyorganization/PROJECT-api/lib/structures/Type";\n\n// CORRECT PATTERN - Replace with:\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { Type } from "@ORGANIZATION/PROJECT-api/lib/structures/Type";\n```\n\n#### Importing namespace rule\n\n```ts\n// ❌ Incorrect usage: importing inner types directly from a namespaced type\nimport {\n IShoppingSaleInquiryComment,\n IShoppingSaleInquiryComment_ICreate,\n IShoppingSaleInquiryComment_IRequest,\n} from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSaleInquiryComment";\n\n```\n\n```ts\n// ✅ Correct usage: import only the namespace and access inner types via dot notation\nimport {\n IShoppingSaleInquiryComment,\n} from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSaleInquiryComment";\n\ntype A = IShoppingSaleInquiryComment.ICreate // correct!\ntype B = IShoppingSaleInquiryComment.IRequest // correct!\n```\n\n- 💡 Rule: When working with types defined inside a namespace, import only the namespace and access inner types using dot notation (e.g., Namespace.InnerType).\nAvoid importing inner types directly, as it breaks encapsulation and may cause naming conflicts or improper typings.\n\n\n#### Comprehensive Module Fix Strategy:\n\n1. **Pattern Detection**: Look for ANY import that contains: \n - `@[anything]/[project-name]-api` → Replace `@[anything]` with `@ORGANIZATION` \n - `@[project-name]-api` (missing org prefix) → Add `@ORGANIZATION/` prefix \n\n2. **Common Error Patterns to Fix ALL AT ONCE**: \n\n```typescript\n// Error Pattern 1: Wrong organization name\nCannot find module \'@wrtnlabs/PROJECT-api\'\nCannot find module \'@nestia/PROJECT-api\'\nCannot find module \'@anyorg/PROJECT-api\'\n// Fix: Replace with @ORGANIZATION/PROJECT-api\n\n// Error Pattern 2: Missing organization prefix \nCannot find module \'@PROJECT-api\'\nCannot find module \'PROJECT-api\'\n// Fix: Add @ORGANIZATION/ prefix\n\n// Error Pattern 3: Structure imports with wrong org\nCannot find module \'@wrtnlabs/PROJECT-api/lib/structures/IType\'\nCannot find module \'@nestia/PROJECT-api/lib/structures/IType\'\n// Fix: Replace with @ORGANIZATION/PROJECT-api/lib/structures/IType\n``` \n\n3. **Comprehensive Import Scan and Fix**: \n - **BEFORE fixing the reported error**, scan ALL import statements in the code \n - Identify ALL imports that follow incorrect patterns \n - Fix ALL of them simultaneously to prevent error loops \n - Ensure consistent `@ORGANIZATION/PROJECT-api` pattern throughout \n\n#### Module Resolution Fix Examples:\n\n```typescript\n// BEFORE (Multiple wrong patterns in same file):\nimport api from "@nestia/PROJECT-api";\nimport { IBbsArticle } from "@wrtnlabs/PROJECT-api/lib/structures/IBbsArticle";\nimport { IAttachmentFile } from "@PROJECT-api/lib/structures/IAttachmentFile";\n\n// AFTER (All fixed consistently):\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IBbsArticle } from "@ORGANIZATION/PROJECT-api/lib/structures/IBbsArticle";\nimport { IAttachmentFile } from "@ORGANIZATION/PROJECT-api/lib/structures/IAttachmentFile";\n``` \n\n### 2. Error Loop Prevention Strategy\n\n**CRITICAL**: To prevent 1 → 2 → 3 → 1 error loops: \n\n1. **Holistic Code Analysis**: Before fixing the specific error, analyze ALL import statements in the entire code \n2. **Batch Import Fixes**: Fix ALL import-related issues in a single pass, not just the reported error \n3. **Pattern Consistency**: Ensure ALL imports follow the same `@ORGANIZATION/PROJECT-api` pattern \n4. **Preemptive Fixes**: Look for and fix potential related errors that might surface after the current fix \n\n**Implementation Approach**: \n\n```typescript\n// Step 1: Scan entire code for ALL these patterns\nconst problemPatterns = [\n /@[^/]+\\/[^-]+-api(?!\\/)/g, // Wrong org prefix\n /@[^-]+-api(?!\\/)/g, // Missing org prefix \n /from\\s+["\']@[^/]+\\/[^-]+-api/g, // Wrong org in imports\n /from\\s+["\']@[^-]+-api/g // Missing org in imports\n];\n\n// Step 2: Replace ALL matches with @ORGANIZATION/PROJECT-api pattern\n// Step 3: Then fix the specific reported error\n``` \n\n### 3. API Function Usage Corrections\n\n- Ensure proper `import api from "@ORGANIZATION/PROJECT-api";` format (verify against API Files) \n- Fix API function call patterns to follow: \n\n ```ts\n api.functional.[...].methodName(...)\n ``` \n\n- Correct connection parameter usage (avoid adding extra properties): \n\n ```ts\n // Correct\n await api.functional.bbs.articles.post(connection, { body: articleBody });\n ``` \n\n- **Cross-reference API Files** to ensure function paths and method names are accurate \n\n### 4. DTO Type Import Corrections\n\n- Fix import statements to use proper format based on **DTO Files**: \n\n ```ts\n import { ITypeName } from "@ORGANIZATION/PROJECT-api/lib/structures/[...].ts";\n ``` \n\n- Ensure `@ORGANIZATION` prefix is maintained in import paths \n- **Verify type names and paths** against provided DTO Files \n- Correct missing or incorrect type imports \n- Fix type annotation errors \n\n### 5. Test Function Structure Fixes\n\n- Ensure test functions follow the pattern: \n\n ```ts\n export async function test_api_xxx(...): Promise<void> { ... }\n ``` \n\n- Fix async/await usage errors \n- Correct function parameter types (especially `connection: api.IConnection`) \n\n### 6. Test Validator Usage Corrections\n\n- Fix `TestValidator` method calls: \n\n ```ts\n TestValidator.equals("title", exceptionFunction)(expected)(actual);\n TestValidator.predicate("title")(condition);\n TestValidator.error("title")(task);\n ``` \n\n- Correct currying function usage \n- Fix assertion patterns \n\n### 7. Typia Assert Corrections\n\n- Ensure proper `typia.assert<T>(value)` usage \n- Fix generic type parameters \n- Correct assertion patterns for response validation \n\n### 8. Array Type Corrections\n\n```\nerror: Argument of type \'IBbsArticleComment[]\' is not assignable to parameter of type \'never[]\'.\n``` \n\n- To Resolve above Array parameter Error, If you declare empty array like `[]`, You must define the type of array together. \n\nExample: \n\n ```typescript\n TestValidator.equals("message")(\n [] as IBbsArticleComment[],\n )(data);\n ``` \n\n### 9. Common TypeScript Error Fixes\n\n- **Import/Export errors**: Fix module resolution issues using API Files and DTO Files as reference \n- **Type mismatches**: Align variable types with expected interfaces from DTO Files \n- **Missing properties**: Add required properties to objects \n- **Async/Promise errors**: Fix Promise handling and async function signatures \n- **Generic type errors**: Correct generic type parameters \n- **Null/undefined handling**: Add proper null checks or optional chaining \n- **Interface compliance**: Ensure objects conform to their declared interfaces \n\n## Error Resolution Strategy\n\n1. **Full Code Analysis**: FIRST perform comprehensive analysis of ENTIRE codebase for ALL potential TypeScript issues \n2. **Error Chain Identification**: Identify cascading error patterns and relationships between different parts of code \n3. **Holistic Fix Planning**: Plan fixes for ALL related errors that could cause loops, not just the reported error \n4. **Reference File Consultation**: \n - For module errors: Consult API Files for correct import paths \n - For type errors: Consult DTO Files for correct type import paths \n - For function calls: Verify method signatures and parameters \n5. **Batch Error Resolution**: Fix ALL identified issues simultaneously in logical groups: \n - All import/module issues together \n - All type declaration issues together \n - All function signature issues together \n - All usage/call site issues together \n6. **Context Preservation**: Maintain the original test logic and flow \n7. **Comprehensive Validation**: Ensure no new compilation errors or cascading issues are introduced \n8. **Pattern Consistency**: Keep existing code style and conventions throughout all fixes \n\n## Output Requirements\n\n- Return **only** the corrected TypeScript code \n- Maintain all original functionality and test logic \n- Preserve code formatting and style \n- Ensure the fix addresses ALL related compilation errors (not just the reported one) \n- **CRITICAL**: Fix ALL import pattern issues in a single pass to prevent error loops \n- Do not add explanations, comments, or additional features \n\n## Priority Error Handling\n\n1. **Comprehensive Analysis** (HIGHEST priority): \n - Scan ENTIRE codebase for ALL potential TypeScript compilation issues \n - Identify cascading error patterns and relationships \n - Map error chains that commonly cause loops (import → type → usage → validation) \n\n2. **Batch Error Resolution** (CRITICAL): \n - Group related errors into logical fix batches: \n - **Module/Import Batch**: All import paths, module resolution, missing dependencies \n - **Type Batch**: All type declarations, interfaces, generic constraints \n - **Function Batch**: All function signatures, parameters, return types \n - **Usage Batch**: All variable assignments, method calls, property access \n - **Test Batch**: All TestValidator calls, assertion patterns, validation logic \n - Fix entire batches simultaneously to prevent cascading failures \n\n3. **Specific Error Resolution**: \n - After comprehensive fixes, verify the originally reported error is resolved \n - Use DTO Files for type corrections and API Files for function signatures \n - Ensure consistency with established patterns \n\n4. **General TypeScript Compilation**: \n - Apply standard TypeScript error resolution techniques \n - Maintain type safety throughout all fixes \n\n## Error Loop Prevention Protocol\n\n**MANDATORY STEPS to prevent error loops:** \n\n1. **Pre-Analysis**: Before fixing reported error, scan entire code for ALL import statements \n2. **Pattern Matching**: Identify ALL imports matching problematic patterns: \n - `@[anything-except-ORGANIZATION]/[project]-api` \n - Missing `@ORGANIZATION/` prefix \n - Inconsistent organization naming \n3. **Comprehensive Fix**: Replace ALL problematic imports with correct `@ORGANIZATION/PROJECT-api` pattern \n4. **Validation**: Ensure ALL imports in the file follow consistent pattern \n5. **Specific Fix**: Then address the specific reported compilation error \n\n**Example of Comprehensive Fix Approach:** \n\n```typescript\n// Input code with multiple potential issues:\nimport api from "@nestia/PROJECT-api"; // Issue 1\nimport { IBbsArticle } from "@wrtnlabs/PROJECT-api/lib/structures/IBbsArticle"; // Issue 2 \nimport { IUser } from "@PROJECT-api/lib/structures/IUser"; // Issue 3\n\n// Output: ALL issues fixed simultaneously:\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IBbsArticle } from "@ORGANIZATION/PROJECT-api/lib/structures/IBbsArticle";\nimport { IUser } from "@ORGANIZATION/PROJECT-api/lib/structures/IUser";\n```'
|
|
8922
9005
|
}, {
|
|
8923
9006
|
id: v4(),
|
|
8924
9007
|
created_at: (new Date).toISOString(),
|
|
8925
9008
|
type: "assistantMessage",
|
|
8926
|
-
text: [ "You are the world's best TypeScript compiler error fixer.", "You will be given a **TypeScript code** with compilation errors, and your job is to fix the errors.", "", "## Rules", "- Follow the base E2E test style strictly. Never use other frameworks like Jest or Mocha.", "- Use `TestValidator.equals(...)` and `typia.assert(...)` to verify results.", "- Use `api.functional.XXX` for all API calls. These are defined in API Files.", "- Use helper functions like `generate_random_xxx(...)` **only if** they already exist in the base test imports.", "- Do not invent new helpers or use utilities that are not explicitly shown.", "- Keep all tests deterministic and reliable.", "", "## File References", "### API Files", "```typescript", JSON.stringify(
|
|
9009
|
+
text: [ "You are the world's best TypeScript compiler error fixer.", "You will be given a **TypeScript code** with compilation errors, and your job is to fix the errors.", "", "## Rules", "- Follow the base E2E test style strictly. Never use other frameworks like Jest or Mocha.", "- Use `TestValidator.equals(...)` and `typia.assert(...)` to verify results.", "- Use `api.functional.XXX` for all API calls. These are defined in API Files.", "- Use helper functions like `generate_random_xxx(...)` **only if** they already exist in the base test imports.", "- Do not invent new helpers or use utilities that are not explicitly shown.", "- Keep all tests deterministic and reliable.", "", "## File References", "### API Files", "```typescript", JSON.stringify(artifacts.sdk), "```", "", "### DTO Files", "```typescript", JSON.stringify(artifacts.dto), "```", "", "Now Fix the E2E test function based on the given error information.", "Only output a single `async function` named `test_api_{...}`. No explanation, no commentary." ].join("\n")
|
|
8927
9010
|
} ];
|
|
8928
9011
|
|
|
8929
|
-
async function orchestrateTestCorrect(ctx, codes, life = 4) {
|
|
8930
|
-
const
|
|
8931
|
-
|
|
9012
|
+
async function orchestrateTestCorrect(ctx, codes, scenarios, life = 4) {
|
|
9013
|
+
const files = codes.map((({filename, content}, index) => {
|
|
9014
|
+
const scenario = scenarios[index];
|
|
9015
|
+
return {
|
|
9016
|
+
location: filename,
|
|
9017
|
+
content,
|
|
9018
|
+
scenario
|
|
9019
|
+
};
|
|
9020
|
+
}));
|
|
9021
|
+
const testFiles = Object.fromEntries(codes.map((c => [ c.filename, c.content ])));
|
|
9022
|
+
const retainedFiles = Object.fromEntries(Object.entries(ctx.state().interface?.files ?? {}).filter((([key]) => filterTestFileName(key))));
|
|
9023
|
+
const external = async location => {
|
|
9024
|
+
const content = await ctx.compiler.typescript.getExternal(location);
|
|
9025
|
+
if (content === undefined) throw new Error(`File not found: ${location}`);
|
|
9026
|
+
return {
|
|
9027
|
+
[location]: content
|
|
9028
|
+
};
|
|
9029
|
+
};
|
|
8932
9030
|
const mergedFiles = {
|
|
8933
9031
|
...retainedFiles,
|
|
8934
|
-
...testFiles
|
|
9032
|
+
...testFiles,
|
|
9033
|
+
...await external("node_modules/@nestia/e2e/lib/TestValidator.d.ts"),
|
|
9034
|
+
...await external("node_modules/@nestia/fetcher/lib/IConnection.d.ts")
|
|
8935
9035
|
};
|
|
8936
|
-
const
|
|
8937
|
-
const response = await step(ctx, files, life);
|
|
9036
|
+
const response = await step(ctx, mergedFiles, files, life);
|
|
8938
9037
|
const event = {
|
|
8939
9038
|
...response,
|
|
8940
9039
|
type: "testValidate",
|
|
8941
|
-
files: {
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
}
|
|
9040
|
+
files: [ ...Object.entries(mergedFiles).map((([filename, content]) => ({
|
|
9041
|
+
location: filename,
|
|
9042
|
+
content
|
|
9043
|
+
}))), ...response.files ]
|
|
8945
9044
|
};
|
|
8946
9045
|
return event;
|
|
8947
9046
|
}
|
|
8948
9047
|
|
|
8949
|
-
async function step(ctx,
|
|
8950
|
-
const result = await ctx.compiler.typescript({
|
|
8951
|
-
files
|
|
9048
|
+
async function step(ctx, entireFiles, testFiles, life) {
|
|
9049
|
+
const result = await ctx.compiler.typescript.compile({
|
|
9050
|
+
files: entireFiles
|
|
8952
9051
|
});
|
|
8953
9052
|
if (result.type === "success") {
|
|
8954
9053
|
return {
|
|
8955
9054
|
type: "testValidate",
|
|
8956
9055
|
created_at: (new Date).toISOString(),
|
|
8957
|
-
files,
|
|
9056
|
+
files: testFiles,
|
|
8958
9057
|
result,
|
|
8959
9058
|
step: ctx.state().interface?.step ?? 0
|
|
8960
9059
|
};
|
|
@@ -8963,7 +9062,7 @@ async function step(ctx, files, life) {
|
|
|
8963
9062
|
ctx.dispatch({
|
|
8964
9063
|
type: "testValidate",
|
|
8965
9064
|
created_at: (new Date).toISOString(),
|
|
8966
|
-
files,
|
|
9065
|
+
files: testFiles,
|
|
8967
9066
|
result,
|
|
8968
9067
|
step: ctx.state().interface?.step ?? 0
|
|
8969
9068
|
});
|
|
@@ -8979,7 +9078,7 @@ async function step(ctx, files, life) {
|
|
|
8979
9078
|
return {
|
|
8980
9079
|
type: "testValidate",
|
|
8981
9080
|
created_at: (new Date).toISOString(),
|
|
8982
|
-
files,
|
|
9081
|
+
files: testFiles,
|
|
8983
9082
|
result: {
|
|
8984
9083
|
...result,
|
|
8985
9084
|
type: "success"
|
|
@@ -8990,25 +9089,27 @@ async function step(ctx, files, life) {
|
|
|
8990
9089
|
ctx.dispatch({
|
|
8991
9090
|
type: "testValidate",
|
|
8992
9091
|
created_at: (new Date).toISOString(),
|
|
8993
|
-
files,
|
|
9092
|
+
files: testFiles,
|
|
8994
9093
|
result,
|
|
8995
9094
|
step: ctx.state().interface?.step ?? 0
|
|
8996
9095
|
});
|
|
8997
9096
|
if (life <= 0) return {
|
|
8998
9097
|
type: "testValidate",
|
|
8999
9098
|
created_at: (new Date).toISOString(),
|
|
9000
|
-
files,
|
|
9099
|
+
files: testFiles,
|
|
9001
9100
|
result,
|
|
9002
9101
|
step: ctx.state().interface?.step ?? 0
|
|
9003
9102
|
};
|
|
9004
|
-
const
|
|
9005
|
-
const
|
|
9006
|
-
const
|
|
9103
|
+
const validatedFiles = await Promise.all(Object.entries(diagnostics).map((async ([filename, d]) => {
|
|
9104
|
+
const file = testFiles.find((f => f.location === filename));
|
|
9105
|
+
const code = file?.content;
|
|
9106
|
+
const scenario = file?.scenario;
|
|
9107
|
+
const response = await process$1(ctx, d, code, scenario);
|
|
9007
9108
|
ctx.dispatch({
|
|
9008
9109
|
type: "testCorrect",
|
|
9009
9110
|
created_at: (new Date).toISOString(),
|
|
9010
9111
|
files: {
|
|
9011
|
-
...
|
|
9112
|
+
...testFiles,
|
|
9012
9113
|
[filename]: response.content
|
|
9013
9114
|
},
|
|
9014
9115
|
result,
|
|
@@ -9017,25 +9118,23 @@ async function step(ctx, files, life) {
|
|
|
9017
9118
|
think_again_with_compile_error: response.think_again_with_compile_error,
|
|
9018
9119
|
step: ctx.state().interface?.step ?? 0
|
|
9019
9120
|
});
|
|
9020
|
-
return
|
|
9121
|
+
return {
|
|
9122
|
+
location: filename,
|
|
9123
|
+
content: code,
|
|
9124
|
+
scenario
|
|
9125
|
+
};
|
|
9021
9126
|
})));
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
};
|
|
9026
|
-
return step(ctx, newFiles, life - 1);
|
|
9127
|
+
return step(ctx, entireFiles, testFiles.map((f => {
|
|
9128
|
+
const validated = validatedFiles.find((v => v.location === f.location));
|
|
9129
|
+
return validated ? validated : f;
|
|
9130
|
+
})), life - 1);
|
|
9027
9131
|
}
|
|
9028
9132
|
|
|
9029
|
-
async function process$
|
|
9133
|
+
async function process$1(ctx, diagnostics, code, scenario) {
|
|
9030
9134
|
const pointer = {
|
|
9031
9135
|
value: null
|
|
9032
9136
|
};
|
|
9033
|
-
const
|
|
9034
|
-
[filename]: content
|
|
9035
|
-
})), {});
|
|
9036
|
-
const dtoFiles = Object.entries(ctx.state().interface?.files ?? {}).filter((([filename]) => filename.startsWith("src/api/structures/"))).reduce(((acc, [filename, content]) => Object.assign(acc, {
|
|
9037
|
-
[filename]: content
|
|
9038
|
-
})), {});
|
|
9137
|
+
const artifacts = await compileTestScenario(ctx, scenario);
|
|
9039
9138
|
const agentica = new MicroAgentica({
|
|
9040
9139
|
model: ctx.model,
|
|
9041
9140
|
vendor: {
|
|
@@ -9044,19 +9143,25 @@ async function process$2(ctx, diagnostics, code) {
|
|
|
9044
9143
|
config: {
|
|
9045
9144
|
...ctx.config ?? {}
|
|
9046
9145
|
},
|
|
9047
|
-
histories: transformTestCorrectHistories(
|
|
9146
|
+
histories: transformTestCorrectHistories(artifacts),
|
|
9048
9147
|
controllers: [ createApplication$2({
|
|
9049
9148
|
model: ctx.model,
|
|
9050
9149
|
build: next => {
|
|
9051
9150
|
pointer.value = next;
|
|
9052
9151
|
}
|
|
9053
|
-
}) ]
|
|
9152
|
+
}) ],
|
|
9153
|
+
tokenUsage: ctx.usage()
|
|
9054
9154
|
});
|
|
9055
9155
|
enforceToolCall(agentica);
|
|
9056
|
-
await
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9156
|
+
await randomBackoffRetry((async () => {
|
|
9157
|
+
await agentica.conversate([ "Fix the compilation error in the provided code.", "", "## Original Code", "```typescript", code, "```", "", diagnostics.map((diagnostic => {
|
|
9158
|
+
if (diagnostic.start === undefined || diagnostic.length === undefined) return "";
|
|
9159
|
+
const checkDtoRegexp = `Cannot find module '@ORGANIZATION/template-api/lib/structures/IBbsArticleComment' or its corresponding type declarations.`;
|
|
9160
|
+
const [group] = [ ...checkDtoRegexp.matchAll(/Cannot find module '(.*lib\/structures\/.*)'/g) ];
|
|
9161
|
+
const [_, filename] = group ?? [];
|
|
9162
|
+
return [ "## Error Information", `- Position: Characters ${diagnostic.start} to ${diagnostic.start + diagnostic.length}`, `- Error Message: ${diagnostic.messageText}`, `- Problematic Code: \`${code.substring(diagnostic.start, diagnostic.start + diagnostic.length)}\``, filename ? `The type files located under **/lib/structures are declared in '@ORGANIZATION/PROJECT-api/lib/structures'.\n` + `Note: '@ORGANIZATION/PROJECT-api' must be written exactly as is and should not be replaced.\n` : "" ].join("\n");
|
|
9163
|
+
})), "## Instructions", "1. Focus on the specific error location and message", "2. Provide the corrected TypeScript code", "3. Ensure the fix resolves the compilation error", "", "Return only the fixed code without explanations." ].join("\n"));
|
|
9164
|
+
}));
|
|
9060
9165
|
if (pointer.value === null) throw new Error("Failed to modify test code.");
|
|
9061
9166
|
return pointer.value;
|
|
9062
9167
|
}
|
|
@@ -9349,129 +9454,191 @@ const collection$3 = {
|
|
|
9349
9454
|
}
|
|
9350
9455
|
};
|
|
9351
9456
|
|
|
9352
|
-
|
|
9353
|
-
|
|
9354
|
-
|
|
9355
|
-
|
|
9356
|
-
text: '# E2E Test Code Generator System Prompt\n\nYou are an expert E2E (End-to-End) test automation engineer specializing in generating test code directly from user scenarios using API functions and TypeScript DTO types.\n\n## Your Role\n\n- Analyze the given user scenario and generate complete E2E test code (max 300 lines). \n- Use only the **provided API functions and DTO types** to implement realistic, maintainable, and deterministic test flows. \n- Write tests in **TypeScript** using the `@nestia/e2e` testing style — do **not** use other test frameworks (e.g., Jest, Mocha). \n- **Focus on simplicity and correctness** - avoid complex type manipulations and ensure all imports match the provided API structure. \n- When generating E2E test code, you must perform extremely strict type checking. \n\n## Default Working Language: English\n\n- Use the language specified by user in messages as the working language when explicitly provided \n- All thinking and responses must be in the working language \n- All model/field names must be in English regardless of working language \n\n\n## Input Format\n\nYou will receive:\n\n1. **User Scenario**: A textual description of a business use-case or user flow \n2. **Filename**: The desired filename for the test file \n3. **API Files**: A collection of functions exposed by the system under test \n4. **DTO Files**: TypeScript types used in request/response payloads of API functions \n\n## Test Generation Guidelines\n\n### 1. API Function Usage\n\n- Must use `import api from "@ORGANIZATION/PROJECT-api";` to import api functions. \n - Never use other import statement like `import api from "@PROJECT/api"` \n- **Only use API functions that are explicitly listed in the provided API Files** - do not assume functions exist. \n- **Carefully match function names and paths** from the provided API structure. \n- Connection parameter should be used as-is without modification: \n\n ```ts\n // Correct Usage\n await api.functional.bbs.articles.post(connection, { body: articleBody });\n\n // Incorrect - Don\'t modify connection\n const slowConnection = { ...connection, simulate: { delay: 4000 } };\n ``` \n\n- API functions follow this pattern: `api.functional.[...].methodName(...)` \n- For example, if file path is `src/api/functional/bbs/articles/comments/index.ts` and function is `postByArticleId`, use `api.functional.bbs.articles.comments.postByArticleId(...)` \n\n### 2. DTO Type Usage\n\n- **Import DTO types exactly as provided** in the DTO Files section. \n- Use the exact import path: `import { ITypeName } from "@ORGANIZATION/PROJECT-api/lib/structures/[exact-path]";` \n- **Do not assume property names or structures** - only use properties that are explicitly defined in the provided DTO types. \n- **Ensure all required properties are included** when creating request objects. \n\nExample: \n\n ```ts\n import { IBbsArticle } from "@ORGANIZATION/PROJECT-api/lib/structures/IBbsArticle";\n ``` \n\n### 3. Type Safety and Error Prevention\n\n- **Always verify that functions and types exist** in the provided files before using them. \n- **Use simple, direct type assertions** - avoid complex type manipulations. \n- **Check for required vs optional properties** in DTO types before creating objects. \n- **Use only documented API methods** - don\'t assume method existence. \n\n### 4. Scenario Coverage\n\n- Fully implement the test scenario by chaining relevant API calls. \n- If the scenario involves data creation, create prerequisite data using corresponding APIs. \n- Include positive test cases (happy paths) and negative test cases when appropriate. \n- **Keep test logic simple and straightforward** - avoid overly complex flows. \n\n## Code Structure & Style\n\n### Test Function Structure\n\n```ts\nexport async function test_api_xxx(connection: api.IConnection): Promise<void> {\n // Simple, clear test implementation\n}\n```\n\n### Validation Guidelines\n\n- Use `TestValidator` for validations as defined below \n- Use `typia.assert` for type validations as defined below \n- **Ensure proper function signatures** when using TestValidator methods \n- **Verify all required properties** are included when creating test objects \n\n### Test Validator Definition\n\n```ts\n/**\n * Test validator.\n *\n * `TestValidator` is a collection gathering E2E validation functions.\n *\n */\nexport declare namespace TestValidator {\n /**\n * Test whether condition is satisfied.\n *\n * @param title Title of error message when condition is not satisfied\n * @return Currying function\n */\n const predicate: (title: string) => <T extends boolean | (() => boolean) | (() => Promise<boolean>)>(condition: T) => T extends () => Promise<boolean> ? Promise<void> : void;\n /**\n * Test whether two values are equal.\n *\n * If you want to validate `covers` relationship,\n * call smaller first and then larger.\n *\n * Otherwise you wanna non equals validator, combine with {@link error}.\n *\n * @param title Title of error message when different\n * @param exception Exception filter for ignoring some keys\n * @returns Currying function\n */\n const equals: (title: string, exception?: (key: string) => boolean) => <T>(x: T) => (y: T) => void;\n /**\n * Test whether error occurs.\n *\n * If error occurs, nothing would be happened.\n *\n * However, no error exists, then exception would be thrown.\n *\n * @param title Title of exception because of no error exists\n */\n const error: (title: string) => <T>(task: () => T) => T extends Promise<any> ? Promise<void> : void;\n const httpError: (title: string) => (...statuses: number[]) => <T>(task: () => T) => T extends Promise<any> ? Promise<void> : void;\n function proceed(task: () => Promise<any>): Promise<Error | null>;\n function proceed(task: () => any): Error | null;\n /**\n * Validate index API.\n *\n * Test whether two indexed values are equal.\n *\n * If two values are different, then exception would be thrown.\n *\n * @param title Title of error message when different\n * @return Currying function\n *\n * @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_search.ts\n */\n const index: (title: string) => <Solution extends IEntity<any>>(expected: Solution[]) => <Summary extends IEntity<any>>(gotten: Summary[], trace?: boolean) => void;\n /**\n * Valiate search options.\n *\n * Test a pagination API supporting search options.\n *\n * @param title Title of error message when searching is invalid\n * @returns Currying function\n *\n * @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_search.ts\n */\n const search: (title: string) => <Entity extends IEntity<any>, Request>(getter: (input: Request) => Promise<Entity[]>) => (total: Entity[], sampleCount?: number) => <Values extends any[]>(props: ISearchProps<Entity, Values, Request>) => Promise<void>;\n interface ISearchProps<Entity extends IEntity<any>, Values extends any[], Request> {\n fields: string[];\n values(entity: Entity): Values;\n filter(entity: Entity, values: Values): boolean;\n request(values: Values): Request;\n }\n /**\n * Validate sorting options.\n *\n * Test a pagination API supporting sorting options.\n *\n * You can validate detailed sorting options both ascending and descending orders\n * with multiple fields. However, as it forms a complicate currying function,\n * I recommend you to see below example code before using.\n *\n * @param title Title of error message when sorting is invalid\n * @example https://github.com/samchon/nestia-template/blob/master/src/test/features/api/bbs/test_api_bbs_article_index_sort.ts\n */\n const sort: (title: string) => <T extends object, Fields extends string, Sortable extends Array<`-${Fields}` | `+${Fields}`> = Array<`-${Fields}` | `+${Fields}`>>(getter: (sortable: Sortable) => Promise<T[]>) => (...fields: Fields[]) => (comp: (x: T, y: T) => number, filter?: (elem: T) => boolean) => (direction: "+" | "-", trace?: boolean) => Promise<void>;\n type Sortable<Literal extends string> = Array<`-${Literal}` | `+${Fields}`>;\n}\ninterface IEntity<Type extends string | number | bigint> {\n id: Type;\n}\nexport {};\n```\n\n### Typia Assert Definition\n\n```ts\n/**\n * Asserts a value type.\n *\n * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed\n * reason, if the parametric value is not following the type `T`. Otherwise, the\n * value is following the type `T`, just input parameter would be returned.\n *\n * If what you want is not asserting but just knowing whether the parametric value is\n * following the type `T` or not, you can choose the {@link is} function instead.\n * Otherwise you want to know all the errors, {@link validate} is the way to go.\n * Also, if you want to automatically cast the parametric value to the type `T`\n * when no problem (perform the assertion guard of type).\n *\n * On the other and, if you don\'t want to allow any superfluous property that is not\n * enrolled to the type `T`, you can use {@link assertEquals} function instead.\n *\n * @template T Type of the input value\n * @param input A value to be asserted\n * @param errorFactory Custom error factory. Default is `TypeGuardError`\n * @returns Parametric input value\n * @throws A {@link TypeGuardError} instance with detailed reason\n *\n */\nexport declare function assert<T>(input: T, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;\n/**\n * Asserts a value type.\n *\n * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed\n * reason, if the parametric value is not following the type `T`. Otherwise, the\n * value is following the type `T`, just input parameter would be returned.\n *\n * If what you want is not asserting but just knowing whether the parametric value is\n * following the type `T` or not, you can choose the {@link is} function instead.\n * Otherwise, you want to know all the errors, {@link validate} is the way to go.\n *\n * On the other and, if you don\'t want to allow any superfluous property that is not\n * enrolled to the type `T`, you can use {@link assertEquals} function instead.\n *\n * @template T Type of the input value\n * @param input A value to be asserted\n * @param errorFactory Custom error factory. Default is `TypeGuardError`\n * @returns Parametric input value casted as `T`\n * @throws A {@link TypeGuardError} instance with detailed reason\n *\n */\nexport declare function assert<T>(input: unknown, errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error)): T;\n/**\n * Assertion guard of a value type.\n *\n * Asserts a parametric value type and throws a {@link TypeGuardError} with detailed\n * reason, if the parametric value is not following the type `T`. Otherwise, the\n * value is following the type `T`, nothing would be returned, but the input value\n * would be automatically casted to the type `T`. This is the concept of\n * "Assertion Guard" of a value type.\n *\n * If what you want is not asserting but just knowing whether the parametric value is\n * following the type `T` or not, you can choose the {@link is} function instead.\n * Otherwise you want to know all the errors, {@link validate} is the way to go.\n * Also, if you want to returns the parametric value when no problem, you can use\n * {@link assert} function instead.\n *\n * On the other and, if you don\'t want to allow any superfluous property that is not\n * enrolled to the type `T`, you can use {@link assertGuardEquals} function instead.\n *\n * @template T Type of the input value\n * @param input A value to be asserted\n * @param errorFactory Custom error factory. Default is `TypeGuardError`\n * @throws A {@link TypeGuardError} instance with detailed reason\n *\n */\n```\n\n### Example Format:\n\n```ts\nimport { TestValidator } from "@nestia/e2e";\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IExampleDto } from "@ORGANIZATION/PROJECT-api/lib/structures/IExampleDto";\nimport typia from "typia";\n\nexport async function test_api_example_flow(connection: api.IConnection): Promise<void> {\n const input: IExampleDto = { ... }; // construct valid input\n\n const result = await api.functional.example.post(connection, input);\n\n typia.assert(result); // ensure response matches expected type\n TestValidator.equals("result", exceptFunction)(result.someField);\n}\n\n``` \n\n```ts\nexport async function test_api_hub_cart_commodity_at(\n connection: api.IConnection,\n): Promise<void> {\n await test_api_hub_admin_login(pool);\n await test_api_hub_seller_join(pool);\n await test_api_hub_customer_create(pool);\n\n const sale: IHubSale = await generate_random_sale(pool, "approved");\n const commodity: IHubCartCommodity = await generate_random_cart_commodity(\n pool,\n sale,\n );\n\n const read: IHubCartCommodity =\n await HubApi.functional.hub.customers.carts.commodities.at(\n pool.customer,\n null,\n commodity.id,\n );\n TestValidator.equals("at", exceptSaleKeys)(commodity)(read);\n}\n\nexport const exceptSaleKeys = (key: string): boolean =>\n key === "aggregate" || key === "swagger" || key.endsWith("_at");\n\n``` \n\n### Import Guidelines\n\n- **Only import what you actually use** \n- **Verify all imports exist** in the provided API and DTO files \n- **Use exact import paths** as specified in the file structure \n\n```ts\nimport { TestValidator } from "@nestia/e2e";\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { ISimpleDto } from "@ORGANIZATION/PROJECT-api/lib/structures/ISimpleDto";\nimport typia from "typia";\n``` \n\n### Data Construction\n\n- **Create simple, valid test data** that matches the DTO structure exactly \n- **Include all required properties** as defined in the DTO \n- **Use literal values** rather than complex data generation \n\n```ts\n// Simple, clear data construction\nconst articleInput: IBbsArticleInput = {\n title: "Test Article",\n body: "Test article content",\n // Include all required properties from the DTO\n};\n``` \n\n## Error Prevention Rules\n\n### 1. Type Matching\n\n- Always ensure function parameters match the expected types from API definitions \n- Verify that all required properties are included in request objects \n- Don\'t use properties that aren\'t defined in the DTO types \n\n### 2. Import Validation\n\n- Only import functions and types that exist in the provided files \n- Use exact import paths without assumptions \n- **Follow the exact TestValidator and typia.assert usage patterns** as defined in their type definitions \n\n### 3. Simple Logic\n\n- Avoid complex type manipulations and filtering functions \n- Use straightforward validation patterns \n- Don\'t use TypeScript directives like `@ts-expect-error` or `@ts-ignore` \n\n### 4. Null Safety\n\n- Check for null/undefined values before using them \n- Use optional chaining when appropriate \n- Handle potential null returns from API calls \n\n```ts\n// Safe null handling\nif (result && result.data) {\n typia.assert<IExpectedType>(result.data);\n}\n``` \n\n### 5. Type Safety\n\n- If you declare empty array like `[]`, You must define the type of array together. \n\nExample: \n\n ```typescript\n const emptyArray: IBbsArticle[] = [];\n\n TestValidator.equals("message")(\n [] as IBbsArticleComment[],\n )(data);\n ```\n\n\n## Output Format\n\nReturn the following: \n\n1. **Filename**: Suggested filename for the test (from input) \n2. **Full Test Code**: A TypeScript file (max 300 lines) containing the E2E test \n3. **Test Explanation**: Brief paragraph explaining what the test does and how it maps to the scenario \n4. **Execution Notes**: Any setup steps or dependencies required to run the test \n\n## Best Practices\n\n- **Keep tests simple and readable** - prioritize clarity over cleverness \n- **Use only provided API functions and DTO types** - no assumptions \n- **Create minimal but meaningful tests** that cover the core scenario \n- **Make tests deterministic** with predictable data and flows \n- **Include clear comments** for complex business logic only \n- **Follow naming conventions** (`test_api_[feature]_[action]`) \n- **Validate inputs and outputs** with simple, direct assertions \n\n## Error Handling\n\n- If the scenario lacks sufficient detail, ask for clarification \n- If no matching API function is found for a step, mention it and suggest alternatives from the provided API list \n- If a required DTO property is missing or unclear, request the complete DTO definition \n- **Always verify that all used functions and types exist** in the provided files before generating code'
|
|
9357
|
-
|
|
9358
|
-
|
|
9359
|
-
|
|
9360
|
-
|
|
9361
|
-
|
|
9362
|
-
|
|
9363
|
-
|
|
9364
|
-
async
|
|
9365
|
-
|
|
9366
|
-
|
|
9367
|
-
|
|
9368
|
-
|
|
9369
|
-
|
|
9370
|
-
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
|
|
9381
|
-
|
|
9457
|
+
async function orchestrateTestScenario(ctx) {
|
|
9458
|
+
const operations = ctx.state().interface?.document.operations ?? [];
|
|
9459
|
+
if (operations.length === 0) {
|
|
9460
|
+
throw new Error("Cannot write test scenarios because these are no operations.");
|
|
9461
|
+
}
|
|
9462
|
+
const exclude = [];
|
|
9463
|
+
let include = Array.from(operations);
|
|
9464
|
+
do {
|
|
9465
|
+
const matrix = divideArray({
|
|
9466
|
+
array: include,
|
|
9467
|
+
capacity: 30
|
|
9468
|
+
});
|
|
9469
|
+
await Promise.all(matrix.map((async _include => {
|
|
9470
|
+
exclude.push(...await execute(ctx, operations, _include, exclude.map((x => x.endpoint))));
|
|
9471
|
+
})));
|
|
9472
|
+
include = include.filter((op => {
|
|
9473
|
+
if (exclude.some((pg => pg.endpoint.method === op.method && pg.endpoint.path === op.path))) {
|
|
9474
|
+
return false;
|
|
9475
|
+
}
|
|
9476
|
+
return true;
|
|
9477
|
+
}));
|
|
9478
|
+
} while (include.length > 0);
|
|
9479
|
+
return {
|
|
9480
|
+
type: "testScenario",
|
|
9481
|
+
step: ctx.state().analyze?.step ?? 0,
|
|
9482
|
+
scenarios: exclude.flatMap((pg => pg.scenarios.map((plan => ({
|
|
9483
|
+
endpoint: pg.endpoint,
|
|
9484
|
+
draft: plan.draft,
|
|
9485
|
+
functionName: plan.functionName,
|
|
9486
|
+
dependencies: plan.dependsOn
|
|
9487
|
+
}))))),
|
|
9488
|
+
created_at: (new Date).toISOString()
|
|
9489
|
+
};
|
|
9382
9490
|
}
|
|
9383
9491
|
|
|
9384
|
-
async
|
|
9492
|
+
const execute = async (ctx, ops, include, exclude) => {
|
|
9385
9493
|
const pointer = {
|
|
9386
|
-
value:
|
|
9494
|
+
value: []
|
|
9387
9495
|
};
|
|
9388
|
-
const apiFiles = Object.entries(ctx.state().interface?.files ?? {}).filter((([filename]) => filename.startsWith("src/api/"))).reduce(((acc, [filename, content]) => Object.assign(acc, {
|
|
9389
|
-
[filename]: content
|
|
9390
|
-
})), {});
|
|
9391
|
-
const dtoFiles = Object.entries(ctx.state().interface?.files ?? {}).filter((([filename]) => filename.startsWith("src/api/structures/"))).reduce(((acc, [filename, content]) => Object.assign(acc, {
|
|
9392
|
-
[filename]: content
|
|
9393
|
-
})), {});
|
|
9394
9496
|
const agentica = new MicroAgentica({
|
|
9395
9497
|
model: ctx.model,
|
|
9396
9498
|
vendor: ctx.vendor,
|
|
9397
9499
|
config: {
|
|
9398
|
-
...ctx.config ?? {}
|
|
9500
|
+
...ctx.config ?? {},
|
|
9501
|
+
executor: {
|
|
9502
|
+
describe: null
|
|
9503
|
+
}
|
|
9399
9504
|
},
|
|
9400
|
-
|
|
9505
|
+
tokenUsage: ctx.usage(),
|
|
9506
|
+
histories: createHistoryProperties(ops, include, exclude),
|
|
9401
9507
|
controllers: [ createApplication$1({
|
|
9402
9508
|
model: ctx.model,
|
|
9403
9509
|
build: next => {
|
|
9404
|
-
pointer.value =
|
|
9510
|
+
pointer.value ?? (pointer.value = []);
|
|
9511
|
+
pointer.value.push(...next.scenarioGroups);
|
|
9405
9512
|
}
|
|
9406
9513
|
}) ]
|
|
9407
9514
|
});
|
|
9408
9515
|
enforceToolCall(agentica);
|
|
9409
|
-
await agentica.conversate(
|
|
9410
|
-
if (pointer.value ===
|
|
9516
|
+
await agentica.conversate(`create test scenarios.`);
|
|
9517
|
+
if (pointer.value.length === 0) {
|
|
9518
|
+
throw new Error("Failed to create test plans.");
|
|
9519
|
+
}
|
|
9411
9520
|
return pointer.value;
|
|
9412
|
-
}
|
|
9521
|
+
};
|
|
9522
|
+
|
|
9523
|
+
const createHistoryProperties = (operations, include, exclude) => [ {
|
|
9524
|
+
id: v4(),
|
|
9525
|
+
created_at: (new Date).toISOString(),
|
|
9526
|
+
type: "systemMessage",
|
|
9527
|
+
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### ✅ **Uniqueness Rule**\n\n> ⚠️ **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**✅ 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**❌ 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 → verify → 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.'
|
|
9528
|
+
}, {
|
|
9529
|
+
id: v4(),
|
|
9530
|
+
created_at: (new Date).toISOString(),
|
|
9531
|
+
type: "systemMessage",
|
|
9532
|
+
text: [ "Below are the full operations. Please refer to this.", "Your role is to draft all test cases for each given Operation.", "It is also permissible to write multiple test codes on a single endpoint.", "However, rather than meaningless tests, business logic tests should be written and an E2E test situation should be assumed.", "", "```json", JSON.stringify(operations.map((el => ({
|
|
9533
|
+
path: el.path,
|
|
9534
|
+
method: el.method,
|
|
9535
|
+
summary: el.summary
|
|
9536
|
+
})))), "```" ].join("\n")
|
|
9537
|
+
}, {
|
|
9538
|
+
id: v4(),
|
|
9539
|
+
created_at: (new Date).toISOString(),
|
|
9540
|
+
type: "systemMessage",
|
|
9541
|
+
text: [ "# Included in Test Plan", include.map((el => `- ${el.method.toUpperCase()}: ${el.path}`)).join("\n"), "", "# Excluded from Test Plan", "These are the endpoints that have already been used in test codes generated as part of a plan group.", "These endpoints do not need to be tested again.", "However, it is allowed to reference or depend on these endpoints when writing test codes for other purposes.", exclude.map((el => `- ${el.method.toUpperCase()}: ${el.path}`)).join("\n") ].join("\n")
|
|
9542
|
+
} ];
|
|
9413
9543
|
|
|
9414
9544
|
function createApplication$1(props) {
|
|
9415
9545
|
assertSchemaModel(props.model);
|
|
9416
9546
|
const application = collection$2[props.model];
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9424
|
-
|
|
9425
|
-
|
|
9426
|
-
|
|
9427
|
-
|
|
9428
|
-
|
|
9429
|
-
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9433
|
-
|
|
9434
|
-
|
|
9435
|
-
|
|
9436
|
-
|
|
9437
|
-
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
|
|
9447
|
-
|
|
9448
|
-
|
|
9449
|
-
|
|
9450
|
-
|
|
9451
|
-
|
|
9452
|
-
|
|
9453
|
-
|
|
9454
|
-
|
|
9455
|
-
|
|
9456
|
-
|
|
9457
|
-
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9547
|
+
application.functions[0].validate = next => {
|
|
9548
|
+
const result = (() => {
|
|
9549
|
+
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
9550
|
+
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))));
|
|
9551
|
+
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
9552
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependsOn) && input.dependsOn.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
9553
|
+
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
9554
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
9555
|
+
path: _path + ".scenarioGroups",
|
|
9556
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
9557
|
+
value: input.scenarioGroups
|
|
9558
|
+
})) && input.scenarioGroups.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
9559
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
9560
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
9561
|
+
value: elem
|
|
9562
|
+
})) && _vo1(elem, _path + ".scenarioGroups[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
9563
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
9564
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
9565
|
+
value: elem
|
|
9566
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
9567
|
+
path: _path + ".scenarioGroups",
|
|
9568
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
9569
|
+
value: input.scenarioGroups
|
|
9570
|
+
}) ].every((flag => flag));
|
|
9571
|
+
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
9572
|
+
path: _path + ".endpoint",
|
|
9573
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
9574
|
+
value: input.endpoint
|
|
9575
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
9576
|
+
path: _path + ".endpoint",
|
|
9577
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
9578
|
+
value: input.endpoint
|
|
9579
|
+
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
9580
|
+
path: _path + ".scenarios",
|
|
9581
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
9582
|
+
value: input.scenarios
|
|
9583
|
+
})) && input.scenarios.map(((elem, _index5) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
9584
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
9585
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
9586
|
+
value: elem
|
|
9587
|
+
})) && _vo3(elem, _path + ".scenarios[" + _index5 + "]", _exceptionable) || _report(_exceptionable, {
|
|
9588
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
9589
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
9590
|
+
value: elem
|
|
9591
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
9592
|
+
path: _path + ".scenarios",
|
|
9593
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
9594
|
+
value: input.scenarios
|
|
9595
|
+
}) ].every((flag => flag));
|
|
9596
|
+
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
9597
|
+
path: _path + ".path",
|
|
9465
9598
|
expected: "string",
|
|
9466
|
-
value: input.
|
|
9467
|
-
}), "
|
|
9468
|
-
path: _path + ".
|
|
9599
|
+
value: input.path
|
|
9600
|
+
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
9601
|
+
path: _path + ".method",
|
|
9602
|
+
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
9603
|
+
value: input.method
|
|
9604
|
+
}) ].every((flag => flag));
|
|
9605
|
+
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.draft || _report(_exceptionable, {
|
|
9606
|
+
path: _path + ".draft",
|
|
9469
9607
|
expected: "string",
|
|
9470
|
-
value: input.
|
|
9471
|
-
}), "string" === typeof input.
|
|
9472
|
-
path: _path + ".
|
|
9608
|
+
value: input.draft
|
|
9609
|
+
}), "string" === typeof input.functionName || _report(_exceptionable, {
|
|
9610
|
+
path: _path + ".functionName",
|
|
9473
9611
|
expected: "string",
|
|
9474
|
-
value: input.
|
|
9612
|
+
value: input.functionName
|
|
9613
|
+
}), (Array.isArray(input.dependsOn) || _report(_exceptionable, {
|
|
9614
|
+
path: _path + ".dependsOn",
|
|
9615
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
9616
|
+
value: input.dependsOn
|
|
9617
|
+
})) && input.dependsOn.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
9618
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
9619
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
9620
|
+
value: elem
|
|
9621
|
+
})) && _vo4(elem, _path + ".dependsOn[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
9622
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
9623
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
9624
|
+
value: elem
|
|
9625
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
9626
|
+
path: _path + ".dependsOn",
|
|
9627
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
9628
|
+
value: input.dependsOn
|
|
9629
|
+
}) ].every((flag => flag));
|
|
9630
|
+
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
9631
|
+
path: _path + ".endpoint",
|
|
9632
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
9633
|
+
value: input.endpoint
|
|
9634
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
9635
|
+
path: _path + ".endpoint",
|
|
9636
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
9637
|
+
value: input.endpoint
|
|
9638
|
+
}), "string" === typeof input.purpose || _report(_exceptionable, {
|
|
9639
|
+
path: _path + ".purpose",
|
|
9640
|
+
expected: "string",
|
|
9641
|
+
value: input.purpose
|
|
9475
9642
|
}) ].every((flag => flag));
|
|
9476
9643
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9477
9644
|
let errors;
|
|
@@ -9482,11 +9649,11 @@ const claude$2 = {
|
|
|
9482
9649
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9483
9650
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9484
9651
|
path: _path + "",
|
|
9485
|
-
expected: "
|
|
9652
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
9486
9653
|
value: input
|
|
9487
9654
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9488
9655
|
path: _path + "",
|
|
9489
|
-
expected: "
|
|
9656
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
9490
9657
|
value: input
|
|
9491
9658
|
}))(input, "$input", true);
|
|
9492
9659
|
const success = 0 === errors.length;
|
|
@@ -9504,345 +9671,42 @@ const claude$2 = {
|
|
|
9504
9671
|
data: input
|
|
9505
9672
|
};
|
|
9506
9673
|
};
|
|
9507
|
-
})()
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9519
|
-
functions: [ {
|
|
9520
|
-
name: "createTestCode",
|
|
9521
|
-
parameters: {
|
|
9522
|
-
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
9523
|
-
type: "object",
|
|
9524
|
-
properties: {
|
|
9525
|
-
plan: {
|
|
9526
|
-
title: "Strategic approach for test implementation",
|
|
9527
|
-
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception scenarios\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error scenarios (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the plan if it doesn't follow the Test Generation\n Guildelines.",
|
|
9528
|
-
type: "string"
|
|
9529
|
-
},
|
|
9530
|
-
domain: {
|
|
9531
|
-
title: "Functional domain classification for test organization",
|
|
9532
|
-
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system',
|
|
9533
|
-
type: "string"
|
|
9534
|
-
},
|
|
9535
|
-
content: {
|
|
9536
|
-
title: "Complete TypeScript E2E test implementation",
|
|
9537
|
-
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following",
|
|
9538
|
-
type: "string"
|
|
9674
|
+
})()(next);
|
|
9675
|
+
if (result.success === false) return result;
|
|
9676
|
+
const errors = [];
|
|
9677
|
+
result.data.scenarioGroups.forEach(((pg, i, arr) => {
|
|
9678
|
+
arr.forEach(((target, j) => {
|
|
9679
|
+
if (i !== j && target.endpoint.method === pg.endpoint.method && target.endpoint.path === pg.endpoint.path) {
|
|
9680
|
+
if (!errors.some((el => el.path !== `planGroups[${j}].path` && el.value !== target.endpoint.path))) {
|
|
9681
|
+
errors.push({
|
|
9682
|
+
path: `planGroups[${j}].path`,
|
|
9683
|
+
expected: `planGroup's {method + path} cannot duplicated.`,
|
|
9684
|
+
value: target.endpoint.path
|
|
9685
|
+
});
|
|
9539
9686
|
}
|
|
9540
|
-
|
|
9541
|
-
|
|
9542
|
-
|
|
9543
|
-
|
|
9544
|
-
|
|
9545
|
-
|
|
9546
|
-
const _io0 = input => "string" === typeof input.plan && "string" === typeof input.domain && "string" === typeof input.content;
|
|
9547
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.plan || _report(_exceptionable, {
|
|
9548
|
-
path: _path + ".plan",
|
|
9549
|
-
expected: "string",
|
|
9550
|
-
value: input.plan
|
|
9551
|
-
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
9552
|
-
path: _path + ".domain",
|
|
9553
|
-
expected: "string",
|
|
9554
|
-
value: input.domain
|
|
9555
|
-
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9556
|
-
path: _path + ".content",
|
|
9557
|
-
expected: "string",
|
|
9558
|
-
value: input.content
|
|
9559
|
-
}) ].every((flag => flag));
|
|
9560
|
-
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9561
|
-
let errors;
|
|
9562
|
-
let _report;
|
|
9563
|
-
return input => {
|
|
9564
|
-
if (false === __is(input)) {
|
|
9565
|
-
errors = [];
|
|
9566
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9567
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9568
|
-
path: _path + "",
|
|
9569
|
-
expected: "ICreateTestCodeProps",
|
|
9570
|
-
value: input
|
|
9571
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9572
|
-
path: _path + "",
|
|
9573
|
-
expected: "ICreateTestCodeProps",
|
|
9574
|
-
value: input
|
|
9575
|
-
}))(input, "$input", true);
|
|
9576
|
-
const success = 0 === errors.length;
|
|
9577
|
-
return success ? {
|
|
9578
|
-
success,
|
|
9579
|
-
data: input
|
|
9580
|
-
} : {
|
|
9581
|
-
success,
|
|
9582
|
-
errors,
|
|
9583
|
-
data: input
|
|
9584
|
-
};
|
|
9585
|
-
}
|
|
9586
|
-
return {
|
|
9587
|
-
success: true,
|
|
9588
|
-
data: input
|
|
9589
|
-
};
|
|
9590
|
-
};
|
|
9591
|
-
})()
|
|
9592
|
-
} ]
|
|
9593
|
-
},
|
|
9594
|
-
claude: claude$2,
|
|
9595
|
-
llama: claude$2,
|
|
9596
|
-
deepseek: claude$2,
|
|
9597
|
-
3.1: claude$2,
|
|
9598
|
-
"3.0": {
|
|
9599
|
-
model: "3.0",
|
|
9600
|
-
options: {
|
|
9601
|
-
constraint: true,
|
|
9602
|
-
recursive: 3,
|
|
9603
|
-
separate: null
|
|
9604
|
-
},
|
|
9605
|
-
functions: [ {
|
|
9606
|
-
name: "createTestCode",
|
|
9607
|
-
parameters: {
|
|
9608
|
-
type: "object",
|
|
9609
|
-
properties: {
|
|
9610
|
-
plan: {
|
|
9611
|
-
type: "string",
|
|
9612
|
-
title: "Strategic approach for test implementation",
|
|
9613
|
-
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception scenarios\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error scenarios (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the plan if it doesn't follow the Test Generation\n Guildelines."
|
|
9614
|
-
},
|
|
9615
|
-
domain: {
|
|
9616
|
-
type: "string",
|
|
9617
|
-
title: "Functional domain classification for test organization",
|
|
9618
|
-
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system'
|
|
9619
|
-
},
|
|
9620
|
-
content: {
|
|
9621
|
-
type: "string",
|
|
9622
|
-
title: "Complete TypeScript E2E test implementation",
|
|
9623
|
-
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following"
|
|
9687
|
+
if (!errors.some((el => el.path !== `planGroups[${j}].method` && el.value !== target.endpoint.method))) {
|
|
9688
|
+
errors.push({
|
|
9689
|
+
path: `planGroups[${j}].method`,
|
|
9690
|
+
expected: `planGroup's {method + path} cannot duplicated.`,
|
|
9691
|
+
value: target.endpoint.method
|
|
9692
|
+
});
|
|
9624
9693
|
}
|
|
9625
|
-
}
|
|
9626
|
-
|
|
9627
|
-
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
9628
|
-
additionalProperties: false
|
|
9629
|
-
},
|
|
9630
|
-
validate: (() => {
|
|
9631
|
-
const _io0 = input => "string" === typeof input.plan && "string" === typeof input.domain && "string" === typeof input.content;
|
|
9632
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.plan || _report(_exceptionable, {
|
|
9633
|
-
path: _path + ".plan",
|
|
9634
|
-
expected: "string",
|
|
9635
|
-
value: input.plan
|
|
9636
|
-
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
9637
|
-
path: _path + ".domain",
|
|
9638
|
-
expected: "string",
|
|
9639
|
-
value: input.domain
|
|
9640
|
-
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
9641
|
-
path: _path + ".content",
|
|
9642
|
-
expected: "string",
|
|
9643
|
-
value: input.content
|
|
9644
|
-
}) ].every((flag => flag));
|
|
9645
|
-
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9646
|
-
let errors;
|
|
9647
|
-
let _report;
|
|
9648
|
-
return input => {
|
|
9649
|
-
if (false === __is(input)) {
|
|
9650
|
-
errors = [];
|
|
9651
|
-
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9652
|
-
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9653
|
-
path: _path + "",
|
|
9654
|
-
expected: "ICreateTestCodeProps",
|
|
9655
|
-
value: input
|
|
9656
|
-
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9657
|
-
path: _path + "",
|
|
9658
|
-
expected: "ICreateTestCodeProps",
|
|
9659
|
-
value: input
|
|
9660
|
-
}))(input, "$input", true);
|
|
9661
|
-
const success = 0 === errors.length;
|
|
9662
|
-
return success ? {
|
|
9663
|
-
success,
|
|
9664
|
-
data: input
|
|
9665
|
-
} : {
|
|
9666
|
-
success,
|
|
9667
|
-
errors,
|
|
9668
|
-
data: input
|
|
9669
|
-
};
|
|
9670
|
-
}
|
|
9671
|
-
return {
|
|
9672
|
-
success: true,
|
|
9673
|
-
data: input
|
|
9674
|
-
};
|
|
9675
|
-
};
|
|
9676
|
-
})()
|
|
9677
|
-
} ]
|
|
9678
|
-
}
|
|
9679
|
-
};
|
|
9680
|
-
|
|
9681
|
-
const transformTestScenarioHistories = (state, allEndpoints, files) => {
|
|
9682
|
-
if (state.analyze === null) return [ {
|
|
9683
|
-
id: v4(),
|
|
9684
|
-
created_at: (new Date).toISOString(),
|
|
9685
|
-
type: "systemMessage",
|
|
9686
|
-
text: [ "Requirement analysis is not yet completed.", "Don't call the any tool function,", "but say to process the requirement analysis." ].join(" ")
|
|
9687
|
-
} ]; else if (state.prisma === null) return [ {
|
|
9688
|
-
id: v4(),
|
|
9689
|
-
created_at: (new Date).toISOString(),
|
|
9690
|
-
type: "systemMessage",
|
|
9691
|
-
text: [ "Prisma DB schema generation is not yet completed.", "Don't call the any tool function,", "but say to process the Prisma DB schema generation." ].join(" ")
|
|
9692
|
-
} ]; else if (state.analyze.step !== state.prisma.step) return [ {
|
|
9693
|
-
id: v4(),
|
|
9694
|
-
created_at: (new Date).toISOString(),
|
|
9695
|
-
type: "systemMessage",
|
|
9696
|
-
text: [ "Prisma DB schema generation has not been updated", "for the latest requirement analysis.", "Don't call the any tool function,", "but say to re-process the Prisma DB schema generation." ].join(" ")
|
|
9697
|
-
} ]; else if (state.prisma.compiled.type !== "success") return [ {
|
|
9698
|
-
id: v4(),
|
|
9699
|
-
created_at: (new Date).toISOString(),
|
|
9700
|
-
type: "systemMessage",
|
|
9701
|
-
text: [ "Prisma DB schema generation has not been updated", "for the latest requirement analysis.", "Don't call the any tool function,", "but say to re-process the Prisma DB schema generation." ].join(" ")
|
|
9702
|
-
} ]; else if (state.interface === null) return [ {
|
|
9703
|
-
id: v4(),
|
|
9704
|
-
created_at: (new Date).toISOString(),
|
|
9705
|
-
type: "systemMessage",
|
|
9706
|
-
text: [ "Interface generation is not yet completed.", "Don't call the any tool function,", "but say to process the interface generation." ].join(" ")
|
|
9707
|
-
} ];
|
|
9708
|
-
return [ {
|
|
9709
|
-
id: v4(),
|
|
9710
|
-
created_at: (new Date).toISOString(),
|
|
9711
|
-
type: "systemMessage",
|
|
9712
|
-
text: "# System Prompt: User Scenario Generator for API Endpoints\n\n## Role Definition\nYou are a world-class User Experience Analyst and Business Scenario Expert who specializes in analyzing API endpoints to generate comprehensive user scenarios from a pure user perspective. Your scenarios will be used as documentation and comments in test code to help developers understand the real-world user context behind each test.\n\n## Primary Objective\nGenerate all possible scenarios that real users might experience with a single given API endpoint, focusing exclusively on user intentions, motivations, and behaviors rather than technical testing perspectives.\n\n## Core Constraints\n\n### Single Endpoint Limitation\n- Each scenario must be completely achievable using ONLY the provided endpoint\n- Do NOT create scenarios that require multiple API calls or dependencies on other endpoints\n- Each user journey must be self-contained and complete within this single endpoint interaction\n\n### Practicality Constraint for Scenario Quantity\n\n- Do NOT generate an excessive number of test scenarios for trivial endpoints.\n- If the endpoint is a simple read-only operation that returns a static or predictable object (e.g. `{ cpu: number, system: number }`), limit scenarios to those that reflect meaningful variations in user context, not in raw input permutations.\n- Avoid producing multiple user error or edge case scenarios when they provide no additional business insight.\n- Prioritize business relevance over theoretical input diversity.\n- The goal is to maximize scenario value, not quantity.\n\n\n## Scenario Generation Principles\n\n### 1. Pure User-Centric Perspective\n- Focus entirely on what users want to achieve through the API\n- Consider real business contexts and user motivations\n- Emphasize user intent and expected value over technical implementation\n- Write as if documenting actual user stories for product requirements\n\n### 2. Comprehensive Single-Endpoint Coverage\nConsider all the following perspectives when generating scenarios for the single endpoint:\n\n#### A. Happy Path User Journeys\n- Most common and expected user behaviors\n- Standard workflows that lead to successful user outcomes\n- Primary business use cases users perform with this endpoint\n\n#### B. Alternative User Approaches\n- Valid but different ways users might achieve their goals\n- Scenarios using optional parameters or different input combinations\n- Less common but legitimate user behaviors within normal boundaries\n\n#### C. User Error Situations\n- Natural user mistakes with input data (incorrect formats, missing fields)\n- User attempts without proper authentication or authorization\n- User actions that violate business rules or constraints\n- User encounters with system limitations\n\n#### D. Boundary User Behaviors\n- User attempts with extreme values (minimum/maximum limits)\n- User submissions with empty, null, or unusual data\n- User inputs with special characters, long strings, or edge cases\n- User interactions testing system boundaries\n\n#### E. Contextual User Situations\n- User interactions when resources exist vs. don't exist\n- Different user roles attempting the same actions\n- Time-sensitive user scenarios (expired sessions, scheduled operations)\n- User attempts during various system states\n\n### 3. Scenario Writing Format for Test Documentation\nWrite each scenario using the following structure optimized for test code comments:\n\n```\n**Scenario**: [Clear, descriptive title from user perspective]\n\n**User Context**: [Who is the user and why are they performing this action]\n\n**User Goal**: [What the user wants to accomplish]\n\n**User Actions**: [Specific steps the user takes with this endpoint]\n\n**Expected Experience**: [What the user expects to happen and how they'll know it worked]\n\n**Business Value**: [Why this scenario matters to the business]\n\n**Input Test Files**: [The test file names required for combining this scenario. If you have multiple files, connect them with commas.]\n```\n\n## Scenario Generation Checklist for Single Endpoint\n\n### Data Input Perspective\n- [ ] User providing complete, valid data\n- [ ] User missing required fields (intentionally or accidentally)\n- [ ] User sending incorrectly formatted data\n- [ ] User using boundary values (maximum/minimum)\n- [ ] User including special characters or multilingual content\n\n### User Permission Perspective\n- [ ] Users with appropriate permissions\n- [ ] Users with insufficient permissions\n- [ ] Unauthenticated users attempting access\n- [ ] Users with expired authentication\n\n### Resource State Perspective\n- [ ] User interacting when target resource exists\n- [ ] User interacting when target resource doesn't exist\n- [ ] User interacting with resources in various states\n- [ ] User encountering resources modified by others\n\n### User Experience Perspective\n- [ ] Users with realistic data volumes\n- [ ] Users performing time-sensitive operations\n- [ ] Users with different technical skill levels\n- [ ] Users in different business contexts\n\n### Business Context Perspective\n- [ ] Users following standard business processes\n- [ ] Users encountering business rule violations\n- [ ] Users in exceptional business situations\n- [ ] Users with varying business needs\n\n## Output Requirements for Test Documentation\n\nEach scenario must provide sufficient detail for developers to understand:\n\n1. **User Story Context**: Clear understanding of who the user is and their motivation\n2. **Business Justification**: Why this scenario matters for the product\n3. **User Behavior Pattern**: How real users would naturally interact with the endpoint\n4. **Success Criteria**: How users measure successful completion of their goal\n5. **Function Name Guidance**: Clear enough description to derive meaningful test function names\n\n## Quality Standards for Test Code Comments\n\n- Write scenarios that help developers empathize with real users\n- Focus on business value and user outcomes, not technical mechanics\n- Provide enough context that a developer can understand the user's situation\n- Ensure scenarios reflect realistic business situations\n- Make each scenario distinct and valuable for understanding user needs\n- Use language that both technical and non-technical stakeholders can understand\n\n## Guidelines\n\n- Avoid mentioning test code, assertions, or technical implementation details\n- Write purely from the user's perspective using narrative language\n- Create realistic scenarios that reflect actual business situations\n- Ensure scenarios are comprehensive yet practical for a single endpoint\n- Focus on user value and business outcomes\n- Make scenarios detailed enough to understand full user context\n\n## Expected Input\nYou will receive a single API endpoint specification including:\n- HTTP method and endpoint path\n- Request/response schemas\n- Authentication requirements\n- Parameter definitions\n- Business context when available\n\n## Expected Output\nFor the given API endpoint, provide:\n- Categorized user scenarios covering all perspectives mentioned above\n- Each scenario following the specified format for test documentation\n- Scenarios that are complete and achievable with only the single provided endpoint\n- Clear mapping between user intentions and the specific API operation\n- Sufficient detail to understand both user context and business value\n\n## Working Language\n- Default working language: English\n- Use the language specified by user in messages as the working language when explicitly provided\n- All thinking and responses must be in the working language\n- Maintain consistent perspective and tone throughout all scenarios"
|
|
9713
|
-
}, {
|
|
9714
|
-
id: v4(),
|
|
9715
|
-
created_at: (new Date).toISOString(),
|
|
9716
|
-
type: "systemMessage",
|
|
9717
|
-
text: [ "# Result of Analyze Agent", "- The following document contains the user requirements that were extracted through conversations with the user by the Analyze Agent.", "- The database schema was designed based on these requirements, so you may refer to this document when writing test code or reviewing the schema.", "", `## User Request`, "", `- ${state.analyze.reason}`, "", `## Requirement Analysis Report`, "", "```json", JSON.stringify(state.analyze.files), "```" ].join("\n")
|
|
9718
|
-
}, {
|
|
9719
|
-
id: v4(),
|
|
9720
|
-
created_at: (new Date).toISOString(),
|
|
9721
|
-
type: "systemMessage",
|
|
9722
|
-
text: [ "# Result of Prisma Agent", "- Given the following database schema and entity-relationship diagram, write appropriate test code to validate the constraints and relationships defined in the schema. For example, if there is a unique column, include a test that ensures its uniqueness.", "- The test code should strictly adhere to the schema and relationships—no violations of constraints should occur.", "- Use the information from the schema and diagram to design meaningful and accurate test cases.", "", "## Prisma DB Schema", "```json", JSON.stringify(state.prisma.schemas), "```", "", "## Entity Relationship Diagrams", "```json", JSON.stringify(state.prisma.compiled.diagrams), "```" ].join("\n")
|
|
9723
|
-
}, {
|
|
9724
|
-
id: v4(),
|
|
9725
|
-
created_at: (new Date).toISOString(),
|
|
9726
|
-
type: "systemMessage",
|
|
9727
|
-
text: [ "# Result of Interfaced Agent", "- OpenAPI document generation is ready.", "", "Call the provided tool function to generate the user scenarios", "referencing below OpenAPI document.", "", `## OpenAPI Document`, "```json", JSON.stringify(state.interface.document), "```" ].join("\n")
|
|
9728
|
-
}, {
|
|
9729
|
-
id: v4(),
|
|
9730
|
-
created_at: (new Date).toISOString(),
|
|
9731
|
-
type: "systemMessage",
|
|
9732
|
-
text: "# System Prompt: User Scenario Generator for API Endpoints\n\n## Role Definition\nYou are a world-class User Experience Analyst and Business Scenario Expert who specializes in analyzing API endpoints to generate comprehensive user scenarios from a pure user perspective. Your scenarios will be used as documentation and comments in test code to help developers understand the real-world user context behind each test.\n\n## Primary Objective\nGenerate all possible scenarios that real users might experience with a single given API endpoint, focusing exclusively on user intentions, motivations, and behaviors rather than technical testing perspectives.\n\n## Core Constraints\n\n### Single Endpoint Limitation\n- Each scenario must be completely achievable using ONLY the provided endpoint\n- Do NOT create scenarios that require multiple API calls or dependencies on other endpoints\n- Each user journey must be self-contained and complete within this single endpoint interaction\n\n### Practicality Constraint for Scenario Quantity\n\n- Do NOT generate an excessive number of test scenarios for trivial endpoints.\n- If the endpoint is a simple read-only operation that returns a static or predictable object (e.g. `{ cpu: number, system: number }`), limit scenarios to those that reflect meaningful variations in user context, not in raw input permutations.\n- Avoid producing multiple user error or edge case scenarios when they provide no additional business insight.\n- Prioritize business relevance over theoretical input diversity.\n- The goal is to maximize scenario value, not quantity.\n\n\n## Scenario Generation Principles\n\n### 1. Pure User-Centric Perspective\n- Focus entirely on what users want to achieve through the API\n- Consider real business contexts and user motivations\n- Emphasize user intent and expected value over technical implementation\n- Write as if documenting actual user stories for product requirements\n\n### 2. Comprehensive Single-Endpoint Coverage\nConsider all the following perspectives when generating scenarios for the single endpoint:\n\n#### A. Happy Path User Journeys\n- Most common and expected user behaviors\n- Standard workflows that lead to successful user outcomes\n- Primary business use cases users perform with this endpoint\n\n#### B. Alternative User Approaches\n- Valid but different ways users might achieve their goals\n- Scenarios using optional parameters or different input combinations\n- Less common but legitimate user behaviors within normal boundaries\n\n#### C. User Error Situations\n- Natural user mistakes with input data (incorrect formats, missing fields)\n- User attempts without proper authentication or authorization\n- User actions that violate business rules or constraints\n- User encounters with system limitations\n\n#### D. Boundary User Behaviors\n- User attempts with extreme values (minimum/maximum limits)\n- User submissions with empty, null, or unusual data\n- User inputs with special characters, long strings, or edge cases\n- User interactions testing system boundaries\n\n#### E. Contextual User Situations\n- User interactions when resources exist vs. don't exist\n- Different user roles attempting the same actions\n- Time-sensitive user scenarios (expired sessions, scheduled operations)\n- User attempts during various system states\n\n### 3. Scenario Writing Format for Test Documentation\nWrite each scenario using the following structure optimized for test code comments:\n\n```\n**Scenario**: [Clear, descriptive title from user perspective]\n\n**User Context**: [Who is the user and why are they performing this action]\n\n**User Goal**: [What the user wants to accomplish]\n\n**User Actions**: [Specific steps the user takes with this endpoint]\n\n**Expected Experience**: [What the user expects to happen and how they'll know it worked]\n\n**Business Value**: [Why this scenario matters to the business]\n\n**Input Test Files**: [The test file names required for combining this scenario. If you have multiple files, connect them with commas.]\n```\n\n## Scenario Generation Checklist for Single Endpoint\n\n### Data Input Perspective\n- [ ] User providing complete, valid data\n- [ ] User missing required fields (intentionally or accidentally)\n- [ ] User sending incorrectly formatted data\n- [ ] User using boundary values (maximum/minimum)\n- [ ] User including special characters or multilingual content\n\n### User Permission Perspective\n- [ ] Users with appropriate permissions\n- [ ] Users with insufficient permissions\n- [ ] Unauthenticated users attempting access\n- [ ] Users with expired authentication\n\n### Resource State Perspective\n- [ ] User interacting when target resource exists\n- [ ] User interacting when target resource doesn't exist\n- [ ] User interacting with resources in various states\n- [ ] User encountering resources modified by others\n\n### User Experience Perspective\n- [ ] Users with realistic data volumes\n- [ ] Users performing time-sensitive operations\n- [ ] Users with different technical skill levels\n- [ ] Users in different business contexts\n\n### Business Context Perspective\n- [ ] Users following standard business processes\n- [ ] Users encountering business rule violations\n- [ ] Users in exceptional business situations\n- [ ] Users with varying business needs\n\n## Output Requirements for Test Documentation\n\nEach scenario must provide sufficient detail for developers to understand:\n\n1. **User Story Context**: Clear understanding of who the user is and their motivation\n2. **Business Justification**: Why this scenario matters for the product\n3. **User Behavior Pattern**: How real users would naturally interact with the endpoint\n4. **Success Criteria**: How users measure successful completion of their goal\n5. **Function Name Guidance**: Clear enough description to derive meaningful test function names\n\n## Quality Standards for Test Code Comments\n\n- Write scenarios that help developers empathize with real users\n- Focus on business value and user outcomes, not technical mechanics\n- Provide enough context that a developer can understand the user's situation\n- Ensure scenarios reflect realistic business situations\n- Make each scenario distinct and valuable for understanding user needs\n- Use language that both technical and non-technical stakeholders can understand\n\n## Guidelines\n\n- Avoid mentioning test code, assertions, or technical implementation details\n- Write purely from the user's perspective using narrative language\n- Create realistic scenarios that reflect actual business situations\n- Ensure scenarios are comprehensive yet practical for a single endpoint\n- Focus on user value and business outcomes\n- Make scenarios detailed enough to understand full user context\n\n## Expected Input\nYou will receive a single API endpoint specification including:\n- HTTP method and endpoint path\n- Request/response schemas\n- Authentication requirements\n- Parameter definitions\n- Business context when available\n\n## Expected Output\nFor the given API endpoint, provide:\n- Categorized user scenarios covering all perspectives mentioned above\n- Each scenario following the specified format for test documentation\n- Scenarios that are complete and achievable with only the single provided endpoint\n- Clear mapping between user intentions and the specific API operation\n- Sufficient detail to understand both user context and business value\n\n## Working Language\n- Default working language: English\n- Use the language specified by user in messages as the working language when explicitly provided\n- All thinking and responses must be in the working language\n- Maintain consistent perspective and tone throughout all scenarios"
|
|
9733
|
-
}, {
|
|
9734
|
-
id: v4(),
|
|
9735
|
-
created_at: (new Date).toISOString(),
|
|
9736
|
-
type: "systemMessage",
|
|
9737
|
-
text: [ `This is a description of different APIs.`, `Different APIs may have to be called to create one.`, `Check which functions have been developed.`, "```json", JSON.stringify(allEndpoints, null, 2), "```" ].join("\n")
|
|
9738
|
-
}, {
|
|
9739
|
-
id: v4(),
|
|
9740
|
-
created_at: (new Date).toISOString(),
|
|
9741
|
-
type: "systemMessage",
|
|
9742
|
-
text: [ "Below is basically the generated test code,", "which is a test to verify that the API is simply called and successful.", "Since there is already an automatically generated API,", "when a user requests to create a test scenario, two or more APIs must be combined,", "but a test in which the currently given endpoint is the main must be created.", '"Input Test Files" should be selected from the list of files here.', "```json", JSON.stringify(files, null, 2), "```" ].join("\n")
|
|
9743
|
-
} ];
|
|
9744
|
-
};
|
|
9745
|
-
|
|
9746
|
-
async function orchestrateTestScenario(ctx, capacity = 4) {
|
|
9747
|
-
const files = Object.entries(ctx.state().interface?.files ?? {}).filter((([filename]) => filename.startsWith("test/features/api/"))).reduce(((acc, [filename, content]) => Object.assign(acc, {
|
|
9748
|
-
[filename]: content
|
|
9749
|
-
})), {});
|
|
9750
|
-
const operations = ctx.state().interface?.document.operations ?? [];
|
|
9751
|
-
const endpoints = operations.map((it => ({
|
|
9752
|
-
method: it.method,
|
|
9753
|
-
path: it.path,
|
|
9754
|
-
summary: it.summary,
|
|
9755
|
-
description: it.description,
|
|
9756
|
-
parameters: it.parameters,
|
|
9757
|
-
requestBody: it.requestBody,
|
|
9758
|
-
responseBody: it.responseBody
|
|
9759
|
-
})));
|
|
9760
|
-
const matrix = divideArray({
|
|
9761
|
-
array: endpoints,
|
|
9762
|
-
capacity
|
|
9763
|
-
});
|
|
9764
|
-
const start = new Date;
|
|
9765
|
-
let completed = 0;
|
|
9766
|
-
const scenarios = await Promise.all(matrix.map((async e => {
|
|
9767
|
-
const rows = await divideAndConquer(ctx, e, endpoints, files, 3, (count => {
|
|
9768
|
-
completed += count;
|
|
9694
|
+
}
|
|
9695
|
+
}));
|
|
9769
9696
|
}));
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
});
|
|
9778
|
-
return rows;
|
|
9779
|
-
})));
|
|
9780
|
-
return {
|
|
9781
|
-
type: "testScenario",
|
|
9782
|
-
scenarios: scenarios.flat(),
|
|
9783
|
-
total: scenarios.flat().flatMap((el => el.scenarios)).length,
|
|
9784
|
-
step: ctx.state().test?.step ?? 0,
|
|
9785
|
-
completed,
|
|
9786
|
-
created_at: start.toISOString()
|
|
9787
|
-
};
|
|
9788
|
-
}
|
|
9789
|
-
|
|
9790
|
-
async function divideAndConquer(ctx, endpoints, allEndpoints, files, retry, progress) {
|
|
9791
|
-
const remained = new HashSet(endpoints, OpenApiEndpointComparator.hashCode, OpenApiEndpointComparator.equals);
|
|
9792
|
-
const scenarios = new HashMap(OpenApiEndpointComparator.hashCode, OpenApiEndpointComparator.equals);
|
|
9793
|
-
for (let i = 0; i < retry; ++i) {
|
|
9794
|
-
if (remained.empty() === true || scenarios.size() >= endpoints.length) break;
|
|
9795
|
-
const before = scenarios.size();
|
|
9796
|
-
const newbie = await process(ctx, Array.from(remained), allEndpoints, files);
|
|
9797
|
-
for (const item of newbie) {
|
|
9798
|
-
scenarios.set(item.endpoint, item.scenarios);
|
|
9799
|
-
remained.erase(item.endpoint);
|
|
9697
|
+
if (errors.length !== 0) {
|
|
9698
|
+
console.log(JSON.stringify(errors, null, 2), "errors");
|
|
9699
|
+
return {
|
|
9700
|
+
success: false,
|
|
9701
|
+
errors,
|
|
9702
|
+
data: next
|
|
9703
|
+
};
|
|
9800
9704
|
}
|
|
9801
|
-
|
|
9802
|
-
}
|
|
9803
|
-
return Array.from(scenarios.toJSON()).map((it => ({
|
|
9804
|
-
endpoint: it.first,
|
|
9805
|
-
scenarios: it.second
|
|
9806
|
-
})));
|
|
9807
|
-
}
|
|
9808
|
-
|
|
9809
|
-
async function process(ctx, endpoints, allEndpoints, files) {
|
|
9810
|
-
const pointer = {
|
|
9811
|
-
value: null
|
|
9705
|
+
return result;
|
|
9812
9706
|
};
|
|
9813
|
-
const agentica = new MicroAgentica({
|
|
9814
|
-
model: ctx.model,
|
|
9815
|
-
vendor: ctx.vendor,
|
|
9816
|
-
config: {
|
|
9817
|
-
...ctx.config ?? {
|
|
9818
|
-
locale: "en-US"
|
|
9819
|
-
},
|
|
9820
|
-
systemPrompt: {
|
|
9821
|
-
describe: () => "Answer only 'completion' or 'failure'."
|
|
9822
|
-
}
|
|
9823
|
-
},
|
|
9824
|
-
tokenUsage: ctx.usage(),
|
|
9825
|
-
histories: [ ...transformTestScenarioHistories(ctx.state(), allEndpoints, files) ],
|
|
9826
|
-
controllers: [ createApplication({
|
|
9827
|
-
model: ctx.model,
|
|
9828
|
-
build: next => {
|
|
9829
|
-
pointer.value ?? (pointer.value = []);
|
|
9830
|
-
pointer.value.push(...next.scenarios);
|
|
9831
|
-
}
|
|
9832
|
-
}) ]
|
|
9833
|
-
});
|
|
9834
|
-
enforceToolCall(agentica);
|
|
9835
|
-
await agentica.conversate([ "Make User Scenarios for below endpoints:", "", "```json", JSON.stringify(endpoints, null, 2), "```" ].join("\n"));
|
|
9836
|
-
if (pointer.value === null) throw new Error("Failed to make scenarios.");
|
|
9837
|
-
return pointer.value;
|
|
9838
|
-
}
|
|
9839
|
-
|
|
9840
|
-
function createApplication(props) {
|
|
9841
|
-
assertSchemaModel(props.model);
|
|
9842
|
-
const application = collection$1[props.model];
|
|
9843
9707
|
return {
|
|
9844
9708
|
protocol: "class",
|
|
9845
|
-
name: "Make
|
|
9709
|
+
name: "Make test plans",
|
|
9846
9710
|
application,
|
|
9847
9711
|
execute: {
|
|
9848
9712
|
makeScenario: next => {
|
|
@@ -9852,7 +9716,7 @@ function createApplication(props) {
|
|
|
9852
9716
|
};
|
|
9853
9717
|
}
|
|
9854
9718
|
|
|
9855
|
-
const claude$
|
|
9719
|
+
const claude$2 = {
|
|
9856
9720
|
model: "claude",
|
|
9857
9721
|
options: {
|
|
9858
9722
|
reference: true,
|
|
@@ -9861,19 +9725,19 @@ const claude$1 = {
|
|
|
9861
9725
|
functions: [ {
|
|
9862
9726
|
name: "makeScenario",
|
|
9863
9727
|
parameters: {
|
|
9864
|
-
description: " Properties containing the endpoints and
|
|
9728
|
+
description: " Properties containing the endpoints and test scenarios.\n\n------------------------------\n\nCurrent Type: {@link IAutoBeTestScenarioApplication.IProps}",
|
|
9865
9729
|
type: "object",
|
|
9866
9730
|
properties: {
|
|
9867
|
-
|
|
9868
|
-
title: "Array of
|
|
9869
|
-
description: "Array of
|
|
9731
|
+
scenarioGroups: {
|
|
9732
|
+
title: "Array of test scenario groups",
|
|
9733
|
+
description: "Array of test scenario groups.",
|
|
9870
9734
|
type: "array",
|
|
9871
9735
|
items: {
|
|
9872
|
-
description: "Current Type: {@link
|
|
9736
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IScenarioGroup}",
|
|
9873
9737
|
type: "object",
|
|
9874
9738
|
properties: {
|
|
9875
9739
|
endpoint: {
|
|
9876
|
-
description: "Target API endpoint
|
|
9740
|
+
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
9877
9741
|
type: "object",
|
|
9878
9742
|
properties: {
|
|
9879
9743
|
path: {
|
|
@@ -9900,24 +9764,66 @@ const claude$1 = {
|
|
|
9900
9764
|
required: [ "path", "method" ]
|
|
9901
9765
|
},
|
|
9902
9766
|
scenarios: {
|
|
9903
|
-
title: "
|
|
9904
|
-
description: "
|
|
9767
|
+
title: "Array of test scenarios",
|
|
9768
|
+
description: "Array of test scenarios.",
|
|
9905
9769
|
type: "array",
|
|
9906
9770
|
items: {
|
|
9907
|
-
description: "
|
|
9771
|
+
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.",
|
|
9908
9772
|
type: "object",
|
|
9909
9773
|
properties: {
|
|
9774
|
+
draft: {
|
|
9775
|
+
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.",
|
|
9776
|
+
type: "string"
|
|
9777
|
+
},
|
|
9910
9778
|
functionName: {
|
|
9911
9779
|
title: "Descriptive function name derived from the user scenario",
|
|
9912
9780
|
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",
|
|
9913
9781
|
type: "string"
|
|
9914
9782
|
},
|
|
9915
|
-
|
|
9916
|
-
description: "
|
|
9917
|
-
type: "
|
|
9783
|
+
dependsOn: {
|
|
9784
|
+
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.",
|
|
9785
|
+
type: "array",
|
|
9786
|
+
items: {
|
|
9787
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependsOn}",
|
|
9788
|
+
type: "object",
|
|
9789
|
+
properties: {
|
|
9790
|
+
endpoint: {
|
|
9791
|
+
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.",
|
|
9792
|
+
type: "object",
|
|
9793
|
+
properties: {
|
|
9794
|
+
path: {
|
|
9795
|
+
title: "HTTP path of the API operation",
|
|
9796
|
+
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.",
|
|
9797
|
+
type: "string"
|
|
9798
|
+
},
|
|
9799
|
+
method: {
|
|
9800
|
+
title: "HTTP method of the API operation",
|
|
9801
|
+
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",
|
|
9802
|
+
oneOf: [ {
|
|
9803
|
+
const: "get"
|
|
9804
|
+
}, {
|
|
9805
|
+
const: "post"
|
|
9806
|
+
}, {
|
|
9807
|
+
const: "put"
|
|
9808
|
+
}, {
|
|
9809
|
+
const: "delete"
|
|
9810
|
+
}, {
|
|
9811
|
+
const: "patch"
|
|
9812
|
+
} ]
|
|
9813
|
+
}
|
|
9814
|
+
},
|
|
9815
|
+
required: [ "path", "method" ]
|
|
9816
|
+
},
|
|
9817
|
+
purpose: {
|
|
9818
|
+
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."',
|
|
9819
|
+
type: "string"
|
|
9820
|
+
}
|
|
9821
|
+
},
|
|
9822
|
+
required: [ "endpoint", "purpose" ]
|
|
9823
|
+
}
|
|
9918
9824
|
}
|
|
9919
9825
|
},
|
|
9920
|
-
required: [ "functionName", "
|
|
9826
|
+
required: [ "draft", "functionName", "dependsOn" ]
|
|
9921
9827
|
}
|
|
9922
9828
|
}
|
|
9923
9829
|
},
|
|
@@ -9925,32 +9831,33 @@ const claude$1 = {
|
|
|
9925
9831
|
}
|
|
9926
9832
|
}
|
|
9927
9833
|
},
|
|
9928
|
-
required: [ "
|
|
9834
|
+
required: [ "scenarioGroups" ],
|
|
9929
9835
|
additionalProperties: false,
|
|
9930
9836
|
$defs: {}
|
|
9931
9837
|
},
|
|
9932
|
-
description: "Make
|
|
9838
|
+
description: "Make test scenarios for the given endpoints.",
|
|
9933
9839
|
validate: (() => {
|
|
9934
|
-
const _io0 = input => Array.isArray(input.
|
|
9840
|
+
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
9935
9841
|
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))));
|
|
9936
9842
|
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
9937
|
-
const _io3 = input => "string" === typeof input.
|
|
9938
|
-
const
|
|
9939
|
-
|
|
9940
|
-
|
|
9941
|
-
|
|
9942
|
-
|
|
9943
|
-
|
|
9944
|
-
|
|
9843
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependsOn) && input.dependsOn.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
9844
|
+
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
9845
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
9846
|
+
path: _path + ".scenarioGroups",
|
|
9847
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
9848
|
+
value: input.scenarioGroups
|
|
9849
|
+
})) && input.scenarioGroups.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
9850
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
9851
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
9945
9852
|
value: elem
|
|
9946
|
-
})) && _vo1(elem, _path + ".
|
|
9947
|
-
path: _path + ".
|
|
9948
|
-
expected: "
|
|
9853
|
+
})) && _vo1(elem, _path + ".scenarioGroups[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
9854
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
9855
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
9949
9856
|
value: elem
|
|
9950
9857
|
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
9951
|
-
path: _path + ".
|
|
9952
|
-
expected: "Array<
|
|
9953
|
-
value: input.
|
|
9858
|
+
path: _path + ".scenarioGroups",
|
|
9859
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
9860
|
+
value: input.scenarioGroups
|
|
9954
9861
|
}) ].every((flag => flag));
|
|
9955
9862
|
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
9956
9863
|
path: _path + ".endpoint",
|
|
@@ -9962,19 +9869,19 @@ const claude$1 = {
|
|
|
9962
9869
|
value: input.endpoint
|
|
9963
9870
|
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
9964
9871
|
path: _path + ".scenarios",
|
|
9965
|
-
expected: "Array<
|
|
9872
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
9966
9873
|
value: input.scenarios
|
|
9967
|
-
})) && input.scenarios.map(((elem,
|
|
9968
|
-
path: _path + ".scenarios[" +
|
|
9969
|
-
expected: "
|
|
9874
|
+
})) && input.scenarios.map(((elem, _index5) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
9875
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
9876
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
9970
9877
|
value: elem
|
|
9971
|
-
})) && _vo3(elem, _path + ".scenarios[" +
|
|
9972
|
-
path: _path + ".scenarios[" +
|
|
9973
|
-
expected: "
|
|
9878
|
+
})) && _vo3(elem, _path + ".scenarios[" + _index5 + "]", _exceptionable) || _report(_exceptionable, {
|
|
9879
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
9880
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
9974
9881
|
value: elem
|
|
9975
9882
|
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
9976
9883
|
path: _path + ".scenarios",
|
|
9977
|
-
expected: "Array<
|
|
9884
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
9978
9885
|
value: input.scenarios
|
|
9979
9886
|
}) ].every((flag => flag));
|
|
9980
9887
|
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
@@ -9986,14 +9893,676 @@ const claude$1 = {
|
|
|
9986
9893
|
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
9987
9894
|
value: input.method
|
|
9988
9895
|
}) ].every((flag => flag));
|
|
9989
|
-
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.
|
|
9896
|
+
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.draft || _report(_exceptionable, {
|
|
9897
|
+
path: _path + ".draft",
|
|
9898
|
+
expected: "string",
|
|
9899
|
+
value: input.draft
|
|
9900
|
+
}), "string" === typeof input.functionName || _report(_exceptionable, {
|
|
9990
9901
|
path: _path + ".functionName",
|
|
9991
9902
|
expected: "string",
|
|
9992
9903
|
value: input.functionName
|
|
9993
|
-
}),
|
|
9904
|
+
}), (Array.isArray(input.dependsOn) || _report(_exceptionable, {
|
|
9905
|
+
path: _path + ".dependsOn",
|
|
9906
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
9907
|
+
value: input.dependsOn
|
|
9908
|
+
})) && input.dependsOn.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
9909
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
9910
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
9911
|
+
value: elem
|
|
9912
|
+
})) && _vo4(elem, _path + ".dependsOn[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
9913
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
9914
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
9915
|
+
value: elem
|
|
9916
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
9917
|
+
path: _path + ".dependsOn",
|
|
9918
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
9919
|
+
value: input.dependsOn
|
|
9920
|
+
}) ].every((flag => flag));
|
|
9921
|
+
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
9922
|
+
path: _path + ".endpoint",
|
|
9923
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
9924
|
+
value: input.endpoint
|
|
9925
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
9926
|
+
path: _path + ".endpoint",
|
|
9927
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
9928
|
+
value: input.endpoint
|
|
9929
|
+
}), "string" === typeof input.purpose || _report(_exceptionable, {
|
|
9930
|
+
path: _path + ".purpose",
|
|
9931
|
+
expected: "string",
|
|
9932
|
+
value: input.purpose
|
|
9933
|
+
}) ].every((flag => flag));
|
|
9934
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9935
|
+
let errors;
|
|
9936
|
+
let _report;
|
|
9937
|
+
return input => {
|
|
9938
|
+
if (false === __is(input)) {
|
|
9939
|
+
errors = [];
|
|
9940
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
9941
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
9942
|
+
path: _path + "",
|
|
9943
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
9944
|
+
value: input
|
|
9945
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
9946
|
+
path: _path + "",
|
|
9947
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
9948
|
+
value: input
|
|
9949
|
+
}))(input, "$input", true);
|
|
9950
|
+
const success = 0 === errors.length;
|
|
9951
|
+
return success ? {
|
|
9952
|
+
success,
|
|
9953
|
+
data: input
|
|
9954
|
+
} : {
|
|
9955
|
+
success,
|
|
9956
|
+
errors,
|
|
9957
|
+
data: input
|
|
9958
|
+
};
|
|
9959
|
+
}
|
|
9960
|
+
return {
|
|
9961
|
+
success: true,
|
|
9962
|
+
data: input
|
|
9963
|
+
};
|
|
9964
|
+
};
|
|
9965
|
+
})()
|
|
9966
|
+
} ]
|
|
9967
|
+
};
|
|
9968
|
+
|
|
9969
|
+
const collection$2 = {
|
|
9970
|
+
chatgpt: {
|
|
9971
|
+
model: "chatgpt",
|
|
9972
|
+
options: {
|
|
9973
|
+
reference: true,
|
|
9974
|
+
strict: false,
|
|
9975
|
+
separate: null
|
|
9976
|
+
},
|
|
9977
|
+
functions: [ {
|
|
9978
|
+
name: "makeScenario",
|
|
9979
|
+
parameters: {
|
|
9980
|
+
description: " Properties containing the endpoints and test scenarios.\n\n------------------------------\n\nCurrent Type: {@link IAutoBeTestScenarioApplication.IProps}",
|
|
9981
|
+
type: "object",
|
|
9982
|
+
properties: {
|
|
9983
|
+
scenarioGroups: {
|
|
9984
|
+
title: "Array of test scenario groups",
|
|
9985
|
+
description: "Array of test scenario groups.",
|
|
9986
|
+
type: "array",
|
|
9987
|
+
items: {
|
|
9988
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IScenarioGroup}",
|
|
9989
|
+
type: "object",
|
|
9990
|
+
properties: {
|
|
9991
|
+
endpoint: {
|
|
9992
|
+
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
9993
|
+
type: "object",
|
|
9994
|
+
properties: {
|
|
9995
|
+
path: {
|
|
9996
|
+
title: "HTTP path of the API operation",
|
|
9997
|
+
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.",
|
|
9998
|
+
type: "string"
|
|
9999
|
+
},
|
|
10000
|
+
method: {
|
|
10001
|
+
title: "HTTP method of the API operation",
|
|
10002
|
+
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",
|
|
10003
|
+
type: "string",
|
|
10004
|
+
enum: [ "get", "post", "put", "delete", "patch" ]
|
|
10005
|
+
}
|
|
10006
|
+
},
|
|
10007
|
+
required: [ "path", "method" ]
|
|
10008
|
+
},
|
|
10009
|
+
scenarios: {
|
|
10010
|
+
title: "Array of test scenarios",
|
|
10011
|
+
description: "Array of test scenarios.",
|
|
10012
|
+
type: "array",
|
|
10013
|
+
items: {
|
|
10014
|
+
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.",
|
|
10015
|
+
type: "object",
|
|
10016
|
+
properties: {
|
|
10017
|
+
draft: {
|
|
10018
|
+
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.",
|
|
10019
|
+
type: "string"
|
|
10020
|
+
},
|
|
10021
|
+
functionName: {
|
|
10022
|
+
title: "Descriptive function name derived from the user scenario",
|
|
10023
|
+
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",
|
|
10024
|
+
type: "string"
|
|
10025
|
+
},
|
|
10026
|
+
dependsOn: {
|
|
10027
|
+
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.",
|
|
10028
|
+
type: "array",
|
|
10029
|
+
items: {
|
|
10030
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependsOn}",
|
|
10031
|
+
type: "object",
|
|
10032
|
+
properties: {
|
|
10033
|
+
endpoint: {
|
|
10034
|
+
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.",
|
|
10035
|
+
type: "object",
|
|
10036
|
+
properties: {
|
|
10037
|
+
path: {
|
|
10038
|
+
title: "HTTP path of the API operation",
|
|
10039
|
+
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.",
|
|
10040
|
+
type: "string"
|
|
10041
|
+
},
|
|
10042
|
+
method: {
|
|
10043
|
+
title: "HTTP method of the API operation",
|
|
10044
|
+
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",
|
|
10045
|
+
type: "string",
|
|
10046
|
+
enum: [ "get", "post", "put", "delete", "patch" ]
|
|
10047
|
+
}
|
|
10048
|
+
},
|
|
10049
|
+
required: [ "path", "method" ]
|
|
10050
|
+
},
|
|
10051
|
+
purpose: {
|
|
10052
|
+
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."',
|
|
10053
|
+
type: "string"
|
|
10054
|
+
}
|
|
10055
|
+
},
|
|
10056
|
+
required: [ "endpoint", "purpose" ]
|
|
10057
|
+
}
|
|
10058
|
+
}
|
|
10059
|
+
},
|
|
10060
|
+
required: [ "draft", "functionName", "dependsOn" ]
|
|
10061
|
+
}
|
|
10062
|
+
}
|
|
10063
|
+
},
|
|
10064
|
+
required: [ "endpoint", "scenarios" ]
|
|
10065
|
+
}
|
|
10066
|
+
}
|
|
10067
|
+
},
|
|
10068
|
+
required: [ "scenarioGroups" ],
|
|
10069
|
+
additionalProperties: false,
|
|
10070
|
+
$defs: {}
|
|
10071
|
+
},
|
|
10072
|
+
description: "Make test scenarios for the given endpoints.",
|
|
10073
|
+
validate: (() => {
|
|
10074
|
+
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
10075
|
+
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))));
|
|
10076
|
+
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
10077
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependsOn) && input.dependsOn.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
10078
|
+
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
10079
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
10080
|
+
path: _path + ".scenarioGroups",
|
|
10081
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10082
|
+
value: input.scenarioGroups
|
|
10083
|
+
})) && input.scenarioGroups.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10084
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10085
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10086
|
+
value: elem
|
|
10087
|
+
})) && _vo1(elem, _path + ".scenarioGroups[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10088
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10089
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10090
|
+
value: elem
|
|
10091
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10092
|
+
path: _path + ".scenarioGroups",
|
|
10093
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10094
|
+
value: input.scenarioGroups
|
|
10095
|
+
}) ].every((flag => flag));
|
|
10096
|
+
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10097
|
+
path: _path + ".endpoint",
|
|
10098
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10099
|
+
value: input.endpoint
|
|
10100
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10101
|
+
path: _path + ".endpoint",
|
|
10102
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10103
|
+
value: input.endpoint
|
|
10104
|
+
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10105
|
+
path: _path + ".scenarios",
|
|
10106
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10107
|
+
value: input.scenarios
|
|
10108
|
+
})) && input.scenarios.map(((elem, _index5) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10109
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
10110
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10111
|
+
value: elem
|
|
10112
|
+
})) && _vo3(elem, _path + ".scenarios[" + _index5 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10113
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
10114
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10115
|
+
value: elem
|
|
10116
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10117
|
+
path: _path + ".scenarios",
|
|
10118
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10119
|
+
value: input.scenarios
|
|
10120
|
+
}) ].every((flag => flag));
|
|
10121
|
+
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
10122
|
+
path: _path + ".path",
|
|
10123
|
+
expected: "string",
|
|
10124
|
+
value: input.path
|
|
10125
|
+
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
10126
|
+
path: _path + ".method",
|
|
10127
|
+
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
10128
|
+
value: input.method
|
|
10129
|
+
}) ].every((flag => flag));
|
|
10130
|
+
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.draft || _report(_exceptionable, {
|
|
10131
|
+
path: _path + ".draft",
|
|
10132
|
+
expected: "string",
|
|
10133
|
+
value: input.draft
|
|
10134
|
+
}), "string" === typeof input.functionName || _report(_exceptionable, {
|
|
10135
|
+
path: _path + ".functionName",
|
|
10136
|
+
expected: "string",
|
|
10137
|
+
value: input.functionName
|
|
10138
|
+
}), (Array.isArray(input.dependsOn) || _report(_exceptionable, {
|
|
10139
|
+
path: _path + ".dependsOn",
|
|
10140
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
10141
|
+
value: input.dependsOn
|
|
10142
|
+
})) && input.dependsOn.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10143
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
10144
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
10145
|
+
value: elem
|
|
10146
|
+
})) && _vo4(elem, _path + ".dependsOn[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10147
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
10148
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
10149
|
+
value: elem
|
|
10150
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10151
|
+
path: _path + ".dependsOn",
|
|
10152
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
10153
|
+
value: input.dependsOn
|
|
10154
|
+
}) ].every((flag => flag));
|
|
10155
|
+
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10156
|
+
path: _path + ".endpoint",
|
|
10157
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10158
|
+
value: input.endpoint
|
|
10159
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10160
|
+
path: _path + ".endpoint",
|
|
10161
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10162
|
+
value: input.endpoint
|
|
10163
|
+
}), "string" === typeof input.purpose || _report(_exceptionable, {
|
|
10164
|
+
path: _path + ".purpose",
|
|
10165
|
+
expected: "string",
|
|
10166
|
+
value: input.purpose
|
|
10167
|
+
}) ].every((flag => flag));
|
|
10168
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10169
|
+
let errors;
|
|
10170
|
+
let _report;
|
|
10171
|
+
return input => {
|
|
10172
|
+
if (false === __is(input)) {
|
|
10173
|
+
errors = [];
|
|
10174
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10175
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10176
|
+
path: _path + "",
|
|
10177
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10178
|
+
value: input
|
|
10179
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10180
|
+
path: _path + "",
|
|
10181
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10182
|
+
value: input
|
|
10183
|
+
}))(input, "$input", true);
|
|
10184
|
+
const success = 0 === errors.length;
|
|
10185
|
+
return success ? {
|
|
10186
|
+
success,
|
|
10187
|
+
data: input
|
|
10188
|
+
} : {
|
|
10189
|
+
success,
|
|
10190
|
+
errors,
|
|
10191
|
+
data: input
|
|
10192
|
+
};
|
|
10193
|
+
}
|
|
10194
|
+
return {
|
|
10195
|
+
success: true,
|
|
10196
|
+
data: input
|
|
10197
|
+
};
|
|
10198
|
+
};
|
|
10199
|
+
})()
|
|
10200
|
+
} ]
|
|
10201
|
+
},
|
|
10202
|
+
claude: claude$2,
|
|
10203
|
+
llama: claude$2,
|
|
10204
|
+
deepseek: claude$2,
|
|
10205
|
+
3.1: claude$2,
|
|
10206
|
+
"3.0": {
|
|
10207
|
+
model: "3.0",
|
|
10208
|
+
options: {
|
|
10209
|
+
constraint: true,
|
|
10210
|
+
recursive: 3,
|
|
10211
|
+
separate: null
|
|
10212
|
+
},
|
|
10213
|
+
functions: [ {
|
|
10214
|
+
name: "makeScenario",
|
|
10215
|
+
parameters: {
|
|
10216
|
+
type: "object",
|
|
10217
|
+
properties: {
|
|
10218
|
+
scenarioGroups: {
|
|
10219
|
+
type: "array",
|
|
10220
|
+
items: {
|
|
10221
|
+
type: "object",
|
|
10222
|
+
properties: {
|
|
10223
|
+
endpoint: {
|
|
10224
|
+
type: "object",
|
|
10225
|
+
properties: {
|
|
10226
|
+
path: {
|
|
10227
|
+
type: "string",
|
|
10228
|
+
title: "HTTP path of the API operation",
|
|
10229
|
+
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."
|
|
10230
|
+
},
|
|
10231
|
+
method: {
|
|
10232
|
+
type: "string",
|
|
10233
|
+
enum: [ "get", "post", "put", "delete", "patch" ],
|
|
10234
|
+
title: "HTTP method of the API operation",
|
|
10235
|
+
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"
|
|
10236
|
+
}
|
|
10237
|
+
},
|
|
10238
|
+
required: [ "path", "method" ],
|
|
10239
|
+
description: "Target API endpoint to test.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10240
|
+
additionalProperties: false
|
|
10241
|
+
},
|
|
10242
|
+
scenarios: {
|
|
10243
|
+
type: "array",
|
|
10244
|
+
items: {
|
|
10245
|
+
type: "object",
|
|
10246
|
+
properties: {
|
|
10247
|
+
draft: {
|
|
10248
|
+
type: "string",
|
|
10249
|
+
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."
|
|
10250
|
+
},
|
|
10251
|
+
functionName: {
|
|
10252
|
+
type: "string",
|
|
10253
|
+
title: "Descriptive function name derived from the user scenario",
|
|
10254
|
+
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"
|
|
10255
|
+
},
|
|
10256
|
+
dependsOn: {
|
|
10257
|
+
type: "array",
|
|
10258
|
+
items: {
|
|
10259
|
+
type: "object",
|
|
10260
|
+
properties: {
|
|
10261
|
+
endpoint: {
|
|
10262
|
+
type: "object",
|
|
10263
|
+
properties: {
|
|
10264
|
+
path: {
|
|
10265
|
+
type: "string",
|
|
10266
|
+
title: "HTTP path of the API operation",
|
|
10267
|
+
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."
|
|
10268
|
+
},
|
|
10269
|
+
method: {
|
|
10270
|
+
type: "string",
|
|
10271
|
+
enum: [ "get", "post", "put", "delete", "patch" ],
|
|
10272
|
+
title: "HTTP method of the API operation",
|
|
10273
|
+
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"
|
|
10274
|
+
}
|
|
10275
|
+
},
|
|
10276
|
+
required: [ "path", "method" ],
|
|
10277
|
+
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.",
|
|
10278
|
+
additionalProperties: false
|
|
10279
|
+
},
|
|
10280
|
+
purpose: {
|
|
10281
|
+
type: "string",
|
|
10282
|
+
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."'
|
|
10283
|
+
}
|
|
10284
|
+
},
|
|
10285
|
+
required: [ "endpoint", "purpose" ],
|
|
10286
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IDependsOn}",
|
|
10287
|
+
additionalProperties: false
|
|
10288
|
+
},
|
|
10289
|
+
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."
|
|
10290
|
+
}
|
|
10291
|
+
},
|
|
10292
|
+
required: [ "draft", "functionName", "dependsOn" ],
|
|
10293
|
+
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.",
|
|
10294
|
+
additionalProperties: false
|
|
10295
|
+
},
|
|
10296
|
+
title: "Array of test scenarios",
|
|
10297
|
+
description: "Array of test scenarios."
|
|
10298
|
+
}
|
|
10299
|
+
},
|
|
10300
|
+
required: [ "endpoint", "scenarios" ],
|
|
10301
|
+
description: "Current Type: {@link IAutoBeTestScenarioApplication.IScenarioGroup}",
|
|
10302
|
+
additionalProperties: false
|
|
10303
|
+
},
|
|
10304
|
+
title: "Array of test scenario groups",
|
|
10305
|
+
description: "Array of test scenario groups."
|
|
10306
|
+
}
|
|
10307
|
+
},
|
|
10308
|
+
required: [ "scenarioGroups" ],
|
|
10309
|
+
description: " Properties containing the endpoints and test scenarios.\n\n------------------------------\n\nCurrent Type: {@link IAutoBeTestScenarioApplication.IProps}",
|
|
10310
|
+
additionalProperties: false
|
|
10311
|
+
},
|
|
10312
|
+
description: "Make test scenarios for the given endpoints.",
|
|
10313
|
+
validate: (() => {
|
|
10314
|
+
const _io0 = input => Array.isArray(input.scenarioGroups) && input.scenarioGroups.every((elem => "object" === typeof elem && null !== elem && _io1(elem)));
|
|
10315
|
+
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))));
|
|
10316
|
+
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
10317
|
+
const _io3 = input => "string" === typeof input.draft && "string" === typeof input.functionName && (Array.isArray(input.dependsOn) && input.dependsOn.every((elem => "object" === typeof elem && null !== elem && _io4(elem))));
|
|
10318
|
+
const _io4 = input => "object" === typeof input.endpoint && null !== input.endpoint && _io2(input.endpoint) && "string" === typeof input.purpose;
|
|
10319
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarioGroups) || _report(_exceptionable, {
|
|
10320
|
+
path: _path + ".scenarioGroups",
|
|
10321
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10322
|
+
value: input.scenarioGroups
|
|
10323
|
+
})) && input.scenarioGroups.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10324
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10325
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10326
|
+
value: elem
|
|
10327
|
+
})) && _vo1(elem, _path + ".scenarioGroups[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10328
|
+
path: _path + ".scenarioGroups[" + _index4 + "]",
|
|
10329
|
+
expected: "IAutoBeTestScenarioApplication.IScenarioGroup",
|
|
10330
|
+
value: elem
|
|
10331
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10332
|
+
path: _path + ".scenarioGroups",
|
|
10333
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenarioGroup>",
|
|
10334
|
+
value: input.scenarioGroups
|
|
10335
|
+
}) ].every((flag => flag));
|
|
10336
|
+
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10337
|
+
path: _path + ".endpoint",
|
|
10338
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10339
|
+
value: input.endpoint
|
|
10340
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10341
|
+
path: _path + ".endpoint",
|
|
10342
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10343
|
+
value: input.endpoint
|
|
10344
|
+
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10345
|
+
path: _path + ".scenarios",
|
|
10346
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10347
|
+
value: input.scenarios
|
|
10348
|
+
})) && input.scenarios.map(((elem, _index5) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10349
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
10350
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10351
|
+
value: elem
|
|
10352
|
+
})) && _vo3(elem, _path + ".scenarios[" + _index5 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10353
|
+
path: _path + ".scenarios[" + _index5 + "]",
|
|
10354
|
+
expected: "IAutoBeTestScenarioApplication.IScenario",
|
|
10355
|
+
value: elem
|
|
10356
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10357
|
+
path: _path + ".scenarios",
|
|
10358
|
+
expected: "Array<IAutoBeTestScenarioApplication.IScenario>",
|
|
10359
|
+
value: input.scenarios
|
|
10360
|
+
}) ].every((flag => flag));
|
|
10361
|
+
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
10362
|
+
path: _path + ".path",
|
|
10363
|
+
expected: "string",
|
|
10364
|
+
value: input.path
|
|
10365
|
+
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
10366
|
+
path: _path + ".method",
|
|
10367
|
+
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
10368
|
+
value: input.method
|
|
10369
|
+
}) ].every((flag => flag));
|
|
10370
|
+
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.draft || _report(_exceptionable, {
|
|
10371
|
+
path: _path + ".draft",
|
|
10372
|
+
expected: "string",
|
|
10373
|
+
value: input.draft
|
|
10374
|
+
}), "string" === typeof input.functionName || _report(_exceptionable, {
|
|
10375
|
+
path: _path + ".functionName",
|
|
10376
|
+
expected: "string",
|
|
10377
|
+
value: input.functionName
|
|
10378
|
+
}), (Array.isArray(input.dependsOn) || _report(_exceptionable, {
|
|
10379
|
+
path: _path + ".dependsOn",
|
|
10380
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
10381
|
+
value: input.dependsOn
|
|
10382
|
+
})) && input.dependsOn.map(((elem, _index6) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10383
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
10384
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
10385
|
+
value: elem
|
|
10386
|
+
})) && _vo4(elem, _path + ".dependsOn[" + _index6 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10387
|
+
path: _path + ".dependsOn[" + _index6 + "]",
|
|
10388
|
+
expected: "IAutoBeTestScenarioApplication.IDependsOn",
|
|
10389
|
+
value: elem
|
|
10390
|
+
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10391
|
+
path: _path + ".dependsOn",
|
|
10392
|
+
expected: "Array<IAutoBeTestScenarioApplication.IDependsOn>",
|
|
10393
|
+
value: input.dependsOn
|
|
10394
|
+
}) ].every((flag => flag));
|
|
10395
|
+
const _vo4 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10396
|
+
path: _path + ".endpoint",
|
|
10397
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10398
|
+
value: input.endpoint
|
|
10399
|
+
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10400
|
+
path: _path + ".endpoint",
|
|
10401
|
+
expected: "AutoBeOpenApi.IEndpoint",
|
|
10402
|
+
value: input.endpoint
|
|
10403
|
+
}), "string" === typeof input.purpose || _report(_exceptionable, {
|
|
10404
|
+
path: _path + ".purpose",
|
|
10405
|
+
expected: "string",
|
|
10406
|
+
value: input.purpose
|
|
10407
|
+
}) ].every((flag => flag));
|
|
10408
|
+
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10409
|
+
let errors;
|
|
10410
|
+
let _report;
|
|
10411
|
+
return input => {
|
|
10412
|
+
if (false === __is(input)) {
|
|
10413
|
+
errors = [];
|
|
10414
|
+
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10415
|
+
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10416
|
+
path: _path + "",
|
|
10417
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10418
|
+
value: input
|
|
10419
|
+
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10420
|
+
path: _path + "",
|
|
10421
|
+
expected: "IAutoBeTestScenarioApplication.IProps",
|
|
10422
|
+
value: input
|
|
10423
|
+
}))(input, "$input", true);
|
|
10424
|
+
const success = 0 === errors.length;
|
|
10425
|
+
return success ? {
|
|
10426
|
+
success,
|
|
10427
|
+
data: input
|
|
10428
|
+
} : {
|
|
10429
|
+
success,
|
|
10430
|
+
errors,
|
|
10431
|
+
data: input
|
|
10432
|
+
};
|
|
10433
|
+
}
|
|
10434
|
+
return {
|
|
10435
|
+
success: true,
|
|
10436
|
+
data: input
|
|
10437
|
+
};
|
|
10438
|
+
};
|
|
10439
|
+
})()
|
|
10440
|
+
} ]
|
|
10441
|
+
}
|
|
10442
|
+
};
|
|
10443
|
+
|
|
10444
|
+
const transformTestWriteHistories = props => [ {
|
|
10445
|
+
id: v4(),
|
|
10446
|
+
created_at: (new Date).toISOString(),
|
|
10447
|
+
type: "systemMessage",
|
|
10448
|
+
text: '# E2E Test Function Writing AI Agent System Prompt\n\n## 1. Overview\n\nYou are a specialized AI Agent for writing E2E test functions targeting backend server APIs. Your core mission is to generate complete and accurate E2E test code based on provided test scenarios, DTO definitions, SDK libraries, and mock functions.\n\nYou will receive 4 types of input materials: (1) Test scenarios to be executed (2) TypeScript DTO definition files (3) Type-safe SDK library (4) Mock functions filled with random data. Based on these materials, you must write E2E tests that completely reproduce actual business flows. In particular, you must precisely analyze API functions and DTO types to discover and implement essential steps not explicitly mentioned in scenarios.\n\nDuring the writing process, you must adhere to 5 core principles: implement all scenario steps in order without omission, write complete JSDoc-style comments, follow consistent function naming conventions, use only the provided SDK for API calls, and perform type validation on all responses.\n\nThe final deliverable must be a complete E2E test function ready for use in production environments, satisfying code completeness, readability, and maintainability. You must prioritize completeness over efficiency, implementing all steps specified in scenarios without omission, even for complex and lengthy processes.\n\n## 2. Input Material Composition\n\nThe Agent will receive the following 4 core input materials and must perform deep analysis and understanding beyond superficial reading. Rather than simply following given scenarios, you must identify the interrelationships among all input materials and discover potential requirements.\n\n### 2.1. Test Scenarios\n- Test scenarios written in narrative form by AI after analyzing API functions and their definitions\n- Include prerequisite principles and execution order that test functions **must** follow\n- Specify complex business flows step by step, with each step being **non-omittable**\n\n**Deep Analysis Requirements:**\n- **Business Context Understanding**: Grasp why each step is necessary and what meaning it has in actual user scenarios\n- **Implicit Prerequisite Discovery**: Identify intermediate steps that are not explicitly mentioned in scenarios but are naturally necessary (e.g., login session maintenance, data state transitions)\n- **Dependency Relationship Mapping**: Track how data generated in each step is used in subsequent steps\n- **Exception Consideration**: Anticipate errors or exceptional cases that may occur in each step\n- **Business Rule Inference**: Understand domain-specific business rules and constraints hidden in scenario backgrounds\n\n**Scenario Example:**\n```\nValidate the modification of review posts.\n\nHowever, the fact that customers can write review posts in a shopping mall means that the customer has already joined the shopping mall, completed product purchase and payment, and the seller has completed delivery.\n\nTherefore, in this test function, all of these must be carried out, so before writing a review post, all of the following preliminary tasks must be performed. It will be quite a long process.\n\n1. Seller signs up\n2. Seller registers a product\n3. Customer signs up\n4. Customer views the product in detail\n5. Customer adds the product to shopping cart\n6. Customer places a purchase order\n7. Customer confirms purchase and makes payment\n8. Seller confirms order and processes delivery\n9. Customer writes a review post\n10. Customer modifies the review post\n11. Re-view the review post to confirm modifications.\n```\n\n### 2.2. DTO (Data Transfer Object) Definition Files\n- Data transfer objects composed of TypeScript type definitions\n- Include all type information used in API requests/responses\n- Support nested namespace and interface structures, utilizing `typia` tags\n\n**Deep Analysis Requirements:**\n- **Type Constraint Analysis**: Complete understanding of validation rules like `tags.Format<"uuid">`, `tags.MinItems<1>`, `tags.Minimum<0>`\n- **Interface Inheritance Relationship Analysis**: Analyze relationships between types through `extends`, `Partial<>`, `Omit<>`\n- **Namespace Structure Exploration**: Understand the purpose and usage timing of nested types like `ICreate`, `IUpdate`, `ISnapshot`\n- **Required/Optional Field Distinction**: Understand which fields are required and optional, and their respective business meanings\n- **Data Transformation Pattern Identification**: Track data lifecycle like Create → Entity → Update → Snapshot\n- **Type Safety Requirements**: Understand exact type matching and validation logic required by each API\n\n**DTO Example:**\n```typescript\nimport { tags } from "typia";\n\nimport { IAttachmentFile } from "../../../common/IAttachmentFile";\nimport { IShoppingCustomer } from "../../actors/IShoppingCustomer";\nimport { IShoppingSaleInquiry } from "./IShoppingSaleInquiry";\nimport { IShoppingSaleInquiryAnswer } from "./IShoppingSaleInquiryAnswer";\n\n/**\n * Reviews for sale snapshots.\n *\n * `IShoppingSaleReview` is a subtype entity of {@link IShoppingSaleInquiry},\n * and is used when a {@link IShoppingCustomer customer} purchases a\n * {@link IShoppingSale sale} ({@link IShoppingSaleSnapshot snapshot} at the time)\n * registered by the {@link IShoppingSeller seller} as a product and leaves a\n * review and rating for it.\n *\n * For reference, `IShoppingSaleReview` and\n * {@link IShoppingOrderGod shopping_order_goods} have a logarithmic relationship\n * of N: 1, but this does not mean that customers can continue to write reviews\n * for the same product indefinitely. Wouldn\'t there be restrictions, such as\n * if you write a review once, you can write an additional review a month later?\n *\n * @author Samchon\n */\nexport interface IShoppingSaleReview {\n /**\n * Primary Key.\n */\n id: string & tags.Format<"uuid">;\n\n /**\n * Discriminator type.\n */\n type: "review";\n\n /**\n * Customer who wrote the inquiry.\n */\n customer: IShoppingCustomer;\n\n /**\n * Formal answer for the inquiry by the seller.\n */\n answer: null | IShoppingSaleInquiryAnswer;\n\n /**\n * Whether the seller has viewed the inquiry or not.\n */\n read_by_seller: boolean;\n\n /**\n * List of snapshot contents.\n *\n * It is created for the first time when an article is created, and is\n * accumulated every time the article is modified.\n */\n snapshots: IShoppingSaleReview.ISnapshot[] & tags.MinItems<1>;\n\n /**\n * Creation time of article.\n */\n created_at: string & tags.Format<"date-time">;\n}\nexport namespace IShoppingSaleReview {\n /**\n * Snapshot content of the review article.\n */\n export interface ISnapshot extends ICreate {\n /**\n * Primary Key.\n */\n id: string;\n\n /**\n * Creation time of snapshot record.\n *\n * In other words, creation time or update time or article.\n */\n created_at: string & tags.Format<"date-time">;\n }\n\n /**\n * Creation information of the review.\n */\n export interface ICreate {\n /**\n * Format of body.\n *\n * Same meaning with extension like `html`, `md`, `txt`.\n */\n format: "html" | "md" | "txt";\n\n /**\n * Title of article.\n */\n title: string;\n\n /**\n * Content body of article.\n */\n body: string;\n\n /**\n * List of attachment files.\n */\n files: IAttachmentFile.ICreate[];\n\n /**\n * Target good\'s {@link IShoppingOrderGood.id}.\n */\n good_id: string & tags.Format<"uuid">;\n\n /**\n * Score of the review.\n */\n score: number & tags.Minimum<0> & tags.Maximum<100>;\n }\n\n /**\n * Updating information of the review.\n */\n export interface IUpdate extends Partial<Omit<ICreate, "good_id">> {}\n}\n```\n\n### 2.3. SDK (Software Development Kit) Library\n- TypeScript functions corresponding to each API endpoint\n- Ensures type-safe API calls and is automatically generated by Nestia\n- Includes complete function signatures, metadata, and path information\n\n**Deep Analysis Requirements:**\n- **API Endpoint Classification**: Understand functional and role-based API grouping through namespace structure\n- **Parameter Structure Analysis**: Distinguish roles of path parameters, query parameters, and body in Props type\n- **HTTP Method Meaning Understanding**: Understand the meaning of each method (POST, GET, PUT, DELETE) in respective business logic\n- **Response Type Mapping**: Understand relationships between Output types and actual business objects\n- **Permission System Analysis**: Understand access permission structure through namespaces like `sellers`, `customers`\n- **API Call Order**: Understand dependency relationships of other APIs that must precede specific API calls\n- **Error Handling Methods**: Predict possible HTTP status codes and error conditions for each API\n\n**SDK Function Example:**\n```typescript\n/**\n * Update a review.\n *\n * Update a {@link IShoppingSaleReview review}\'s content and score.\n *\n * By the way, as is the general policy of this shopping mall regarding\n * articles, modifying a question articles does not actually change the\n * existing content. Modified content is accumulated and recorded in the\n * existing article record as a new\n * {@link IShoppingSaleReview.ISnapshot snapshot}. And this is made public\n * to everyone, including the {@link IShoppingCustomer customer} and the\n * {@link IShoppingSeller seller}, and anyone who can view the article can\n * also view the entire editing histories.\n *\n * This is to prevent customers or sellers from modifying their articles and\n * manipulating the circumstances due to the nature of e-commerce, where\n * disputes easily arise. That is, to preserve evidence.\n *\n * @param props.saleId Belonged sale\'s {@link IShoppingSale.id }\n * @param props.id Target review\'s {@link IShoppingSaleReview.id }\n * @param props.body Update info of the review\n * @returns Newly created snapshot record of the review\n * @tag Sale\n * @author Samchon\n *\n * @controller ShoppingCustomerSaleReviewController.update\n * @path POST /shoppings/customers/sales/:saleId/reviews/:id\n * @nestia Generated by Nestia - https://github.com/samchon/nestia\n */\nexport async function update(\n connection: IConnection,\n props: update.Props,\n): Promise<update.Output> {\n return PlainFetcher.fetch(\n {\n ...connection,\n headers: {\n ...connection.headers,\n "Content-Type": "application/json",\n },\n },\n {\n ...update.METADATA,\n template: update.METADATA.path,\n path: update.path(props),\n },\n props.body,\n );\n}\nexport namespace update {\n export type Props = {\n /**\n * Belonged sale\'s\n */\n saleId: string & Format<"uuid">;\n\n /**\n * Target review\'s\n */\n id: string & Format<"uuid">;\n\n /**\n * Update info of the review\n */\n body: Body;\n };\n export type Body = IShoppingSaleReview.IUpdate;\n export type Output = IShoppingSaleReview.ISnapshot;\n\n export const METADATA = {\n method: "POST",\n path: "/shoppings/customers/sales/:saleId/reviews/:id",\n request: {\n type: "application/json",\n encrypted: false,\n },\n response: {\n type: "application/json",\n encrypted: false,\n },\n status: 201,\n } as const;\n\n export const path = (props: Omit<Props, "body">) =>\n `/shoppings/customers/sales/${encodeURIComponent(props.saleId?.toString() ?? "null")}/reviews/${encodeURIComponent(props.id?.toString() ?? "null")}`;\n}\n```\n\n### 2.4. Random-based Mock E2E Functions\n- Basic templates filled with `typia.random<T>()` for parameters without actual business logic\n- **Guide Role**: Show function call methods, type usage, and import patterns\n- When implementing, refer to this template structure but completely replace the content\n\n**Deep Analysis Requirements:**\n- **Import Pattern Learning**: Understand which paths to import necessary types from and what naming conventions to use\n- **Function Signature Understanding**: Understand the meaning of `connection: api.IConnection` parameter and `Promise<void>` return type\n- **SDK Call Method**: Understand parameter structuring methods when calling API functions and `satisfies` keyword usage patterns\n- **Type Validation Pattern**: Understand `typia.assert()` usage and application timing\n- **Actual Data Requirements**: Understand how to compose actual business-meaningful data to replace `typia.random<T>()`\n- **Code Style Consistency**: Maintain consistency with existing codebase including indentation, variable naming, comment style\n- **Test Function Naming**: Understand existing naming conventions and apply them consistently to new test function names\n\n**Random-based Mock E2E Test Function Example:**\n```typescript\nimport typia from "typia";\nimport type { Format } from "typia/lib/tags/Format";\n\nimport api from "../../../../../src/api";\nimport type { IShoppingSaleReview } from "../../../../../src/api/structures/shoppings/sales/inquiries/IShoppingSaleReview";\n\nexport const test_api_shoppings_customers_sales_reviews_update = async (\n connection: api.IConnection,\n) => {\n const output: IShoppingSaleReview.ISnapshot =\n await api.functional.shoppings.customers.sales.reviews.update(connection, {\n saleId: typia.random<string & Format<"uuid">>(),\n id: typia.random<string & Format<"uuid">>(),\n body: typia.random<IShoppingSaleReview.IUpdate>(),\n });\n typia.assert(output);\n};\n```\n\n**Comprehensive Analysis Approach:**\nThe Agent must understand the **interrelationships** among these 4 input materials beyond analyzing them individually. You must comprehensively understand how business flows required by scenarios can be implemented with DTOs and SDK, and how mock function structures map to actual requirements. Additionally, you must infer **unspecified parts** from given materials and proactively discover **additional elements needed** for complete E2E testing.\n\n## 3. Core Writing Principles\n\n### 3.1. Scenario Adherence Principles\n- **Absolute Principle**: Complete implementation of all steps specified in test scenarios in order\n - If "11 steps" are specified in a scenario, all 11 steps must be implemented\n - Changing step order or skipping steps is **absolutely prohibited**\n - **Prioritize completeness over efficiency**\n- No step in scenarios can be omitted or changed\n - "Seller signs up" → Must call seller signup API\n - "Customer views the product in detail" → Must call product view API\n - More specific step descriptions require more accurate implementation\n- Strictly adhere to logical order and dependencies of business flows\n - Example: Product registration → Signup → Shopping cart → Order → Payment → Delivery → Review creation → Review modification\n - Each step depends on results (IDs, objects, etc.) from previous steps, so order cannot be changed\n - Data dependencies: `sale.id`, `order.id`, `review.id` etc. must be used in subsequent steps\n- **Proactive Scenario Analysis**: Discover and implement essential steps not explicitly mentioned\n - Precisely analyze provided API functions and DTO types\n - Identify intermediate steps needed for business logic completion\n - Add validation steps necessary for data integrity even if not in scenarios\n\n### 3.2. Comment Writing Principles\n- **Required**: Write complete scenarios in JSDoc format at the top of test functions\n- Include scenario background explanation and overall process\n- Clearly document step-by-step numbers and descriptions\n- Explain business context of why such complex processes are necessary\n- **Format**: Use `/** ... */` block comments\n\n### 3.3. Function Naming Conventions\n- **Basic Format**: `test_api_{domain}_{action}_{specific_scenario}`\n- **prefix**: Must start with `test_api_`\n- **domain**: Reflect API endpoint domain and action (e.g., `shopping`, `customer`, `seller`)\n- **scenario**: Express representative name or characteristics of scenario (e.g., `review_update`, `login_failure`)\n- **Examples**: `test_api_shopping_sale_review_update`, `test_api_customer_authenticate_login_failure`\n\n### 3.4. SDK Usage Principles\n- **Required**: All API calls must use provided SDK functions\n- Direct HTTP calls or other methods are **absolutely prohibited**\n- Adhere to exact parameter structure and types of SDK functions\n- Call functions following exact namespace paths (`api.functional.shoppings.sellers...`)\n- **Important**: Use `satisfies` keyword in request body to enhance type safety\n - Example: `body: { ... } satisfies IShoppingSeller.IJoin`\n - Prevent compile-time type errors and support IDE auto-completion\n\n### 3.5. Type Validation Principles\n- **Basic Principle**: Perform `typia.assert(value)` when API response is not `void`\n- Ensure runtime type safety for all important objects and responses\n- Configure tests to terminate immediately upon type validation failure for clear error cause identification\n\n### 3.6. Import Statement Guidelines\nAll E2E test functions must follow these standardized import patterns for consistency and maintainability:\n\n- **typia Library**: \n ```typescript\n import typia from "typia";\n ```\n\n- **API SDK Functions**: \n ```typescript\n import api from "@ORGANIZATION/PROJECT-api";\n ```\n\n- **DTO Types**: \n ```typescript\n import { DtoName } from "@ORGANIZATION/PROJECT-api/lib/structures/DtoName";\n ```\n - Example: `import { IShoppingSeller } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSeller";`\n - Import each DTO type individually with explicit naming\n - Follow the exact path structure: `@ORGANIZATION/PROJECT-api/lib/structures/`\n\n- **Test Validation Utilities**: \n ```typescript\n import { TestValidator } from "@nestia/e2e";\n ```\n\n**Import Organization Requirements:**\n- Group imports in the following order: typia, API SDK, DTO types, TestValidator\n- Maintain alphabetical ordering within each group\n- Use explicit imports rather than wildcard imports for better type safety\n- Ensure all necessary types are imported before function implementation\n- Verify import paths match exactly with the project structure\n\n**Import Example:**\n```typescript\nimport { TestValidator } from "@nestia/e2e";\nimport typia from "typia";\n\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IShoppingCustomer } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCustomer";\nimport { IShoppingSale } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSale";\nimport { IShoppingSeller } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSeller";\n```\n\n## 4. Detailed Implementation Guidelines\n\n### 4.1. API and DTO Analysis Methodology\n- **Priority Analysis**: Systematically analyze all provided API functions and DTO types before implementation\n- **Dependency Understanding**: Understand call order and data dependency relationships between APIs\n- **Type Structure Understanding**: Understand nested structures, required/optional fields, and constraints of DTOs\n- **Business Logic Inference**: Infer actual business flows from API specifications and type definitions\n- **Missing Step Discovery**: Identify steps needed for complete testing but not specified in scenarios\n\n### 4.2. Function Structure\n```typescript\nimport { TestValidator } from "@nestia/e2e";\nimport typia from "typia";\n\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IShoppingCartCommodity } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCartCommodity";\n// ... import all necessary types\n\n/**\n * [Clearly explain test purpose]\n * \n * [Explain business context and necessity]\n * \n * [Step-by-step process]\n * 1. First step\n * 2. Second step\n * ...\n */\nexport async function test_api_{naming_convention}(\n connection: api.IConnection,\n): Promise<void> {\n // Implementation for each step\n}\n```\n\n### 4.3. Variable Declaration and Type Specification\n- Declare each API call result with clear types (`const seller: IShoppingSeller = ...`)\n- Write variable names meaningfully reflecting business domain\n- Use consistent naming convention (camelCase)\n- Prefer explicit type declaration over type inference\n\n### 4.4. API Call Patterns\n- Use exact namespace paths of SDK functions\n- Strictly adhere to parameter object structure\n- Use `satisfies` keyword in request body to enhance type safety\n\n### 4.5. Authentication and Session Management\n- Handle appropriate login/logout when multiple user roles are needed in test scenarios\n- Adhere to API call order appropriate for each role\'s permissions\n- **Important**: Clearly mark account switching points with comments\n- Example: Seller → Customer → Seller account switching\n- Accurately distinguish APIs accessible only after login in respective sessions\n\n### 4.6. Data Consistency Validation\n- Use `TestValidator.equals()` function to validate data consistency\n- Appropriately validate ID matching, state changes, data integrity\n- Confirm accurate structure matching when comparing arrays or objects\n- **Format**: `TestValidator.equals("description")(expected)(actual)`\n- Add descriptions for clear error messages when validation fails\n- **Error Situation Validation**: Use `TestValidator.error()` or `TestValidator.httpError()` for expected errors\n\n## 5. Complete Implementation Example\n\nThe following is a complete example of E2E test function that should actually be written:\n\n```typescript\nimport { TestValidator } from "@nestia/e2e";\nimport typia from "typia";\n\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IShoppingCartCommodity } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCartCommodity";\nimport { IShoppingCustomer } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCustomer";\nimport { IShoppingDelivery } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingDelivery";\nimport { IShoppingOrder } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingOrder";\nimport { IShoppingOrderPublish } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingOrderPublish";\nimport { IShoppingSale } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSale";\nimport { IShoppingSaleReview } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSaleReview";\nimport { IShoppingSeller } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingSeller";\n\n/**\n * Validate the modification of review posts.\n *\n * However, the fact that customers can write review posts in a shopping mall means \n * that the customer has already joined the shopping mall, completed product purchase \n * and payment, and the seller has completed delivery.\n *\n * Therefore, in this test function, all of these must be carried out, so before \n * writing a review post, all of the following preliminary tasks must be performed. \n * It will be quite a long process.\n *\n * 1. Seller signs up\n * 2. Seller registers a product\n * 3. Customer signs up\n * 4. Customer views the product in detail\n * 5. Customer adds the product to shopping cart\n * 6. Customer places a purchase order\n * 7. Customer confirms purchase and makes payment\n * 8. Seller confirms order and processes delivery\n * 9. Customer writes a review post\n * 10. Customer modifies the review post\n * 11. Re-view the review post to confirm modifications.\n */\nexport async function test_api_shopping_sale_review_update(\n connection: api.IConnection,\n): Promise<void> {\n // 1. Seller signs up\n const seller: IShoppingSeller = \n await api.functional.shoppings.sellers.authenticate.join(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n name: "John Doe",\n nickname: "john-doe",\n mobile: "821011112222",\n password: "1234",\n } satisfies IShoppingSeller.IJoin,\n },\n );\n typia.assert(seller);\n\n // 2. Seller registers a product\n const sale: IShoppingSale = \n await api.functional.shoppings.sellers.sales.create(\n connection,\n {\n body: {\n ...\n } satisfies IShoppingSale.ICreate,\n },\n );\n typia.assert(sale);\n\n // 3. Customer signs up\n const customer: IShoppingCustomer = \n await api.functional.shoppings.customers.authenticate.join(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n name: "Jaxtyn",\n nickname: "anonymous",\n mobile: "821033334444",\n password: "1234",\n } satisfies IShoppingCustomer.IJoin,\n },\n );\n typia.assert(customer);\n \n // 4. Customer views the product in detail\n const saleReloaded: IShoppingSale = \n await api.functional.shoppings.customers.sales.at(\n connection,\n {\n id: sale.id,\n },\n );\n typia.assert(saleReloaded);\n TestValidator.equals("sale")(sale.id)(saleReloaded.id);\n\n // 5. Customer adds the product to shopping cart\n const commodity: IShoppingCartCommodity = \n await api.functional.shoppings.customers.carts.commodities.create(\n connection,\n {\n body: {\n sale_id: sale.id,\n stocks: sale.units.map((u) => ({\n unit_id: u.id,\n stock_id: u.stocks[0].id,\n quantity: 1,\n })),\n volume: 1,\n } satisfies IShoppingCartCommodity.ICreate,\n },\n );\n typia.assert(commodity);\n\n // 6. Customer places a purchase order\n const order: IShoppingOrder = \n await api.functional.shoppings.customers.orders.create(\n connection,\n {\n body: {\n goods: [\n {\n commodity_id: commodity.id,\n volume: 1,\n },\n ],\n } satisfies IShoppingOrder.ICreate,\n }\n );\n typia.assert(order);\n\n // 7. Customer confirms purchase and makes payment\n const publish: IShoppingOrderPublish = \n await api.functional.shoppings.customers.orders.publish.create(\n connection,\n {\n orderId: order.id,\n body: {\n address: {\n mobile: "821033334444",\n name: "Jaxtyn",\n country: "South Korea",\n province: "Seoul",\n city: "Seoul Seocho-gu",\n department: "Wrtn Apartment",\n possession: "140-1415",\n zip_code: "08273",\n },\n vendor: {\n code: "@payment-vendor-code",\n uid: "@payment-transaction-uid",\n },\n } satisfies IShoppingOrderPublish.ICreate,\n },\n );\n typia.assert(publish);\n\n // Switch to seller account\n await api.functional.shoppings.sellers.authenticate.login(\n connection,\n {\n body: {\n email: "john@wrtn.io",\n password: "1234",\n } satisfies IShoppingSeller.ILogin,\n },\n );\n\n // 8. Seller confirms order and processes delivery\n const orderReloaded: IShoppingOrder = \n await api.functional.shoppings.sellers.orders.at(\n connection,\n {\n id: order.id,\n }\n );\n typia.assert(orderReloaded);\n TestValidator.equals("order")(order.id)(orderReloaded.id);\n\n const delivery: IShoppingDelivery = \n await api.functional.shoppings.sellers.deliveries.create(\n connection,\n {\n body: {\n pieces: order.goods.map((g) => \n g.commodity.stocks.map((s) => ({\n publish_id: publish.id,\n good_id: g.id,\n stock_id: s.id,\n quantity: 1,\n }))).flat(),\n journeys: [\n {\n type: "delivering",\n title: "Delivering",\n description: null,\n started_at: new Date().toISOString(),\n completed_at: new Date().toISOString(),\n },\n ],\n shippers: [\n {\n company: "Lozen",\n name: "QuickMan",\n mobile: "01055559999",\n }\n ],\n } satisfies IShoppingDelivery.ICreate\n }\n )\n typia.assert(delivery);\n\n // Switch back to customer account\n await api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "anonymous@wrtn.io",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n );\n\n // 9. Customer writes a review post\n const review: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.create(\n connection,\n {\n saleId: sale.id,\n body: {\n good_id: order.goods[0].id,\n title: "Some title",\n body: "Some content body",\n format: "md",\n files: [],\n score: 100,\n } satisfies IShoppingSaleReview.ICreate,\n },\n );\n typia.assert(review);\n\n // 10. Customer modifies the review post\n const snapshot: IShoppingSaleReview.ISnapshot = \n await api.functional.shoppings.customers.sales.reviews.update(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n body: {\n title: "Some new title",\n body: "Some new content body",\n } satisfies IShoppingSaleReview.IUpdate,\n },\n );\n typia.assert(snapshot);\n\n // 11. Re-view the review post to confirm modifications\n const read: IShoppingSaleReview = \n await api.functional.shoppings.customers.sales.reviews.at(\n connection,\n {\n saleId: sale.id,\n id: review.id,\n },\n );\n typia.assert(read);\n TestValidator.equals("snapshots")(read.snapshots)([\n ...review.snapshots,\n snapshot,\n ]);\n}\n```\n\n### 5.1. Implementation Example Commentary\n\n**1. Import Statements**: Explicitly import all necessary types and utilities, accurately referencing package paths in `@ORGANIZATION/PROJECT-api` format and type definitions under `lib/structures/`. Follow the standardized import guidelines with proper grouping and alphabetical ordering.\n\n**2. Comment Structure**: JSDoc comments at the top of functions explain the background and necessity of entire scenarios, specifying detailed 11-step processes with numbers.\n\n**3. Function Name**: `test_api_shopping_sale_review_update` follows naming conventions expressing domain (shopping), entity (sale), function (review), and action (update) in order.\n\n**4. Variable Type Declaration**: Declare each API call result with clear types (`IShoppingSeller`, `IShoppingSale`, etc.) to ensure type safety.\n\n**5. SDK Function Calls**: Use exact namespace paths like `api.functional.shoppings.sellers.authenticate.join` and structure parameters according to SDK definitions.\n\n**6. satisfies Usage**: Use `satisfies` keyword in request body to enhance type safety (`satisfies IShoppingSeller.IJoin`, etc.).\n\n**7. Type Validation**: Apply `typia.assert()` to all API responses to ensure runtime type safety.\n\n**8. Account Switching**: Call login functions at appropriate times for role switching between sellers and customers.\n\n**9. Data Validation**: Use `TestValidator.equals()` to validate ID matching, array state changes, etc.\n\n**10. Complex Data Structures**: Appropriately structure complex nested objects like delivery information and shopping cart products to reflect actual business logic.\n\n## 6. Error Prevention Guidelines\n\n### 6.1. Common Mistake Prevention\n- **Typo Prevention**: Verify accuracy of SDK function paths, type names, property names\n- **Type Consistency**: Ensure consistency between variable type declarations and actual usage\n- **Missing Required Validation**: Verify application of `typia.assert()`\n- **Missing Imports**: Verify import of all necessary types and utilities\n- **Code Style**: Maintain consistent indentation, naming conventions, comment style\n\n### 6.2. Business Logic Validation\n- Adhere to logical order of scenarios\n- Verify fulfillment of essential prerequisites\n- Consider data dependency relationships\n- **State Transition**: Verify proper data state changes in each step\n- **Permission Check**: Verify only appropriate APIs are called for each user role\n\n### 6.3. Type Safety Assurance\n- Perform appropriate type validation on all API responses\n- Use `satisfies` keyword in request body\n- Verify consistency between DTO interfaces and actual data structures\n- **Compile Time**: Utilize TypeScript compiler\'s type checking\n- **Runtime**: Actual data validation through `typia.assert`\n\n## 7. Quality Standards\n\n### 7.1. Completeness\n- All scenario steps implemented without omission\n- Appropriate validation performed for each step\n- Consideration of exceptional situations included\n- **Test Coverage**: Include all major API endpoints\n- **Edge Cases**: Handle possible error situations\n\n### 7.2. Readability\n- Use clear and meaningful variable names\n- Include appropriate comments and explanations\n- Maintain logical code structure and consistent indentation\n- **Step-by-step Comments**: Clearly separate each business step\n- **Code Formatting**: Maintain consistent style and readability\n\n### 7.3. Maintainability\n- Utilize reusable patterns\n- Minimize hardcoded values\n- Design with extensible structure\n- **Modularization**: Implement repetitive logic with clear patterns\n- **Extensibility**: Structure that allows easy addition of new test cases\n\n## 8. Error Scenario Testing (Appendix)\n\n### 8.1. Purpose and Importance of Error Testing\nE2E testing must verify that systems operate correctly not only in normal business flows but also in expected error situations. It\'s important to confirm that appropriate HTTP status codes and error messages are returned in situations like incorrect input, unauthorized access, requests for non-existent resources.\n\n### 8.2. Error Validation Function Usage\n- **TestValidator.error()**: For general error situations where HTTP status code cannot be determined with certainty\n- **TestValidator.httpError()**: When specific HTTP status code can be determined with confidence\n- **Format**: `TestValidator.httpError("description")(statusCode)(() => APICall)`\n\n### 8.3. Error Test Writing Principles\n- **Clear Failure Conditions**: Clearly set conditions that should intentionally fail\n- **Appropriate Test Data**: Simulate realistic error situations like non-existent emails, incorrect passwords\n- **Concise Structure**: Unlike normal flows, compose error tests with minimal steps\n- **Function Naming Convention**: `test_api_{domain}_{action}_failure` or `test_api_{domain}_{action}_{specific_error}`\n- **CRITICAL**: Never use `// @ts-expect-error` comments when testing error cases. These functions test **runtime errors**, not compilation errors. The TypeScript code should compile successfully while the API calls are expected to fail at runtime.\n\n### 8.4. Error Test Example\n\n```typescript\nimport { TestValidator } from "@nestia/e2e";\n\nimport api from "@ORGANIZATION/PROJECT-api";\nimport { IShoppingCustomer } from "@ORGANIZATION/PROJECT-api/lib/structures/IShoppingCustomer";\n\n/**\n * Validate customer login failure.\n * \n * Verify that appropriate error response is returned when attempting \n * to login with a non-existent email address.\n */\nexport async function test_api_customer_authenticate_login_failure(\n connection: api.IConnection,\n): Promise<void> {\n await TestValidator.httpError("login failure")(403)(() =>\n api.functional.shoppings.customers.authenticate.login(\n connection,\n {\n body: {\n email: "never-existing-email@sadfasdfasdf.com",\n password: "1234",\n } satisfies IShoppingCustomer.ILogin,\n },\n ),\n );\n}\n```\n\n### 8.5. Common Error Test Scenarios\n- **Authentication Failure**: Incorrect login information, expired tokens\n- **Permission Error**: Requests for resources without access rights\n- **Resource Not Found**: Attempts to query with non-existent IDs\n- **Validation Failure**: Input of incorrectly formatted data\n- **Duplicate Data**: Signup attempts with already existing emails\n\n### 8.6. Precautions When Writing Error Tests\n- Write error tests as separate independent functions\n- Do not mix with normal flow tests\n- Accurately specify expected HTTP status codes\n- Focus on status codes rather than error message content\n- **IMPORTANT**: Never add `// @ts-expect-error` comments - error validation functions handle runtime errors while maintaining TypeScript type safety\n\n## 9. Final Checklist\n\nE2E test function writing completion requires verification of the following items:\n\n### 9.1. Essential Element Verification\n- [ ] Are all scenario steps implemented in order?\n- [ ] Are complete JSDoc-style comments written?\n- [ ] Does the function name follow naming conventions (`test_api_{domain}_{action}_{scenario}`)?\n- [ ] Are SDK used for all API calls?\n- [ ] Is the `satisfies` keyword used in request body?\n- [ ] Is `typia.assert` applied where necessary?\n- [ ] Are all necessary types imported with correct paths?\n- [ ] Do import statements follow the standardized guidelines (typia, API SDK, DTO types, TestValidator)?\n- [ ] Are error test cases written without `// @ts-expect-error` comments?\n\n### 9.2. Quality Element Verification\n- [ ] Are variable names meaningful and consistent?\n- [ ] Are account switches performed at appropriate times?\n- [ ] Is data validation performed correctly?\n- [ ] Is code structure logical with good readability?\n- [ ] Are error scenarios handled appropriately when needed without TypeScript error suppression comments?\n- [ ] Is business logic completeness guaranteed?\n- [ ] Are imports organized properly with alphabetical ordering within groups?\n\nPlease adhere to all these principles and guidelines to write complete and accurate E2E test functions. Your mission is not simply to write code, but to build a robust test system that perfectly reproduces and validates actual business scenarios.'
|
|
10449
|
+
}, {
|
|
10450
|
+
id: v4(),
|
|
10451
|
+
created_at: (new Date).toISOString(),
|
|
10452
|
+
type: "assistantMessage",
|
|
10453
|
+
text: [ "Here is the list of input material composition.", "", "Make e2e test functions based on the following information.", "", "## Secnario Plan", "```json", JSON.stringify(props.scenario), "```", "", "## DTO Definitions", "```json", JSON.stringify(props.artifacts.dto), "```", "", "## API (SDK) Functions", "```json", JSON.stringify(props.artifacts.sdk), "```", "", "## E2E Mockup Functions", "```json", JSON.stringify(props.artifacts.e2e), "```", "" ].join("\n")
|
|
10454
|
+
} ];
|
|
10455
|
+
|
|
10456
|
+
async function orchestrateTestWrite(ctx, scenarios) {
|
|
10457
|
+
const start = new Date;
|
|
10458
|
+
let complete = 0;
|
|
10459
|
+
const events = await Promise.all(scenarios.map((async scenario => {
|
|
10460
|
+
const code = await process(ctx, scenario);
|
|
10461
|
+
const event = {
|
|
10462
|
+
type: "testWrite",
|
|
10463
|
+
created_at: start.toISOString(),
|
|
10464
|
+
filename: `test/features/api/${code.domain}/${scenario.functionName}.ts`,
|
|
10465
|
+
content: code.content,
|
|
10466
|
+
completed: ++complete,
|
|
10467
|
+
total: scenarios.length,
|
|
10468
|
+
step: ctx.state().interface?.step ?? 0
|
|
10469
|
+
};
|
|
10470
|
+
ctx.dispatch(event);
|
|
10471
|
+
return event;
|
|
10472
|
+
})));
|
|
10473
|
+
return events;
|
|
10474
|
+
}
|
|
10475
|
+
|
|
10476
|
+
async function process(ctx, scenario) {
|
|
10477
|
+
const pointer = {
|
|
10478
|
+
value: null
|
|
10479
|
+
};
|
|
10480
|
+
const artifacts = await compileTestScenario(ctx, scenario);
|
|
10481
|
+
const agentica = new MicroAgentica({
|
|
10482
|
+
model: ctx.model,
|
|
10483
|
+
vendor: ctx.vendor,
|
|
10484
|
+
config: {
|
|
10485
|
+
...ctx.config ?? {}
|
|
10486
|
+
},
|
|
10487
|
+
histories: transformTestWriteHistories({
|
|
10488
|
+
scenario,
|
|
10489
|
+
artifacts
|
|
10490
|
+
}),
|
|
10491
|
+
controllers: [ createApplication({
|
|
10492
|
+
model: ctx.model,
|
|
10493
|
+
build: next => {
|
|
10494
|
+
pointer.value = next;
|
|
10495
|
+
}
|
|
10496
|
+
}) ],
|
|
10497
|
+
tokenUsage: ctx.usage()
|
|
10498
|
+
});
|
|
10499
|
+
enforceToolCall(agentica);
|
|
10500
|
+
await agentica.conversate("Create e2e test functions.");
|
|
10501
|
+
if (pointer.value === null) throw new Error("Failed to create test code.");
|
|
10502
|
+
return pointer.value;
|
|
10503
|
+
}
|
|
10504
|
+
|
|
10505
|
+
function createApplication(props) {
|
|
10506
|
+
assertSchemaModel(props.model);
|
|
10507
|
+
const application = collection$1[props.model];
|
|
10508
|
+
return {
|
|
10509
|
+
protocol: "class",
|
|
10510
|
+
name: "Create Test Code",
|
|
10511
|
+
application,
|
|
10512
|
+
execute: {
|
|
10513
|
+
createTestCode: next => {
|
|
10514
|
+
props.build(next);
|
|
10515
|
+
}
|
|
10516
|
+
}
|
|
10517
|
+
};
|
|
10518
|
+
}
|
|
10519
|
+
|
|
10520
|
+
const claude$1 = {
|
|
10521
|
+
model: "claude",
|
|
10522
|
+
options: {
|
|
10523
|
+
reference: true,
|
|
10524
|
+
separate: null
|
|
10525
|
+
},
|
|
10526
|
+
functions: [ {
|
|
10527
|
+
name: "createTestCode",
|
|
10528
|
+
parameters: {
|
|
10529
|
+
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
10530
|
+
type: "object",
|
|
10531
|
+
properties: {
|
|
10532
|
+
scenario: {
|
|
10533
|
+
title: "Strategic approach for test implementation",
|
|
10534
|
+
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guildelines.",
|
|
10535
|
+
type: "string"
|
|
10536
|
+
},
|
|
10537
|
+
domain: {
|
|
10538
|
+
title: "Functional domain classification for test organization",
|
|
10539
|
+
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system',
|
|
10540
|
+
type: "string"
|
|
10541
|
+
},
|
|
10542
|
+
content: {
|
|
10543
|
+
title: "Complete TypeScript E2E test implementation",
|
|
10544
|
+
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following",
|
|
10545
|
+
type: "string"
|
|
10546
|
+
}
|
|
10547
|
+
},
|
|
10548
|
+
required: [ "scenario", "domain", "content" ],
|
|
10549
|
+
additionalProperties: false,
|
|
10550
|
+
$defs: {}
|
|
10551
|
+
},
|
|
10552
|
+
validate: (() => {
|
|
10553
|
+
const _io0 = input => "string" === typeof input.scenario && "string" === typeof input.domain && "string" === typeof input.content;
|
|
10554
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.scenario || _report(_exceptionable, {
|
|
9994
10555
|
path: _path + ".scenario",
|
|
9995
10556
|
expected: "string",
|
|
9996
10557
|
value: input.scenario
|
|
10558
|
+
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
10559
|
+
path: _path + ".domain",
|
|
10560
|
+
expected: "string",
|
|
10561
|
+
value: input.domain
|
|
10562
|
+
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
10563
|
+
path: _path + ".content",
|
|
10564
|
+
expected: "string",
|
|
10565
|
+
value: input.content
|
|
9997
10566
|
}) ].every((flag => flag));
|
|
9998
10567
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
9999
10568
|
let errors;
|
|
@@ -10004,11 +10573,11 @@ const claude$1 = {
|
|
|
10004
10573
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10005
10574
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10006
10575
|
path: _path + "",
|
|
10007
|
-
expected: "
|
|
10576
|
+
expected: "ICreateTestCodeProps",
|
|
10008
10577
|
value: input
|
|
10009
10578
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10010
10579
|
path: _path + "",
|
|
10011
|
-
expected: "
|
|
10580
|
+
expected: "ICreateTestCodeProps",
|
|
10012
10581
|
value: input
|
|
10013
10582
|
}))(input, "$input", true);
|
|
10014
10583
|
const success = 0 === errors.length;
|
|
@@ -10039,132 +10608,45 @@ const collection$1 = {
|
|
|
10039
10608
|
separate: null
|
|
10040
10609
|
},
|
|
10041
10610
|
functions: [ {
|
|
10042
|
-
name: "
|
|
10611
|
+
name: "createTestCode",
|
|
10043
10612
|
parameters: {
|
|
10044
|
-
description: "
|
|
10613
|
+
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
10045
10614
|
type: "object",
|
|
10046
10615
|
properties: {
|
|
10047
|
-
|
|
10048
|
-
title: "
|
|
10049
|
-
description: "
|
|
10050
|
-
type: "
|
|
10051
|
-
|
|
10052
|
-
|
|
10053
|
-
|
|
10054
|
-
|
|
10055
|
-
|
|
10056
|
-
|
|
10057
|
-
|
|
10058
|
-
|
|
10059
|
-
|
|
10060
|
-
|
|
10061
|
-
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.",
|
|
10062
|
-
type: "string"
|
|
10063
|
-
},
|
|
10064
|
-
method: {
|
|
10065
|
-
title: "HTTP method of the API operation",
|
|
10066
|
-
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",
|
|
10067
|
-
type: "string",
|
|
10068
|
-
enum: [ "get", "post", "put", "delete", "patch" ]
|
|
10069
|
-
}
|
|
10070
|
-
},
|
|
10071
|
-
required: [ "path", "method" ]
|
|
10072
|
-
},
|
|
10073
|
-
scenarios: {
|
|
10074
|
-
title: "Comprehensive collection of user-centric scenarios for the endpoint",
|
|
10075
|
-
description: "Comprehensive collection of user-centric scenarios for the endpoint.\n\nEach scenario represents a realistic user journey, intention, or\nsituation when interacting with this specific API endpoint. All scenarios\nare written from the user's perspective, focusing on what they want to\nachieve and how they naturally interact with the API functionality.\n\n## Scenario Coverage Framework\n\nThe scenarios must comprehensively cover all user interaction patterns:\n\n### 1. Happy Path User Journeys\n\n- Primary business use cases that users commonly perform\n- Standard workflows leading to successful user outcomes\n- Typical user behaviors with valid inputs and proper permissions\n- Most frequent user intentions and expected interactions\n\n### 2. Alternative User Approaches\n\n- Valid alternative ways users might achieve their goals\n- User scenarios utilizing optional parameters or different input patterns\n- Less common but legitimate user behaviors within normal boundaries\n- User experimentation with available API features\n\n### 3. User Error Situations\n\n- Natural user mistakes with input data (incorrect formats, missing fields)\n- User attempts without proper authentication or authorization\n- User actions that violate business rules or constraints\n- User encounters with system limitations (rate limits, quotas)\n\n### 4. Boundary User Behaviors\n\n- User attempts with extreme values (minimum/maximum limits)\n- User submissions with empty, null, or unusual data\n- User inputs with special characters, long strings, or edge cases\n- User interactions testing system boundaries\n\n### 5. Contextual User Situations\n\n- User interactions when resources exist vs. don't exist\n- Different user roles attempting the same actions\n- Time-sensitive user scenarios (expired sessions, scheduled operations)\n- User attempts during various system states\n\n## User-Centric Quality Standards\n\nEach scenario must:\n\n- Focus entirely on user motivation, context, and expected outcomes\n- Describe realistic business situations users actually encounter\n- Include clear user intent and the value they seek\n- Specify user-provided data and user-expected results\n- Be complete within the single endpoint constraint\n- Provide sufficient context for understanding user behavior patterns\n- Avoid technical implementation details or testing terminology\n\n## Single Endpoint Constraint Application\n\nEvery scenario must:\n\n- Complete the entire user journey using only this one endpoint\n- Not depend on or reference other API endpoints\n- Include all necessary context within the scenario itself\n- Represent a complete, self-contained user interaction\n\n## Business Value Focus\n\nThese user scenarios ensure:\n\n- Understanding of real user needs and behaviors\n- Comprehensive coverage of user interaction patterns\n- Proper handling of user errors and edge cases\n- Appropriate user feedback and experience design\n- Business rule validation from user perspective\n- Security and permission handling for different user contexts",
|
|
10076
|
-
type: "array",
|
|
10077
|
-
items: {
|
|
10078
|
-
description: "Current Type: {@link AutoBeTest.Scenario}",
|
|
10079
|
-
type: "object",
|
|
10080
|
-
properties: {
|
|
10081
|
-
functionName: {
|
|
10082
|
-
title: "Descriptive function name derived from the user scenario",
|
|
10083
|
-
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",
|
|
10084
|
-
type: "string"
|
|
10085
|
-
},
|
|
10086
|
-
scenario: {
|
|
10087
|
-
description: "Comprehensive user scenario description written from pure user\nperspective.\n\nThis describes a complete user journey, motivation, and expected outcome\nwhen interacting with the API endpoint. The description focuses entirely\non user intent, context, and natural behavior patterns rather than\ntechnical testing considerations.\n\n## User-Centric Writing Approach\n\n- Write as if describing a real person's experience and motivation\n- Focus on business context and user goals, not system functionality\n- Use natural language that business stakeholders would understand\n- Emphasize user value and expected benefits\n- Avoid technical terminology or implementation details\n\n## Required Content Elements\n\nEach scenario description must include:\n\n### 1. User Context and Motivation\n\n- Who is the user (role, background, current situation)\n- Why they need to perform this action (business motivation)\n- What problem they're trying to solve or goal they want to achieve\n- Any relevant background circumstances or constraints\n\n### 2. User Actions and Behavior\n\n- Specific steps the user takes to accomplish their goal\n- What information or data the user provides\n- How the user naturally approaches the interaction\n- Any decision-making process the user goes through\n\n### 3. User Expectations and Desired Outcomes\n\n- What the user expects to happen as a result\n- How the user will know if they were successful\n- What value or benefit the user expects to receive\n- How this fits into their broader workflow or objectives\n\n### 4. Business Impact and Value\n\n- How this scenario relates to business objectives\n- What business processes or workflows this supports\n- Why this user behavior matters to the organization\n- What risks or opportunities this scenario represents\n\n## Single Endpoint Constraint Integration\n\nEach scenario must:\n\n- Represent a complete user journey achievable through this single endpoint\n- Include all necessary context without referencing other API operations\n- Describe user expectations based solely on this endpoint's capabilities\n- Avoid scenarios that would logically require multiple API calls\n\n## Quality and Realism Standards\n\n- Base scenarios on realistic business situations\n- Include specific, concrete details rather than generic descriptions\n- Ensure scenarios reflect actual user behaviors and motivations\n- Make each scenario distinct and valuable for understanding user needs\n- Provide enough detail to understand full context without being verbose\n\n## User-Focused Example Scenarios\n\n- \"A busy project manager needs to quickly create a new team member's user\n account during an onboarding meeting. They have all the necessary\n information readily available and expect the account to be immediately\n active so the new employee can start working right away.\"\n- \"A customer support representative is helping a customer who forgot their\n login credentials. The customer provides their email address, and the\n representative expects to quickly retrieve the associated account\n information to assist with password recovery.\"\n- \"A system administrator discovers that a former employee's account is\n still active after their departure. They need to immediately deactivate\n this account for security purposes and expect confirmation that the\n account can no longer be used to access company resources.\"\n\n## Language and Tone\n\n- Use active voice and present tense when describing user actions\n- Write in a narrative style that tells the user's story\n- Balance professional tone with human context\n- Ensure accessibility for both technical and non-technical readers\n- Maintain consistency in perspective throughout the description",
|
|
10088
|
-
type: "string"
|
|
10089
|
-
}
|
|
10090
|
-
},
|
|
10091
|
-
required: [ "functionName", "scenario" ]
|
|
10092
|
-
}
|
|
10093
|
-
}
|
|
10094
|
-
},
|
|
10095
|
-
required: [ "endpoint", "scenarios" ]
|
|
10096
|
-
}
|
|
10616
|
+
scenario: {
|
|
10617
|
+
title: "Strategic approach for test implementation",
|
|
10618
|
+
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guildelines.",
|
|
10619
|
+
type: "string"
|
|
10620
|
+
},
|
|
10621
|
+
domain: {
|
|
10622
|
+
title: "Functional domain classification for test organization",
|
|
10623
|
+
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system',
|
|
10624
|
+
type: "string"
|
|
10625
|
+
},
|
|
10626
|
+
content: {
|
|
10627
|
+
title: "Complete TypeScript E2E test implementation",
|
|
10628
|
+
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following",
|
|
10629
|
+
type: "string"
|
|
10097
10630
|
}
|
|
10098
10631
|
},
|
|
10099
|
-
required: [ "
|
|
10632
|
+
required: [ "scenario", "domain", "content" ],
|
|
10100
10633
|
additionalProperties: false,
|
|
10101
10634
|
$defs: {}
|
|
10102
10635
|
},
|
|
10103
|
-
description: "Make user scenarios for the given endpoints.",
|
|
10104
10636
|
validate: (() => {
|
|
10105
|
-
const _io0 = input =>
|
|
10106
|
-
const
|
|
10107
|
-
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
10108
|
-
const _io3 = input => "string" === typeof input.functionName && "string" === typeof input.scenario;
|
|
10109
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10110
|
-
path: _path + ".scenarios",
|
|
10111
|
-
expected: "Array<AutoBeTest.IScenario>",
|
|
10112
|
-
value: input.scenarios
|
|
10113
|
-
})) && input.scenarios.map(((elem, _index3) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10114
|
-
path: _path + ".scenarios[" + _index3 + "]",
|
|
10115
|
-
expected: "AutoBeTest.IScenario",
|
|
10116
|
-
value: elem
|
|
10117
|
-
})) && _vo1(elem, _path + ".scenarios[" + _index3 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10118
|
-
path: _path + ".scenarios[" + _index3 + "]",
|
|
10119
|
-
expected: "AutoBeTest.IScenario",
|
|
10120
|
-
value: elem
|
|
10121
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10122
|
-
path: _path + ".scenarios",
|
|
10123
|
-
expected: "Array<AutoBeTest.IScenario>",
|
|
10124
|
-
value: input.scenarios
|
|
10125
|
-
}) ].every((flag => flag));
|
|
10126
|
-
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10127
|
-
path: _path + ".endpoint",
|
|
10128
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10129
|
-
value: input.endpoint
|
|
10130
|
-
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10131
|
-
path: _path + ".endpoint",
|
|
10132
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10133
|
-
value: input.endpoint
|
|
10134
|
-
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10135
|
-
path: _path + ".scenarios",
|
|
10136
|
-
expected: "Array<AutoBeTest.Scenario>",
|
|
10137
|
-
value: input.scenarios
|
|
10138
|
-
})) && input.scenarios.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10139
|
-
path: _path + ".scenarios[" + _index4 + "]",
|
|
10140
|
-
expected: "AutoBeTest.Scenario",
|
|
10141
|
-
value: elem
|
|
10142
|
-
})) && _vo3(elem, _path + ".scenarios[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10143
|
-
path: _path + ".scenarios[" + _index4 + "]",
|
|
10144
|
-
expected: "AutoBeTest.Scenario",
|
|
10145
|
-
value: elem
|
|
10146
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10147
|
-
path: _path + ".scenarios",
|
|
10148
|
-
expected: "Array<AutoBeTest.Scenario>",
|
|
10149
|
-
value: input.scenarios
|
|
10150
|
-
}) ].every((flag => flag));
|
|
10151
|
-
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
10152
|
-
path: _path + ".path",
|
|
10153
|
-
expected: "string",
|
|
10154
|
-
value: input.path
|
|
10155
|
-
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
10156
|
-
path: _path + ".method",
|
|
10157
|
-
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
10158
|
-
value: input.method
|
|
10159
|
-
}) ].every((flag => flag));
|
|
10160
|
-
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.functionName || _report(_exceptionable, {
|
|
10161
|
-
path: _path + ".functionName",
|
|
10162
|
-
expected: "string",
|
|
10163
|
-
value: input.functionName
|
|
10164
|
-
}), "string" === typeof input.scenario || _report(_exceptionable, {
|
|
10637
|
+
const _io0 = input => "string" === typeof input.scenario && "string" === typeof input.domain && "string" === typeof input.content;
|
|
10638
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.scenario || _report(_exceptionable, {
|
|
10165
10639
|
path: _path + ".scenario",
|
|
10166
10640
|
expected: "string",
|
|
10167
10641
|
value: input.scenario
|
|
10642
|
+
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
10643
|
+
path: _path + ".domain",
|
|
10644
|
+
expected: "string",
|
|
10645
|
+
value: input.domain
|
|
10646
|
+
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
10647
|
+
path: _path + ".content",
|
|
10648
|
+
expected: "string",
|
|
10649
|
+
value: input.content
|
|
10168
10650
|
}) ].every((flag => flag));
|
|
10169
10651
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10170
10652
|
let errors;
|
|
@@ -10175,11 +10657,11 @@ const collection$1 = {
|
|
|
10175
10657
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10176
10658
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10177
10659
|
path: _path + "",
|
|
10178
|
-
expected: "
|
|
10660
|
+
expected: "ICreateTestCodeProps",
|
|
10179
10661
|
value: input
|
|
10180
10662
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10181
10663
|
path: _path + "",
|
|
10182
|
-
expected: "
|
|
10664
|
+
expected: "ICreateTestCodeProps",
|
|
10183
10665
|
value: input
|
|
10184
10666
|
}))(input, "$input", true);
|
|
10185
10667
|
const success = 0 === errors.length;
|
|
@@ -10212,134 +10694,44 @@ const collection$1 = {
|
|
|
10212
10694
|
separate: null
|
|
10213
10695
|
},
|
|
10214
10696
|
functions: [ {
|
|
10215
|
-
name: "
|
|
10697
|
+
name: "createTestCode",
|
|
10216
10698
|
parameters: {
|
|
10217
10699
|
type: "object",
|
|
10218
10700
|
properties: {
|
|
10219
|
-
|
|
10220
|
-
type: "
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10233
|
-
type: "string",
|
|
10234
|
-
enum: [ "get", "post", "put", "delete", "patch" ],
|
|
10235
|
-
title: "HTTP method of the API operation",
|
|
10236
|
-
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"
|
|
10237
|
-
}
|
|
10238
|
-
},
|
|
10239
|
-
required: [ "path", "method" ],
|
|
10240
|
-
description: "Target API endpoint for user scenario generation.\n\nThis represents the single API endpoint that will be analyzed to generate\ncomprehensive user scenarios. The endpoint contains all technical\nspecifications needed to understand user interactions, including HTTP\nmethods, paths, parameters, request/response schemas, and authentication\nrequirements.\n\n## Core Purpose\n\n- Serves as the foundation for user-centric scenario generation\n- Contains complete API specification for understanding user capabilities\n- Provides schema constraints for realistic user data generation\n- Defines authentication and permission requirements for user context\n\n## User Scenario Context\n\nThis endpoint information enables generation of scenarios that consider:\n\n- What users can realistically accomplish with this endpoint\n- How users would naturally interact with the API functionality\n- What business value users seek from this endpoint\n- What constraints and limitations users will encounter\n- How authentication affects user access patterns\n- What data formats users need to provide or expect to receive\n\n## Single Endpoint Constraint\n\nEach scenario generated must interact with ONLY this endpoint. Scenarios\nshould not assume or require calls to other endpoints, ensuring each user\njourney is complete and testable in isolation.\n\n------------------------------\n\nDescription of the current {@link AutoBeOpenApi.IEndpoint} type:\n\n> API endpoint information.",
|
|
10241
|
-
additionalProperties: false
|
|
10242
|
-
},
|
|
10243
|
-
scenarios: {
|
|
10244
|
-
type: "array",
|
|
10245
|
-
items: {
|
|
10246
|
-
type: "object",
|
|
10247
|
-
properties: {
|
|
10248
|
-
functionName: {
|
|
10249
|
-
type: "string",
|
|
10250
|
-
title: "Descriptive function name derived from the user scenario",
|
|
10251
|
-
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"
|
|
10252
|
-
},
|
|
10253
|
-
scenario: {
|
|
10254
|
-
type: "string",
|
|
10255
|
-
description: "Comprehensive user scenario description written from pure user\nperspective.\n\nThis describes a complete user journey, motivation, and expected outcome\nwhen interacting with the API endpoint. The description focuses entirely\non user intent, context, and natural behavior patterns rather than\ntechnical testing considerations.\n\n## User-Centric Writing Approach\n\n- Write as if describing a real person's experience and motivation\n- Focus on business context and user goals, not system functionality\n- Use natural language that business stakeholders would understand\n- Emphasize user value and expected benefits\n- Avoid technical terminology or implementation details\n\n## Required Content Elements\n\nEach scenario description must include:\n\n### 1. User Context and Motivation\n\n- Who is the user (role, background, current situation)\n- Why they need to perform this action (business motivation)\n- What problem they're trying to solve or goal they want to achieve\n- Any relevant background circumstances or constraints\n\n### 2. User Actions and Behavior\n\n- Specific steps the user takes to accomplish their goal\n- What information or data the user provides\n- How the user naturally approaches the interaction\n- Any decision-making process the user goes through\n\n### 3. User Expectations and Desired Outcomes\n\n- What the user expects to happen as a result\n- How the user will know if they were successful\n- What value or benefit the user expects to receive\n- How this fits into their broader workflow or objectives\n\n### 4. Business Impact and Value\n\n- How this scenario relates to business objectives\n- What business processes or workflows this supports\n- Why this user behavior matters to the organization\n- What risks or opportunities this scenario represents\n\n## Single Endpoint Constraint Integration\n\nEach scenario must:\n\n- Represent a complete user journey achievable through this single endpoint\n- Include all necessary context without referencing other API operations\n- Describe user expectations based solely on this endpoint's capabilities\n- Avoid scenarios that would logically require multiple API calls\n\n## Quality and Realism Standards\n\n- Base scenarios on realistic business situations\n- Include specific, concrete details rather than generic descriptions\n- Ensure scenarios reflect actual user behaviors and motivations\n- Make each scenario distinct and valuable for understanding user needs\n- Provide enough detail to understand full context without being verbose\n\n## User-Focused Example Scenarios\n\n- \"A busy project manager needs to quickly create a new team member's user\n account during an onboarding meeting. They have all the necessary\n information readily available and expect the account to be immediately\n active so the new employee can start working right away.\"\n- \"A customer support representative is helping a customer who forgot their\n login credentials. The customer provides their email address, and the\n representative expects to quickly retrieve the associated account\n information to assist with password recovery.\"\n- \"A system administrator discovers that a former employee's account is\n still active after their departure. They need to immediately deactivate\n this account for security purposes and expect confirmation that the\n account can no longer be used to access company resources.\"\n\n## Language and Tone\n\n- Use active voice and present tense when describing user actions\n- Write in a narrative style that tells the user's story\n- Balance professional tone with human context\n- Ensure accessibility for both technical and non-technical readers\n- Maintain consistency in perspective throughout the description"
|
|
10256
|
-
}
|
|
10257
|
-
},
|
|
10258
|
-
required: [ "functionName", "scenario" ],
|
|
10259
|
-
description: "Current Type: {@link AutoBeTest.Scenario}",
|
|
10260
|
-
additionalProperties: false
|
|
10261
|
-
},
|
|
10262
|
-
title: "Comprehensive collection of user-centric scenarios for the endpoint",
|
|
10263
|
-
description: "Comprehensive collection of user-centric scenarios for the endpoint.\n\nEach scenario represents a realistic user journey, intention, or\nsituation when interacting with this specific API endpoint. All scenarios\nare written from the user's perspective, focusing on what they want to\nachieve and how they naturally interact with the API functionality.\n\n## Scenario Coverage Framework\n\nThe scenarios must comprehensively cover all user interaction patterns:\n\n### 1. Happy Path User Journeys\n\n- Primary business use cases that users commonly perform\n- Standard workflows leading to successful user outcomes\n- Typical user behaviors with valid inputs and proper permissions\n- Most frequent user intentions and expected interactions\n\n### 2. Alternative User Approaches\n\n- Valid alternative ways users might achieve their goals\n- User scenarios utilizing optional parameters or different input patterns\n- Less common but legitimate user behaviors within normal boundaries\n- User experimentation with available API features\n\n### 3. User Error Situations\n\n- Natural user mistakes with input data (incorrect formats, missing fields)\n- User attempts without proper authentication or authorization\n- User actions that violate business rules or constraints\n- User encounters with system limitations (rate limits, quotas)\n\n### 4. Boundary User Behaviors\n\n- User attempts with extreme values (minimum/maximum limits)\n- User submissions with empty, null, or unusual data\n- User inputs with special characters, long strings, or edge cases\n- User interactions testing system boundaries\n\n### 5. Contextual User Situations\n\n- User interactions when resources exist vs. don't exist\n- Different user roles attempting the same actions\n- Time-sensitive user scenarios (expired sessions, scheduled operations)\n- User attempts during various system states\n\n## User-Centric Quality Standards\n\nEach scenario must:\n\n- Focus entirely on user motivation, context, and expected outcomes\n- Describe realistic business situations users actually encounter\n- Include clear user intent and the value they seek\n- Specify user-provided data and user-expected results\n- Be complete within the single endpoint constraint\n- Provide sufficient context for understanding user behavior patterns\n- Avoid technical implementation details or testing terminology\n\n## Single Endpoint Constraint Application\n\nEvery scenario must:\n\n- Complete the entire user journey using only this one endpoint\n- Not depend on or reference other API endpoints\n- Include all necessary context within the scenario itself\n- Represent a complete, self-contained user interaction\n\n## Business Value Focus\n\nThese user scenarios ensure:\n\n- Understanding of real user needs and behaviors\n- Comprehensive coverage of user interaction patterns\n- Proper handling of user errors and edge cases\n- Appropriate user feedback and experience design\n- Business rule validation from user perspective\n- Security and permission handling for different user contexts"
|
|
10264
|
-
}
|
|
10265
|
-
},
|
|
10266
|
-
required: [ "endpoint", "scenarios" ],
|
|
10267
|
-
description: "Current Type: {@link AutoBeTest.IScenario}",
|
|
10268
|
-
additionalProperties: false
|
|
10269
|
-
},
|
|
10270
|
-
title: "Array of user scenarios",
|
|
10271
|
-
description: "Array of user scenarios."
|
|
10701
|
+
scenario: {
|
|
10702
|
+
type: "string",
|
|
10703
|
+
title: "Strategic approach for test implementation",
|
|
10704
|
+
description: "Strategic approach for test implementation.\n\nDefine the high-level strategy and logical flow for testing the given\nscenario. Focus on test methodology, data preparation, and assertion\nstrategy.\n\n### Critical Requirements\n\n- Must follow the Test Generation Guildelines.\n- Must Planning the test code Never occur the typescript compile error.\n\n### Planning Elements:\n\n#### Test Methodology\n\n- Identify test scenario type (CRUD operation, authentication flow,\n validation test)\n- Define test data requirements and preparation strategy\n- Plan positive/negative test cases and edge cases\n- Design assertion logic and validation points\n\n#### Execution Strategy\n\n- Outline step-by-step test execution flow\n- Plan error handling and exception plans\n- Define cleanup and teardown procedures\n- Identify dependencies and prerequisites\n\n### Example Plan:\n\n Test Strategy: Article Creation Validation\n 1. Prepare valid article data with required fields\n 2. Execute POST request to create article\n 3. Validate response structure and data integrity\n 4. Test error plans (missing fields, invalid data)\n 5. Verify database state changes\n 6. Reconsider the scenario if it doesn't follow the Test Generation\n Guildelines."
|
|
10705
|
+
},
|
|
10706
|
+
domain: {
|
|
10707
|
+
type: "string",
|
|
10708
|
+
title: "Functional domain classification for test organization",
|
|
10709
|
+
description: 'Functional domain classification for test organization.\n\nDetermines file structure and test categorization based on API\nfunctionality. Used for organizing tests into logical groups and directory\nhierarchies.\n\n### Naming Rules:\n\n- Lowercase English words only\n- Singular nouns (e.g., "article", "user", "comment")\n- Kebab-case for compound words (e.g., "user-profile", "payment-method")\n- Match primary API resource being tested\n- Domain Name must be named only one word.\n\n### Domain Examples:\n\n- `article` → Article management operations\n- `comment` → Comment-related functionality\n- `auth` → Authentication and authorization\n- `user` → User management operations\n- `payment` → Payment processing\n- `notification` → Notification system'
|
|
10710
|
+
},
|
|
10711
|
+
content: {
|
|
10712
|
+
type: "string",
|
|
10713
|
+
title: "Complete TypeScript E2E test implementation",
|
|
10714
|
+
description: "Complete TypeScript E2E test implementation.\n\nGenerate fully functional, compilation-error-free test code following"
|
|
10272
10715
|
}
|
|
10273
10716
|
},
|
|
10274
|
-
required: [ "
|
|
10275
|
-
description: "
|
|
10717
|
+
required: [ "scenario", "domain", "content" ],
|
|
10718
|
+
description: "Current Type: {@link ICreateTestCodeProps}",
|
|
10276
10719
|
additionalProperties: false
|
|
10277
10720
|
},
|
|
10278
|
-
description: "Make user scenarios for the given endpoints.",
|
|
10279
10721
|
validate: (() => {
|
|
10280
|
-
const _io0 = input =>
|
|
10281
|
-
const
|
|
10282
|
-
const _io2 = input => "string" === typeof input.path && ("get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method);
|
|
10283
|
-
const _io3 = input => "string" === typeof input.functionName && "string" === typeof input.scenario;
|
|
10284
|
-
const _vo0 = (input, _path, _exceptionable = true) => [ (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10285
|
-
path: _path + ".scenarios",
|
|
10286
|
-
expected: "Array<AutoBeTest.IScenario>",
|
|
10287
|
-
value: input.scenarios
|
|
10288
|
-
})) && input.scenarios.map(((elem, _index3) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10289
|
-
path: _path + ".scenarios[" + _index3 + "]",
|
|
10290
|
-
expected: "AutoBeTest.IScenario",
|
|
10291
|
-
value: elem
|
|
10292
|
-
})) && _vo1(elem, _path + ".scenarios[" + _index3 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10293
|
-
path: _path + ".scenarios[" + _index3 + "]",
|
|
10294
|
-
expected: "AutoBeTest.IScenario",
|
|
10295
|
-
value: elem
|
|
10296
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10297
|
-
path: _path + ".scenarios",
|
|
10298
|
-
expected: "Array<AutoBeTest.IScenario>",
|
|
10299
|
-
value: input.scenarios
|
|
10300
|
-
}) ].every((flag => flag));
|
|
10301
|
-
const _vo1 = (input, _path, _exceptionable = true) => [ ("object" === typeof input.endpoint && null !== input.endpoint || _report(_exceptionable, {
|
|
10302
|
-
path: _path + ".endpoint",
|
|
10303
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10304
|
-
value: input.endpoint
|
|
10305
|
-
})) && _vo2(input.endpoint, _path + ".endpoint", _exceptionable) || _report(_exceptionable, {
|
|
10306
|
-
path: _path + ".endpoint",
|
|
10307
|
-
expected: "AutoBeOpenApi.IEndpoint",
|
|
10308
|
-
value: input.endpoint
|
|
10309
|
-
}), (Array.isArray(input.scenarios) || _report(_exceptionable, {
|
|
10310
|
-
path: _path + ".scenarios",
|
|
10311
|
-
expected: "Array<AutoBeTest.Scenario>",
|
|
10312
|
-
value: input.scenarios
|
|
10313
|
-
})) && input.scenarios.map(((elem, _index4) => ("object" === typeof elem && null !== elem || _report(_exceptionable, {
|
|
10314
|
-
path: _path + ".scenarios[" + _index4 + "]",
|
|
10315
|
-
expected: "AutoBeTest.Scenario",
|
|
10316
|
-
value: elem
|
|
10317
|
-
})) && _vo3(elem, _path + ".scenarios[" + _index4 + "]", _exceptionable) || _report(_exceptionable, {
|
|
10318
|
-
path: _path + ".scenarios[" + _index4 + "]",
|
|
10319
|
-
expected: "AutoBeTest.Scenario",
|
|
10320
|
-
value: elem
|
|
10321
|
-
}))).every((flag => flag)) || _report(_exceptionable, {
|
|
10322
|
-
path: _path + ".scenarios",
|
|
10323
|
-
expected: "Array<AutoBeTest.Scenario>",
|
|
10324
|
-
value: input.scenarios
|
|
10325
|
-
}) ].every((flag => flag));
|
|
10326
|
-
const _vo2 = (input, _path, _exceptionable = true) => [ "string" === typeof input.path || _report(_exceptionable, {
|
|
10327
|
-
path: _path + ".path",
|
|
10328
|
-
expected: "string",
|
|
10329
|
-
value: input.path
|
|
10330
|
-
}), "get" === input.method || "post" === input.method || "put" === input.method || "delete" === input.method || "patch" === input.method || _report(_exceptionable, {
|
|
10331
|
-
path: _path + ".method",
|
|
10332
|
-
expected: '("delete" | "get" | "patch" | "post" | "put")',
|
|
10333
|
-
value: input.method
|
|
10334
|
-
}) ].every((flag => flag));
|
|
10335
|
-
const _vo3 = (input, _path, _exceptionable = true) => [ "string" === typeof input.functionName || _report(_exceptionable, {
|
|
10336
|
-
path: _path + ".functionName",
|
|
10337
|
-
expected: "string",
|
|
10338
|
-
value: input.functionName
|
|
10339
|
-
}), "string" === typeof input.scenario || _report(_exceptionable, {
|
|
10722
|
+
const _io0 = input => "string" === typeof input.scenario && "string" === typeof input.domain && "string" === typeof input.content;
|
|
10723
|
+
const _vo0 = (input, _path, _exceptionable = true) => [ "string" === typeof input.scenario || _report(_exceptionable, {
|
|
10340
10724
|
path: _path + ".scenario",
|
|
10341
10725
|
expected: "string",
|
|
10342
10726
|
value: input.scenario
|
|
10727
|
+
}), "string" === typeof input.domain || _report(_exceptionable, {
|
|
10728
|
+
path: _path + ".domain",
|
|
10729
|
+
expected: "string",
|
|
10730
|
+
value: input.domain
|
|
10731
|
+
}), "string" === typeof input.content || _report(_exceptionable, {
|
|
10732
|
+
path: _path + ".content",
|
|
10733
|
+
expected: "string",
|
|
10734
|
+
value: input.content
|
|
10343
10735
|
}) ].every((flag => flag));
|
|
10344
10736
|
const __is = input => "object" === typeof input && null !== input && _io0(input);
|
|
10345
10737
|
let errors;
|
|
@@ -10350,11 +10742,11 @@ const collection$1 = {
|
|
|
10350
10742
|
_report = __typia_transform__validateReport._validateReport(errors);
|
|
10351
10743
|
((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _report(true, {
|
|
10352
10744
|
path: _path + "",
|
|
10353
|
-
expected: "
|
|
10745
|
+
expected: "ICreateTestCodeProps",
|
|
10354
10746
|
value: input
|
|
10355
10747
|
})) && _vo0(input, _path + "", true) || _report(true, {
|
|
10356
10748
|
path: _path + "",
|
|
10357
|
-
expected: "
|
|
10749
|
+
expected: "ICreateTestCodeProps",
|
|
10358
10750
|
value: input
|
|
10359
10751
|
}))(input, "$input", true);
|
|
10360
10752
|
const success = 0 === errors.length;
|
|
@@ -10398,10 +10790,9 @@ const orchestrateTest = ctx => async props => {
|
|
|
10398
10790
|
ctx.dispatch(history);
|
|
10399
10791
|
return history;
|
|
10400
10792
|
}
|
|
10401
|
-
const
|
|
10402
|
-
const
|
|
10403
|
-
const
|
|
10404
|
-
const correct = await orchestrateTestCorrect(ctx, codes);
|
|
10793
|
+
const {scenarios} = await orchestrateTestScenario(ctx);
|
|
10794
|
+
const codes = await orchestrateTestWrite(ctx, scenarios);
|
|
10795
|
+
const correct = await orchestrateTestCorrect(ctx, codes, scenarios);
|
|
10405
10796
|
const history = {
|
|
10406
10797
|
type: "test",
|
|
10407
10798
|
id: v4(),
|
|
@@ -10415,7 +10806,10 @@ const orchestrateTest = ctx => async props => {
|
|
|
10415
10806
|
ctx.dispatch({
|
|
10416
10807
|
type: "testComplete",
|
|
10417
10808
|
created_at: start.toISOString(),
|
|
10418
|
-
files: correct.files
|
|
10809
|
+
files: correct.files.map((f => ({
|
|
10810
|
+
[f.location]: f.content
|
|
10811
|
+
}))).reduce(((acc, cur) => Object.assign(acc, cur)), {}),
|
|
10812
|
+
compiled: correct.result,
|
|
10419
10813
|
step: ctx.state().interface?.step ?? 0
|
|
10420
10814
|
});
|
|
10421
10815
|
ctx.state().test = history;
|
|
@@ -11835,29 +12229,30 @@ function emplaceMap(dict, key, generator) {
|
|
|
11835
12229
|
|
|
11836
12230
|
class AutoBeAgent {
|
|
11837
12231
|
constructor(props) {
|
|
11838
|
-
this.
|
|
12232
|
+
this.props_ = props;
|
|
11839
12233
|
this.histories_ = props.histories?.slice() ?? [];
|
|
11840
12234
|
this.state_ = createAutoBeState(this.histories_);
|
|
12235
|
+
this.listeners_ = new Map;
|
|
12236
|
+
const vendor = {
|
|
12237
|
+
...props.vendor,
|
|
12238
|
+
semaphore: new Semaphore(props.vendor.semaphore ?? 16)
|
|
12239
|
+
};
|
|
11841
12240
|
this.context_ = {
|
|
12241
|
+
vendor,
|
|
11842
12242
|
model: props.model,
|
|
11843
|
-
vendor: props.vendor,
|
|
11844
12243
|
config: props.config,
|
|
11845
12244
|
compiler: props.compiler,
|
|
11846
12245
|
histories: () => this.histories_,
|
|
11847
12246
|
state: () => this.state_,
|
|
11848
12247
|
usage: () => this.agentica_.getTokenUsage(),
|
|
11849
|
-
files:
|
|
12248
|
+
files: options => this.getFiles(options),
|
|
11850
12249
|
dispatch: event => {
|
|
11851
12250
|
this.dispatch(event).catch((() => {}));
|
|
11852
12251
|
}
|
|
11853
12252
|
};
|
|
11854
|
-
this.listeners_ = new Map;
|
|
11855
12253
|
this.agentica_ = new MicroAgentica({
|
|
12254
|
+
vendor,
|
|
11856
12255
|
model: props.model,
|
|
11857
|
-
vendor: {
|
|
11858
|
-
...props.vendor,
|
|
11859
|
-
semaphore: new Semaphore(props.vendor.semaphore ?? 16)
|
|
11860
|
-
},
|
|
11861
12256
|
config: {
|
|
11862
12257
|
...props.config ?? {},
|
|
11863
12258
|
executor: {
|
|
@@ -11898,21 +12293,10 @@ class AutoBeAgent {
|
|
|
11898
12293
|
}
|
|
11899
12294
|
clone() {
|
|
11900
12295
|
return new AutoBeAgent({
|
|
11901
|
-
...this.
|
|
12296
|
+
...this.props_,
|
|
11902
12297
|
histories: this.histories_.slice()
|
|
11903
12298
|
});
|
|
11904
12299
|
}
|
|
11905
|
-
on(type, listener) {
|
|
11906
|
-
emplaceMap(this.listeners_, type, (() => new Set)).add(listener);
|
|
11907
|
-
return this;
|
|
11908
|
-
}
|
|
11909
|
-
off(type, listener) {
|
|
11910
|
-
const set = this.listeners_.get(type);
|
|
11911
|
-
if (set === undefined) return this;
|
|
11912
|
-
set.delete(listener);
|
|
11913
|
-
if (set.size === 0) this.listeners_.delete(type);
|
|
11914
|
-
return this;
|
|
11915
|
-
}
|
|
11916
12300
|
async conversate(content) {
|
|
11917
12301
|
const index = this.histories_.length;
|
|
11918
12302
|
const userMessageHistory = {
|
|
@@ -11929,13 +12313,13 @@ class AutoBeAgent {
|
|
|
11929
12313
|
await this.agentica_.conversate(content);
|
|
11930
12314
|
return this.histories_.slice(index);
|
|
11931
12315
|
}
|
|
11932
|
-
getFiles() {
|
|
12316
|
+
async getFiles(options) {
|
|
11933
12317
|
const files = {
|
|
11934
12318
|
...Object.fromEntries(this.state_.analyze ? Object.entries(this.state_.analyze.files).map((([key, value]) => [ `docs/analysis/${key.split("/").at(-1)}`, value ])) : []),
|
|
11935
|
-
...Object.fromEntries(this.state_.prisma?.result
|
|
12319
|
+
...Object.fromEntries(!!this.state_.prisma?.result ? [ ...Object.entries((options?.dbms ?? "postgres") === "postgres" ? this.state_.prisma.schemas : await this.context_.compiler.prisma.write(this.state_.prisma.result.data, options.dbms)).map((([key, value]) => [ `prisma/schema/${key.split("/").at(-1)}`, value ])), ...this.state_.prisma.compiled.type === "success" ? [ [ "docs/ERD.md", this.state_.prisma.compiled.document ] ] : [], ...this.state_.prisma.compiled.type === "failure" ? [ [ "prisma/compile-error-reason.log", this.state_.prisma.compiled.reason ] ] : [], [ "autobe/prisma.json", JSON.stringify(this.state_.prisma.result.data, null, 2) ] ] : []),
|
|
11936
12320
|
...this.state_.interface ? this.state_.interface.files : {},
|
|
11937
|
-
...this.state_.test
|
|
11938
|
-
...this.state_.realize
|
|
12321
|
+
...this.state_.test ? Object.fromEntries(this.state_.test.files.map((f => [ f.location, f.content ]))) : {},
|
|
12322
|
+
...this.state_.realize ? this.state_.realize.files : {},
|
|
11939
12323
|
"autobe/histories.json": JSON.stringify(this.histories_, null, 2),
|
|
11940
12324
|
"autobe/tokenUsage.json": JSON.stringify(this.getTokenUsage(), null, 2),
|
|
11941
12325
|
...this.state_.interface ? {
|
|
@@ -11953,6 +12337,17 @@ class AutoBeAgent {
|
|
|
11953
12337
|
getContext() {
|
|
11954
12338
|
return this.context_;
|
|
11955
12339
|
}
|
|
12340
|
+
on(type, listener) {
|
|
12341
|
+
emplaceMap(this.listeners_, type, (() => new Set)).add(listener);
|
|
12342
|
+
return this;
|
|
12343
|
+
}
|
|
12344
|
+
off(type, listener) {
|
|
12345
|
+
const set = this.listeners_.get(type);
|
|
12346
|
+
if (set === undefined) return this;
|
|
12347
|
+
set.delete(listener);
|
|
12348
|
+
if (set.size === 0) this.listeners_.delete(type);
|
|
12349
|
+
return this;
|
|
12350
|
+
}
|
|
11956
12351
|
async dispatch(event) {
|
|
11957
12352
|
const set = this.listeners_.get(event.type);
|
|
11958
12353
|
if (set === undefined) return;
|
|
@@ -11966,43 +12361,9 @@ class AutoBeAgent {
|
|
|
11966
12361
|
|
|
11967
12362
|
var AutoBeTokenUsage = AgenticaTokenUsage;
|
|
11968
12363
|
|
|
11969
|
-
function invertOpenApiDocument(document) {
|
|
11970
|
-
const app = HttpMigration.application(document);
|
|
11971
|
-
return {
|
|
11972
|
-
operations: app.routes.filter((r => r.query === null)).map((r => ({
|
|
11973
|
-
specification: empty("specification"),
|
|
11974
|
-
method: r.method,
|
|
11975
|
-
path: r.path,
|
|
11976
|
-
summary: r.operation().summary ?? empty("summary"),
|
|
11977
|
-
description: r.operation().description ?? empty("description"),
|
|
11978
|
-
parameters: r.parameters.map((p => ({
|
|
11979
|
-
name: p.name,
|
|
11980
|
-
description: p.parameter().description ?? empty("description"),
|
|
11981
|
-
schema: p.schema
|
|
11982
|
-
}))),
|
|
11983
|
-
requestBody: r.body?.type === "application/json" && OpenApiTypeChecker.isReference(r.body.schema) ? {
|
|
11984
|
-
description: r.body.description() ?? empty("description"),
|
|
11985
|
-
typeName: r.body.schema.$ref.split("/").pop()
|
|
11986
|
-
} : null,
|
|
11987
|
-
responseBody: r.success?.type === "application/json" && OpenApiTypeChecker.isReference(r.success.schema) ? {
|
|
11988
|
-
description: r.success.description() ?? empty("description"),
|
|
11989
|
-
typeName: r.success.schema.$ref.split("/").pop()
|
|
11990
|
-
} : null
|
|
11991
|
-
}))),
|
|
11992
|
-
components: {
|
|
11993
|
-
schemas: document.components?.schemas ?? {}
|
|
11994
|
-
}
|
|
11995
|
-
};
|
|
11996
|
-
}
|
|
11997
|
-
|
|
11998
|
-
function empty(key) {
|
|
11999
|
-
return `Describe ${key} as much as possible with clear and concise words.`;
|
|
12000
|
-
}
|
|
12001
|
-
|
|
12002
12364
|
var index$1 = Object.freeze({
|
|
12003
12365
|
__proto__: null,
|
|
12004
|
-
createAgenticaHistory
|
|
12005
|
-
invertOpenApiDocument
|
|
12366
|
+
createAgenticaHistory
|
|
12006
12367
|
});
|
|
12007
12368
|
|
|
12008
12369
|
var index = Object.freeze({
|