@BeforeAll support
Activity
Stefan Seifert January 29, 2020 at 1:11 PM
PR is finished and merged: https://github.com/wcm-io/wcm-io-testing/commit/6af8cf3597216baff11c78d8321ccf7052d0658c
Stefan Seifert January 23, 2020 at 12:50 PM
we have a PR for this from @Pierre Klink: https://github.com/wcm-io/wcm-io-testing/pull/15
it has some open issues but looks like a good start
Daniel Strmecki September 29, 2019 at 7:52 AM
Hi Stefan, I completely agree with what you said in your first comment. In our case the boost in execution time is 200-250% (measured by calling all test cases from only one test method on a class level). So I am fine with leaving it up to developers to decide weather they can reuse the context object on class level or not.
Regarding your second comments, that would be really nice to have, but also just having a shared object would be a great start.
Stefan Seifert September 26, 2019 at 7:58 PM
we might think about some way to "reset" a context object to it's initial state without the need to completely recreate it - but this may be not so easy as it not only affects the repository, but also OSGi services and other thinks registered via the context.
Stefan Seifert September 26, 2019 at 7:55 PM
currently @BeforeAll is not supported because if the context is not "immutable" - each unit test can write data to the repository, and thus the next unit test in the same class starts with a "dirty" repository which may impact the reproducibility of the tests.
but if you are aware of this problems and make sure this does not happen (e.g. doing writing to the repository only in the BeforeAll method) it might by useful to have @BeforeAll support. just do not see it as "silver bullet" to solve all performance problems by switching all @Before methods to @BeforeAll.
i will think about it and make some experiments if i find a bit time the next weeks. PRs welcome
Support for @BeforeAll annotation.
If you have a project with a lot of test classes and test methods and if your context object is complex this can improve the speed of test execution.
Otherwise, the context object or some other objects are created for each test method.