.
Test Cases For IFSC Code Field
Hello Folks,
In this tutorial, we will learn how to write IFSC Code Field Test Cases? We will also learn about positive test scenarios and Negative test scenarios.
An IFSC code should be 11 digits long as per RBI Rules, the first 4 digits of the IFSC represent the bank and the last 6 characters represent the branch. The 5th character is zero.
Full-Form of IFSC Code: Indian Financial System Code
Format of IFSC Code :
The basic Format of the IFSC code field is given below.
IFSC Code format : SBIN0125620
Here,
SBIN - Represent Bank Name
0 - Fifth char zero for all bank
125620 - Represent the Branch.
This is the basic pattern of the IFSC code.
What are The Test Cases For the IFSC Code?
Here, Important Test cases for the IFSC code field are given...
- First, verify the IFSC code field by entering the 11-digit valid code.
- Verify the field when the user enters four char numeric Values.
- Verify the field when the user enters fifth char other than zero "0".
- Verify the field when the user enters the first four char in the Lower case.
- Check that when the user enters the last six-digit special char.
- Verify the field by entering the less than 10-digit IFSC code.
- Verify the field By Entering more than 10-digit IFSC code.
- Verify the Field without Entering the IFSC code.
- Verify the field by entering the only space in the IFSC code field.
- Check the alert message when the user enters an invalid IFSC code.
- Check the field when users enter 11 zero as the IFSC code.
- Check that when the user pastes the valid IFSC code in the field.
- Check that when the user pastes an invalid IFSC code in the field.
- Check that when the user enters a Valid code of another bank.
- Check that when the user enters the only alphabet value in the field.
- Check that when the user enters only numeric values.
- Check that when the user enters special char in the IFSC code field.
- Check that when the user enters the IFSC code of other branches.
- Check that when the user enters the IFSC code of the branch that is closed.
Hope !!! The above Test cases of IFSC code are helpful for you...
Team,
QA acharya
Share Your Knowledge With Us -
Mail your content - qaacharya.in@gmail.com
Mail your content - qaacharya.in@gmail.com
Test cases for IFSC Code |
How to validate IFSC Code using Regular Expression?
IFSC Code format : SBIN0125620
IFSC code should be -
- 11 Character long
- The first four Char should be in the Upper case alphabet.
- The fifth char should be zero
- The last six characters are usually numeric, but can also be alphabetic.
Common function to validate IFSC code using Regular Expressions in ASP.Net
HTML:
<
asp:TextBox
runat
=
"server"
ID
=
"txtIFSCCode"
/>
<
asp:Button
Text
=
"Validate"
runat
=
"server"
OnClick
=
"Validate"
/>
C#:
protected
void
Validate(
object
sender, EventArgs e)
{
bool
isValid = ValidateIFSCCode(txtIFSCCode.Text.Trim());
Response.Write(isValid ?
"Valid"
:
"Invalid"
);
}
public
bool
ValidateIFSCCode(
string
ifscCode)
{
System.Text.RegularExpressions.Regex regx =
new
System.Text.RegularExpressions.Regex(
"^[A-Za-z]{4}[0-9]{7}$"
);
return
regx.Matches(ifscCode).Count > 0 ? regx.Matches(ifscCode)[0].Success :
false
;
}
VB.net:
Protected
Sub
Validate(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Dim
isValid
As
Boolean
= ValidateIFSCCode(txtIFSCCode.Text.Trim())
Response.Write(
If
(isValid,
"Valid"
,
"Invalid"
))
End
Sub
Public
Function
ValidateIFSCCode(
ByVal
ifscCode
As
String
)
As
Boolean
Dim
regx
As
System.Text.RegularExpressions.Regex =
New
System.Text.RegularExpressions.Regex(
"^[A-Za-z]{4}[0-9]{7}$"
)
Return
If
(regx.Matches(ifscCode).Count > 0, regx.Matches(ifscCode)(0).Success,
False
)
End
Function
How to validate IFSC Code using Regular Expression in C++?
C++ Regular expression code to validate IFSC code
#include <iostream>
#include<regex>
using namespace std;
bool isValidifscodeyorn(string str)// Function to check IFSC Code.
{
const regex pattern("^[A-Z]{4}0[A-Z0-9]{6}$"); // to check IFSC code
if (str.empty()) // if empty return false
{
return false;
}
if(regex_match(str, pattern)) // if ifsc matches the regex expression return true.
{
return true;
}
else
{
return false;
}
}
// Driver Code
int main()
{
string str1 = "JNUN012562B";
cout << isValidifscodeyorn(str1) << endl;
string str2 = "KAUS0195";
cout << isValidifscodeyorn(str2) << endl;
string str3 = "PUNB0150100";
cout << isValidifscodeyorn(str3) << endl;
string str4 = "ZXCN798562x";
cout <<isValidifscodeyorn(str4) << endl;
return 0;
}
0 Comments