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

Setup and teardown hooks that runs before and after ALL test suites executed? #512

Open
georgyfarniev opened this issue Dec 16, 2018 · 3 comments
Assignees
Milestone

Comments

@georgyfarniev
Copy link

It would be nice to have setup and teardown hooks that executes before ALL fixtures ONCE and teradown after ALL fixtures ONCE in addition to fixture hooks.

For example, it is convenient for setup test environment globally only once before all tests via hooks instead of creating custom singleton

@jamesadarich
Copy link
Member

I would say in general this is a bad idea of you can avoid it as there's a risk of making tests flaky or having setup that's unclear in the scope of the test.

Have you got an example use case?

@georgyfarniev
Copy link
Author

I would say in general this is a bad idea of you can avoid it as there's a risk of making tests flaky or having setup that's unclear in the scope of the test.

Have you got an example use case?
A good example is when we need to create and initialize test database, especially if it takes long time for unit tests to run before each suite.

@jamesadarich
Copy link
Member

Ah I see. In these cases I usually set this up before Alsatian is even called. Do you think there would be a benefit in having Alsatian handle this?

An example of the above would be

npm run setup:database && alsatian "./**/*.spec.js"

@jamesadarich jamesadarich added this to the 4.0.0 milestone Mar 25, 2020
@jamesadarich jamesadarich self-assigned this Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants