Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to acceptance test captcha-protected web application functionality?

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?

Clarification:

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 My server side code uses the Pyramid framework, and my tests are written using Selenium

like image 275
Jasper van den Bosch Avatar asked Sep 11 '12 15:09

Jasper van den Bosch


People also ask

How do I complete CAPTCHA verification?

A CAPTCHA test is made up of two simple parts: a randomly generated sequence of letters and/or numbers that appear as a distorted image, and a text box. To pass a the test and prove your human identity, simply type the characters you see in the image into the text box.

What is the difference between CAPTCHA and reCAPTCHA?

reCAPTCHA is a free service from Google that helps protect websites from spam and abuse. A “CAPTCHA” is a turing test to tell human and bots apart.

What is acceptance testing in manual testing?

Acceptance Testing is the last phase of software testing performed after System Testing and before making the system available for actual use. Types of Acceptance Testing: User Acceptance Testing (UAT): User acceptance testing is used to determine whether the product is working for the user correctly.


2 Answers

Yes, the only option is disabling Captcha - for a very good reason. If it's easy enough to bypass it with Selenium, why would you have a Captcha in the first place?

like image 118
Arran Avatar answered Sep 23 '22 17:09

Arran


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.

like image 34
Jim Holmes Avatar answered Sep 24 '22 17:09

Jim Holmes