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

Implement Lifecycle Hooks #41

Closed
hendriknielaender opened this issue Jan 14, 2024 · 0 comments · Fixed by #56
Closed

Implement Lifecycle Hooks #41

hendriknielaender opened this issue Jan 14, 2024 · 0 comments · Fixed by #56
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@hendriknielaender
Copy link
Owner

Description

This feature would provide users with greater control over their benchmarking process.

Proposed Hooks

  • beforeAll: A hook that runs once before all tests begin. This can be used for initial setup procedures.
  • afterAll: A hook that runs once after all tests have completed. This is ideal for cleanup operations.
  • beforeEach: A hook that runs before each individual test. Useful for setting up test-specific conditions.
  • afterEach: A hook that runs after each individual test. Helps in resetting conditions or cleaning up after each test.

Use Case

These hooks would be particularly beneficial for complex benchmarks that require specific setup and teardown operations before and after running tests. They provide flexibility and control, ensuring that each test runs under the right conditions and that resources are properly managed.

Implementation

Ideally, these hooks should be easy to use and integrate into existing tests with minimal configuration. Here's a rough idea of what the interface might look like:

const LifecycleHooks = struct {
    beforeAll: fn () void,
    afterAll: fn () void,
    beforeEach: fn () void,
    afterEach: fn () void,
};

pub const Config = struct {
    ...
    hooks: LifecycleHooks = .{},
    ...
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant