In our project we have a user to sign on after filling the CAPTCHA code. Right now it's working fine and I am a beginner to this field.
I am confused how to write a test case for the CAPTCHA code
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It only takes a minute to sign up.
Sign up to join this communityIn our project we have a user to sign on after filling the CAPTCHA code. Right now it's working fine and I am a beginner to this field.
I am confused how to write a test case for the CAPTCHA code
Many of the preceding answers are directed at testing the behavior of the captcha from a customers POV (enter valid, invalid, etc.). But, if you are testing an actual captcha generator that your dev's wrote then you should go deeper. Also, there is some important information about the captcha generator you're testing that would be important for functional testing.
For example,
Some other information needed for behavioral testing from the UI could include
There are two questions here: (1) test case itself; (2) ability to automate testing.
As per the first topic, you just describe it in a form of Actor - Action - Result
, e.g.:
System
redirects to a page XXUser
types CAPTCHA code into a field [...]System
checks answer validitySystem
redirects to Step NSystem
redirects to "Completion" pageor, alternatively (depending on your policy of writing TC's):
System
redirects to a "CAPTCHA" pageUser
types a valid code into a field [...]System
redirects to "Completion" pageUser
types an invalid CAPTCHA code into a field [...]System
redirects to Step NAutomating this process is slightly different. Since the key to testing is ability to reproduce, you can't afford different CAPTCHA's within the same test. However, you can (and should) make tests for valid, invalid, empty responses.
For this purpose, you should develop a dummy CAPTCHA provider that will have exactly the same interface as the "production" CAPTCHA provider has, but will return only a well-known image(s).
Then, your automated code will attempt "solving" this CAPTCHA with various answers (valid, invalid, empty, and so on).
The purpose of a CAPTCHA is to verify a human is submitting the form. By definition, if you could automate this interaction, the functionality would fail. But you didn't ask about automation, so that's just an aside.
Think about it from a functional perspective - does it let you submit when you enter the right input? Does it keep you out if you don't enter the right input? What kinds of invalid input might trick it into letting you in?
Think about it from a usability perspective - is the CAPTCHA easy enough for a human to read? Is it still tough enough for a program to detect and read?
Do some research about CAPTCHAs and how they've been known to succeed and fail. That may give you ideas about how to test.
Have a look at this testing Cheat Sheet for some more ideas. If you're a beginner, it may help you with future tests too.
Example for manual testing, if you mean it:
For me the CAPTCHA consists of different sub-modules:
If implemented via interfaces (dependency injection) you can test some functionality in isolation: