I have a text field that can contain up to 50 characters; I have a script that populates the field with 50 random characters. Now I need to create a script that counts the amount of text in the field to validate the amount of characters in the field and then post a message to the log saying if the field contained 50 characters.
You have not said what tool you are using, but my personal preference would be to populate an array with the contents parsed by character then get the array size. There are many methods, but I like to use arrays.
Success is the ability to go from one failure to another with no loss of enthusiasm.
~ Winston Churchill ~
Just a thought but wouldn't you want to try to put more than 50 characters in it then get the number of characters that are actually in it? If you are putting 50 into it then it could pass and still be wrong, as it can accept more than the alloted 50.
Unless you meant that the minimum number it can take is 50 and it is allowed to have more. Depends on on what the requirement is for the field.