Mantain session between tests using Geb

ぐ巨炮叔叔 提交于 2019-12-19 11:36:26

问题


I'm testing my application using Geb, and I want to mantain session between tests so I can avoid to log in in every tests (this is annoying when watching the tests in the browser).

Is there a way to mantain the session?


回答1:


By default Geb test integrations clear all the cookies after every test which means that you loose your web sessions. You can easily change that behaviour by using the following configuration option in your GebConfig.groovy:

autoClearCookies = false

You can read more about using configuration here.

So yes, it is possible to maintain session between tests.




回答2:


If you are using Spock, one option that you can do is to structure your "features" (test methods) in a linear fashion and use the @Stepwise annotation on the class. This will ensure that the cookies and browser object are not reset/replaced between features/test-methods




回答3:


Yup, it isnt possible now. My specs start by logging in and finish by logging out.



来源:https://stackoverflow.com/questions/13575999/mantain-session-between-tests-using-geb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!