如何接受测试验证码保护的Web应用程序功能? [英] How to acceptance test captcha-protected web application functionality?

查看:74
本文介绍了如何接受测试验证码保护的Web应用程序功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将验证码(例如reCaptcha)添加到我网站上的某些功能。我该如何调整验收测试?

I would like to add a captcha, such as reCaptcha, to a certain functionality on my site. How could I adapt my acceptance tests?

是唯一在暂存站点上禁用验证码的解决方案吗?

Is the only solution to disable the captcha's on the staging site?

说明:

我当然不是在说暴力破解我自己的验证码,而是

Of course I am not speaking of brute-force cracking my own captcha, but e.g. some option to inject a state into the captcha from the server side that my test knows about.

PS我的服务器端代码使用Pyramid框架,并且我的测试是使用Pyramid框架编写的Selenium

PS My server side code uses the Pyramid framework, and my tests are written using Selenium

推荐答案

重点不是要通过Selenium测试来测试Captcha —为什么要花大量的精力来测试第三方工具?

The point isn't to test Captcha with your Selenium tests -- Why spend the significant effort to test a third party tool?

相反,我要进行硒测试,以验证您的验证码正在显示。这可以验证您的验证码存在并处于活动状态。测试完成后,我将关闭验证码,然后继续进行其他验证测试。我还有最后一步,要重新打开验证码并重复测试以检测到验证码处于活动状态。这样一来,您可以确保重新激活验证码时不会错过任何内容。

Instead, I'd have a Selenium test that verifies your Captcha is showing up. This validates your Captcha is present and active. After that test I'd turn Captcha off and proceed with your other validation tests. I'd also have a final step of turning Captcha back on and repeating the test detecting Captcha is active. That way you're ensuring you didn't miss something when reactivating Captcha.

这篇关于如何接受测试验证码保护的Web应用程序功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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