Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pattern for unit testing a form with a Captcha component inside?

I am currently faced with the difficult task of unit testing a form with a Captcha component inside.

By definition, a Captcha is intended to prevent automatic submissions. And by definition, unit tests are automatic.

Can someone well versed in unit testing html forms please provide advice?

(FYI, I use Tapestry 5 together with its bundled Kaptcha component - although I suspect the solution is not technology-dependent.)

like image 845
balteo Avatar asked May 26 '26 12:05

balteo


1 Answers

I add a test mode to my application that forces the Captcha string to a well known value (I like "i8cookies"). The test mode is specified as a JVM system property at startup and simply isn't present in production mode.

like image 171
Howard M. Lewis Ship Avatar answered May 30 '26 11:05

Howard M. Lewis Ship