-
Notifications
You must be signed in to change notification settings - Fork 20
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
Session is reset after failing test? #56
Comments
It's a feature. When using shared session strategy the cookies are shared between all tests in a test case. This allows to have complex test cases, that are combined of several commonly used tests (e.g. What you though (not sure if I've explained that in docs) the shared session strategy is for? |
I know what the shared session strategy is for, I just thougt that the tab isn't closed if one test fails. Is there any other way than calling $session->visit() in every test? I'm just searching for different strings, but don't want them to be in just one test. Thanks for the fast answer! |
@luklapp be careful that it is possible to have tests running without running the others. If they depend on the outcome of the previous test, you should use the |
Failing test is bad in any case, so if window/tab is closed, that shouldn't bother anybody really. Also one thing about Now, once @stof mentioned |
If test structure is similar, then I tend to have 1 test + specify all strings via data provider method. |
OK, thanks for support! |
@aik099 Behat will still reset sessions. It will simply do a soft-reset rather than a hard reset. It does not share the session state between scenarios (and this would be rejected as Behat considers that scenarios are meant to be fully isolated). And if the test relies on the state generated by the previous one, it is precisely the use case for |
Yeah, I know and that's cool. I'm also planning to switch to soft reset permanently (at some point in #5) or make it configurable, but I'm not sure how to technically implement that knowing architecture of the library.
Then all is fine and works as expected. That's good to know. |
I have multiple test methods with shared sessionStrategy. In the first test, i visit my URL. If this test is passing, the other tests work as well. Otherwise, the session is reset to a blank page. Maybe it's a feature, not a bug? But I think it should be saved.
Code:
The text was updated successfully, but these errors were encountered: