Validations for text fields like country, State, cities



  • What should be proper validations for text fields like country, State, city i.e. can it be only characters or alphanumeric or can it also include special characters



  • It really depends on your project. I'll try to give you some hints, but it can't be comprehensive.

    Localization

    First thing to take into account is the localization. If your fields can be used by a customer from any country, you must consider allowing non alphanumeric characters, and therefore test it. This can lead to some issues, depending on the type of your application (e.g. breaking HMI). If it should not allow non-ASCII characters, you should start with that. Try Japanese or Arabic and see what happens.

    Application type

    The type of your application is the second thing i would take into account. If you are on a web application, you'll probably care about special characters, as they can be used in Regular Expressions. It can be the source of many issues if it is not correctly handled by the code.

    If your application implies some memory management (e.g. embedded development), the size of the fields will probably be important to test. This can overlap with localization tests, as non ASCII characters can take more space.

    Functional constraints

    The constraints of your application should naturally imply all limitations for your fields. Does the company only send products to the US? Are some fields created with values from a database (e.g. Country)? Is there a norm for your field (e.g. IP address)?

    Monkey Testing

    These tests should be done on any fields, as they don't require much time or functional comprehension. Just try typing as many characters as you can and see what happens. I have already seen HMI broken because of no character limit on a textfield. Copying and pasting a very long Lorem Ipsum can lead to interesting things too.

    As i said in the introduction, this is in no way comprehensive. Your question, as i understand it, is about the complete work of testing and can't be answered in a few lines. You should find many questions and answers for your problem with Google. I can only invite you to read these as much as you can and create your own testing process for your specific application.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2