Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define handleSummary and teardown across multiple scripts #3690

Open
MoKhajavi75 opened this issue Apr 16, 2024 · 1 comment
Open

Define handleSummary and teardown across multiple scripts #3690

MoKhajavi75 opened this issue Apr 16, 2024 · 1 comment
Labels

Comments

@MoKhajavi75
Copy link

Feature Description

I propose adding global lifecycle functions to k6, specifically a shared setup and teardown that apply to every test file. This would simplify processes like customizing the handleSummary() function across all tests, enhancing efficiency and consistency in test configurations.

Suggested Solution (optional)

For now, there are some workarounds, like (discussed here):

// file: shared/handleSummary.js
export function handleSummary() {
	console.log("Here's your shared 'handleSummary'")
}

// file: script1.js
export {handleSummary} from './shared/handleSummary.js'

export default function () {
	console.log("Here's one of your scripts")
}

// file: script2.js
export {handleSummary} from './shared/handleSummary.js'

export default function () {
	console.log("Here's another of your scripts")
}

but this requires export in every file and with a huge number of tests, this could be a pain!

Already existing or connected issues / PRs (optional)

No response

@codebien codebien changed the title Global lifecycle Define handleSummary and teardown across multiple scripts Apr 23, 2024
@codebien
Copy link
Contributor

It is something we might consider during #1342 implementation

@codebien codebien removed the triage label Apr 23, 2024
@codebien codebien removed their assignment Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants