Open Slamdunk opened 4 years ago
@Naktibalda is there any reason recreateApplicationBetweenRequests was set to false by default?
To avoid breaking backwards compatibility. The default value of recreateApplicationBetweenTests was changed in the next major release (planned to be 2.6, actually released as 3.0). https://github.com/Codeception/Codeception/pull/5307 https://github.com/Codeception/Codeception/pull/5433
Also there was this bug that recreateApplicationBetweenTests
behaved as recreateApplicationBetweenRequests
initially.
https://github.com/Codeception/Codeception/pull/5406
@Naktibalda : In 2.6 I would like to change one of them to true, which one would you prefer - reset between tests or reset between requests? @artmnv I prefer
tests: true, request: false
options. But I don't think we should rely on my preferences in this question. I can dig and set custom properties by myself. I think we should set default options for easy start for newcomers. It can be execution speed or reliability. But I can't imagine why would anyone use multiple requests in one test.
Hi, commit https://github.com/Codeception/module-zendexpressive/commit/7d405fd406bd55e1eea671ddf4faa449b3be8229 introduced the flags to recreate the application instance between tests and between requests, both set to false by default.
Commit https://github.com/Codeception/module-zendexpressive/commit/8233e766f39effd52a9d8abbe18b06bc58b759fa changed the default of
recreateApplicationBetweenTests
to true, which is sane to me, but without any reason described.In my humble opinion also
recreateApplicationBetweenRequests
should be set to true by default, because any stateful service or component with non-deterministic behavior related to the request fails to be reset on subsequent requests.A trivial example may be the initialization of an Identity helper:
In this code snipped
IdentityHelper
is a service instantiated only once per test withrecreateApplicationBetweenRequests = false
, so an hypothetical second request in the same test without the username attribute wouldn't clear the previously registered identity, while a real scenario would instead end with an empty identity for the second request.Is this a user fault? Maybe, but PHP is shared-nothing by default, and almost every developer takes it for granted.
I don't experience any visible performance degradation switching the flag.
@Naktibalda is there any reason
recreateApplicationBetweenRequests
was set to false by default?