Skip to content

Commit 5351cd2

Browse files
committed
correct handling execution of tests if multiple paths are specified
1 parent 033cbc1 commit 5351cd2

File tree

3 files changed

+33
-6
lines changed

3 files changed

+33
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ All notable changes to the "robotcode" extension will be documented in this file
44

55
## [Unreleased]
66

7-
- none so far
7+
### added
8+
- Introduce setting `robotcode.robot.paths` and correspondend launch config property `paths`
9+
- Specifies the paths where robot/robotcode should discover test suites. Corresponds to the 'paths' option of robot
810

911
## 0.9.6
1012

@@ -45,8 +47,6 @@ All notable changes to the "robotcode" extension will be documented in this file
4547

4648
### added
4749

48-
- Introduce setting `robotcode.robot.paths` and correspondend launch config property `paths`
49-
- Specifies the paths where robot/robotcode should discover test suites. Corresponds to the 'paths' option of robot
5050
- Introduce setting `robotcode.robot.variableFiles` and correspondend launch config property `variableFiles`
5151
- Specifies the variable files for robotframework. Corresponds to the '--variablefile' option of robot.
5252
- Rework debugger termination

vscode-client/debugmanager.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,18 @@ export class DebugManager {
347347
excluded: string[],
348348
runId?: string,
349349
options?: vscode.DebugSessionOptions,
350-
dryRun?: boolean
350+
dryRun?: boolean,
351+
topLevelSuiteName?: string
351352
): Promise<void> {
352353
const config = vscode.workspace.getConfiguration(CONFIG_SECTION, folder);
353354

354355
const args = [];
355356

357+
if (topLevelSuiteName) {
358+
args.push("--name");
359+
args.push(topLevelSuiteName);
360+
}
361+
356362
for (const s of suites) {
357363
args.push("--suite");
358364
args.push(s);

vscode-client/testcontrollermanager.ts

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,12 @@ export class TestControllerManager {
659659
};
660660
}
661661

662-
const workspaceItem = this.findTestItemByUri(workspace.uri.toString());
662+
let workspaceItem = this.findTestItemByUri(workspace.uri.toString());
663+
const workspaceRobotItem = workspaceItem ? this.findRobotItem(workspaceItem) : undefined;
664+
665+
if (workspaceRobotItem?.type == "workspace" && workspaceRobotItem.children?.length) {
666+
workspaceItem = workspaceItem?.children.get(workspaceRobotItem.children[0].id);
667+
}
663668

664669
if (includedItems.length === 1 && includedItems[0] === workspaceItem && excluded.size === 0) {
665670
await DebugManager.runTests(workspace, [], [], [], runId, options, dryRun);
@@ -686,7 +691,23 @@ export class TestControllerManager {
686691
if (longname) suites.add(longname);
687692
}
688693
}
689-
await DebugManager.runTests(workspace, Array.from(suites), includedInWs, excludedInWs, runId, options, dryRun);
694+
695+
let suiteName: string | undefined = undefined;
696+
697+
if (workspaceRobotItem?.type == "workspace" && workspaceRobotItem.children?.length) {
698+
suiteName = workspaceRobotItem.children[0].longname;
699+
}
700+
701+
await DebugManager.runTests(
702+
workspace,
703+
Array.from(suites),
704+
includedInWs,
705+
excludedInWs,
706+
runId,
707+
options,
708+
dryRun,
709+
suiteName
710+
);
690711
}
691712
}
692713
}

0 commit comments

Comments
 (0)