Skip to content

Commit e2e1454

Browse files
Merge pull request #67 from salesforcecli/mdonnalley/gen-test-spec
feat(W-17671338): use spec file for tests
2 parents e8843d4 + e79593b commit e2e1454

File tree

17 files changed

+334
-337
lines changed

17 files changed

+334
-337
lines changed

command-snapshot.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,7 @@
7474
},
7575
{
7676
"alias": [],
77-
"command": "agent:generate:test-cases",
78-
"flagAliases": [],
79-
"flagChars": [],
80-
"flags": ["flags-dir"],
81-
"plugin": "@salesforce/plugin-agent"
82-
},
83-
{
84-
"alias": [],
85-
"command": "agent:generate:test-definition",
77+
"command": "agent:generate:test-spec",
8678
"flagAliases": [],
8779
"flagChars": [],
8880
"flags": ["flags-dir"],
@@ -104,6 +96,14 @@
10496
"flags": ["api-version", "flags-dir", "job-id", "json", "target-org", "use-most-recent"],
10597
"plugin": "@salesforce/plugin-agent"
10698
},
99+
{
100+
"alias": [],
101+
"command": "agent:test:create",
102+
"flagAliases": [],
103+
"flagChars": ["o", "p", "s"],
104+
"flags": ["api-version", "flags-dir", "json", "no-prompt", "preview", "spec", "target-org"],
105+
"plugin": "@salesforce/plugin-agent"
106+
},
107107
{
108108
"alias": [],
109109
"command": "agent:test:list",

messages/agent.generate.test-cases.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

messages/agent.generate.test-definition.md

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# summary
2+
3+
Interactively generate a specification file for a AI evaluation test.
4+
5+
# description
6+
7+
This command will prompt you for the necessary information to create a new spec file (in yaml format). You can then create a new AI evaluation using "sf agent test create --spec <spec-file>".
8+
9+
# examples
10+
11+
- <%= config.bin %> <%= command.id %>

messages/agent.test.create.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# summary
2+
3+
Summary of a command.
4+
5+
# description
6+
7+
More information about a command. Don't repeat the summary.
8+
9+
# flags.spec.summary
10+
11+
Description of a flag.
12+
13+
# flags.spec.description
14+
15+
More information about a flag. Don't repeat the summary.
16+
17+
# flags.preview.summary
18+
19+
Preview the test metadata without deploying to your org.
20+
21+
# flags.no-prompt.summary
22+
23+
Don't prompt for confirmation when overwriting an existing test.
24+
25+
# examples
26+
27+
- <%= config.bin %> <%= command.id %>

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
"@inquirer/prompts": "^7.2.0",
1010
"@oclif/core": "^4",
1111
"@oclif/multi-stage-output": "^0.7.12",
12-
"@salesforce/agents": "^0.8.0",
12+
"@salesforce/agents": "^0.9.0",
1313
"@salesforce/core": "^8.8.0",
1414
"@salesforce/kit": "^3.2.1",
1515
"@salesforce/sf-plugins-core": "^12.1.0",
16+
"@salesforce/source-deploy-retrieve": "^12.14.0",
1617
"ansis": "^3.3.2",
1718
"fast-xml-parser": "^4.5.1",
1819
"ink": "^5.0.1",
@@ -77,6 +78,9 @@
7778
},
7879
"generate": {
7980
"external": true
81+
},
82+
"create": {
83+
"external": true
8084
}
8185
}
8286
}

schemas/agent-test-create.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$ref": "#/definitions/AgentTestCreateResult",
4+
"definitions": {
5+
"AgentTestCreateResult": {
6+
"type": "object",
7+
"properties": {
8+
"path": {
9+
"type": "string"
10+
},
11+
"contents": {
12+
"type": "string"
13+
}
14+
},
15+
"required": ["path", "contents"],
16+
"additionalProperties": false
17+
}
18+
}
19+
}

schemas/agent-test-results.json

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,33 @@
4545
},
4646
"TestStatus": {
4747
"type": "string",
48-
"enum": ["New", "InProgress", "Completed", "Error"]
48+
"enum": ["NEW", "IN_PROGRESS", "COMPLETED", "ERROR", "TERMINATED"]
4949
},
5050
"TestCaseResult": {
5151
"type": "object",
5252
"properties": {
5353
"status": {
5454
"$ref": "#/definitions/TestStatus"
5555
},
56-
"utterance": {
57-
"type": "string"
58-
},
5956
"startTime": {
6057
"type": "string"
6158
},
6259
"endTime": {
6360
"type": "string"
6461
},
62+
"inputs": {
63+
"type": "object",
64+
"properties": {
65+
"utterance": {
66+
"type": "string"
67+
}
68+
},
69+
"required": ["utterance"],
70+
"additionalProperties": false
71+
},
6572
"generatedData": {
6673
"type": "object",
6774
"properties": {
68-
"type": {
69-
"type": "string",
70-
"const": "AGENT"
71-
},
7275
"actionsSequence": {
7376
"type": "array",
7477
"items": {
@@ -80,18 +83,12 @@
8083
},
8184
"topic": {
8285
"type": "string"
83-
},
84-
"inputTokensCount": {
85-
"type": "string"
86-
},
87-
"outputTokensCount": {
88-
"type": "string"
8986
}
9087
},
91-
"required": ["type", "actionsSequence", "outcome", "topic", "inputTokensCount", "outputTokensCount"],
88+
"required": ["actionsSequence", "outcome", "topic"],
9289
"additionalProperties": false
9390
},
94-
"expectationResults": {
91+
"testResults": {
9592
"type": "array",
9693
"items": {
9794
"type": "object",
@@ -150,7 +147,7 @@
150147
}
151148
}
152149
},
153-
"required": ["status", "utterance", "startTime", "generatedData", "expectationResults"],
150+
"required": ["status", "startTime", "inputs", "generatedData", "testResults"],
154151
"additionalProperties": false
155152
}
156153
}

src/commands/agent/generate/test-definition.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

0 commit comments

Comments
 (0)