使用Geb进行测试之间的Mantain会话 [英] Mantain session between tests using Geb

查看:199
本文介绍了使用Geb进行测试之间的Mantain会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Geb测试我的应用程序,并且我希望在测试之间保持会话,这样我就可以避免在每次测试中登录(当在浏览器中观看测试时,这是令人讨厌的)。



有没有办法维持会话? 每次测试之后的cookies,这意味着你失去了你的网络会话。您可以使用GebConfig中的下列配置选项轻松更改该行为.groovy:

  autoClearCookies = false 

您可以阅读更多有关使用配置此处的信息。

所以是的,可以在测试之间保持会话。


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?

解决方案

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.

这篇关于使用Geb进行测试之间的Mantain会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆