Skip to content

Commit ad5dcbe

Browse files
JoshwinThomasIBMJoshwinThomasIBM
authored andcommitted
Added test cases for viewing latest test reports when all the reports exists
1 parent ad9faee commit ad5dcbe

File tree

4 files changed

+44
-2
lines changed

4 files changed

+44
-2
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@
137137
"command": "liberty.dev.open.gradle.test.report",
138138
"category": "Liberty",
139139
"title": "%commands.title.view.test.report%"
140+
},
141+
{
142+
"command": "extension.printMessage",
143+
"category": "Liberty",
144+
"title": "Print Message"
140145
}
141146
],
142147
"menus": {

src/extension.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ let jakartaClient: LanguageClient;
3232
export type JavaExtensionAPI = any;
3333

3434
const SUPPORTED_LANGUAGE_IDS = ["java-properties", "properties", "plaintext"];
35+
export let outputChannel: vscode.OutputChannel;
3536
export async function activate(context: vscode.ExtensionContext): Promise<void> {
3637

3738
/**
@@ -166,6 +167,15 @@ function registerCommands(context: ExtensionContext) {
166167
context.subscriptions.push(vscode.workspace.onDidChangeWorkspaceFolders((event) => {
167168
projectProvider.refresh();
168169
}));
170+
171+
// Create an Output Channel named "My Extension Output"
172+
outputChannel = vscode.window.createOutputChannel('My Extension Output');
173+
// Example: Register a command to print a value when executed
174+
let disposable = vscode.commands.registerCommand('extension.printMessage', (message:string) => {
175+
outputChannel.appendLine(message);
176+
});
177+
// Add the disposable command to subscriptions
178+
context.subscriptions.push(disposable);
169179
}
170180

171181
// this method is called when your extension is deactivated

src/liberty/devCommands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { getGradleTestReport } from "../util/gradleUtil";
2121
import { DashboardData } from "./dashboard";
2222
import { ProjectStartCmdParam } from "./projectStartCmdParam";
2323
import { getCommandForMaven, getCommandForGradle, defaultWindowsShell } from "../util/commandUtils";
24+
import { outputChannel } from "../extension";
2425

2526
export const terminals: { [libProjectId: number]: LibertyProject } = {};
2627

@@ -560,6 +561,8 @@ function checkReportAndDisplay(report: any, reportType: string, reportTypeLabel:
560561
{}, // Webview options
561562
);
562563
panel.webview.html = getReport(report); // display HTML content
564+
outputChannel.clear();
565+
outputChannel.appendLine(reportType+" path is "+report);
563566
/*
564567
For Maven projects we need to check for the test report in the 'reports' and 'site' dirs.
565568
We only need to show the message if it is not available in both locations.

src/test/MavenTestDevModeActions.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
* SPDX-License-Identifier: EPL-2.0
99
*/
1010
import { expect } from 'chai';
11-
import { InputBox, Workbench,SideBarView, ViewItem, ViewSection,EditorView, DefaultTreeItem , DebugView, VSBrowser } from 'vscode-extension-tester';
11+
import { InputBox, Workbench,SideBarView, ViewItem, ViewSection,EditorView, DefaultTreeItem , DebugView, VSBrowser, BottomBarPanel } from 'vscode-extension-tester';
1212
import * as utils from './utils/testUtils';
1313
import * as constants from './definitions/constants';
1414
import path = require('path');
1515
import * as fs from 'fs';
16-
16+
import { assert } from 'console';
1717
describe('Devmode action tests for Maven Project', () => {
1818
let sidebar: SideBarView;
1919
let debugView: DebugView;
@@ -284,6 +284,30 @@ it('check all test reports exists', async () => {
284284
expect(existenceResults.every(result => result === true)).to.be.true;
285285
}).timeout(10000);
286286

287+
it('View latest Unit test report when all the reports exists',async () =>{
288+
const outputView = await new BottomBarPanel().openOutputView();
289+
outputView.clearText();
290+
await utils.launchDashboardAction(item,constants.UTR_DASHABOARD_ACTION, constants.UTR_DASHABOARD_MAC_ACTION);
291+
utils.delay(5000);
292+
await outputView.selectChannel("My Extension Output");
293+
const text = await outputView.getText();
294+
assert(text.includes('/target/reports/surefire.html'));
295+
await utils.closeEditor();
296+
297+
}).timeout(20000);
298+
299+
it('View latest Integration test report when all the reports exists',async () =>{
300+
301+
const outputView = await new BottomBarPanel().openOutputView();
302+
outputView.clearText();
303+
await utils.launchDashboardAction(item, constants.ITR_DASHBOARD_ACTION, constants.ITR_DASHBOARD_MAC_ACTION);
304+
utils.delay(5000);
305+
await outputView.selectChannel("My Extension Output");
306+
const text = await outputView.getText();
307+
assert(text.includes('/target/reports/failsafe.html'));
308+
await utils.closeEditor();
309+
}).timeout(20000);
310+
287311

288312
it('View Unit test report for maven project with surefire 3.4.0', async () => {
289313

0 commit comments

Comments
 (0)