grafana / k6-template-typescript

Template to use TypeScript with k6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

PavanMudigondaTR opened this issue · 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.

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 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).