diff --git a/client/src/planemo/testing/testRunner.ts b/client/src/planemo/testing/testRunner.ts index d01c5bd..1363d6e 100644 --- a/client/src/planemo/testing/testRunner.ts +++ b/client/src/planemo/testing/testRunner.ts @@ -26,12 +26,17 @@ export class PlanemoTestRunner implements ITestRunner { const testFile = testSuite.file ? testSuite.file : `${planemoConfig.getCwd()}/${testSuiteId}.${Constants.TOOL_DOCUMENT_EXTENSION}`; try { const { file: output_json_file, cleanupCallback } = await this.getJsonReportPath(testFile); + const htmlReportFile = this.getTestHtmlReportFilePath(testFile); const testRunArguments = [ `test`, - `--galaxy_root=${planemoConfig.galaxyRoot()}`, - `--test_output_json=${output_json_file}`, - testFile, + `--galaxy_root`, + `${planemoConfig.galaxyRoot()}`, + `--test_output_json`, + `${output_json_file}`, + `--test_output`, + `${htmlReportFile}`, + `${testFile}`, ] const testExecution = this.runPlanemoTest(planemoConfig, testRunArguments); @@ -39,7 +44,7 @@ export class PlanemoTestRunner implements ITestRunner { this.testExecutions.set(testSuiteId, testExecution); await testExecution.complete(); - const states = await parseTestStates(output_json_file, testSuite); + const states = await parseTestStates(output_json_file, testSuite, htmlReportFile); cleanupCallback(); @@ -98,4 +103,11 @@ export class PlanemoTestRunner implements ITestRunner { }); }); } + + private getTestHtmlReportFilePath(testFile: string): string { + const baseDir = path.dirname(testFile); + const testFileName = path.basename(testFile, Constants.TOOL_DOCUMENT_EXTENSION).replace(".", ""); + const reportFile = path.resolve(baseDir, `${testFileName}_test_report.html`); + return reportFile; + } } diff --git a/client/src/planemo/testing/testsReportParser.ts b/client/src/planemo/testing/testsReportParser.ts index e2d5ea8..5b03c5b 100644 --- a/client/src/planemo/testing/testsReportParser.ts +++ b/client/src/planemo/testing/testsReportParser.ts @@ -46,13 +46,13 @@ interface ITestCaseJobInfo { tool_stdout: string; } -export async function parseTestStates(outputJsonFile: string, testSuite: TestSuiteInfo): Promise { +export async function parseTestStates(outputJsonFile: string, testSuite: TestSuiteInfo, htmlReportFile: string): Promise { const content = await readFile(outputJsonFile); const parseResult = await JSON.parse(content); - return parseTestResults(parseResult, testSuite); + return parseTestResults(parseResult, testSuite, htmlReportFile); } -function parseTestResults(parserResult: any, testSuite: TestSuiteInfo): TestEvent[] { +function parseTestResults(parserResult: any, testSuite: TestSuiteInfo, htmlReportFile: string): TestEvent[] { if (!parserResult) { return []; } @@ -63,6 +63,7 @@ function parseTestResults(parserResult: any, testSuite: TestSuiteInfo): TestEven const testInfo = getTestInfo(testCaseResult, testSuite); const adatedResult = adaptTestResult(testCaseResult, testInfo); if (adatedResult !== undefined) { + adatedResult.message += `${EOL}${EOL}See full test report: ${htmlReportFile}`; testResults.push(adatedResult); } });