k6-template-typescript icon indicating copy to clipboard operation
k6-template-typescript copied to clipboard

Query: Please clarify how to configure various reports in this template ?

Open PavanMudigondaTR opened this issue 1 year ago • 2 comments

Could you please clarify how to configure various reports in this template ? Can I set them to template level rather than at each test case level.

PavanMudigondaTR avatar Aug 10 '22 18:08 PavanMudigondaTR

Hi @PavanMudigondaTR.

I'm not sure I understand the question and how it relates specifically to k6-template-typescript. What do you mean by a "template-level" report?

If you're wondering what the code for handleSummary might look like in TypeScript, you can use something like this as mentioned in this blog post:

/* Customizes the end-of-test summary report */
export function handleSummary(data: JSONObject): JSONObject {
	const ret: JSONObject = {
		stdout: textSummary(data, { indent: ' ', enableColors: true }),
	}
	if (!!__ENV.RESULTS_PATH) {
		const jUnitResultFile = `${__ENV.RESULTS_PATH}/results.xml`
		const logResultFile = `${__ENV.RESULTS_PATH}/results.log`
		ret[jUnitResultFile] = jUnit(data)
		ret[logResultFile] = textSummary(data, { indent: ' ', enableColors: false })
	}
	return ret
}

tom-miseur avatar Aug 11 '22 03:08 tom-miseur

@tom-miseur I was trying to understand how test results get reported when I have say 100 test cases. Is it possible to run all tests at once and get one report of each type (xml, log, html report).

PavanMudigondaTR avatar Aug 11 '22 12:08 PavanMudigondaTR