Issue in auto suggestions when multiple words of the same record start similarly


similar multiple words in a record

This one adds to my list of test cases for auto suggestion functionality. It really depends on the implementation whether this test applies or not, but it is still good to add to your check list.

In our case, auto suggestions are displayed using keywords mapped to the record. There is one keyword for each word in a name.

Example: “New Delhi” should show up as a suggestion when either “New” or “Delhi” is typed in.
So, there are two records in database – one with “New” as a keyword, and one with “Delhi” as a keyword.

But, what happens when words in a single name start similarly.

For example, there is a city named “Tarn Taran”. Both words in the name start with “Tar”.
When I type in “Tar”, both keywords “Tarn” and “Taran” will get matched, and if it’s not handled in the code, Auto-suggest list will display two records for “Tarn Taran”.

Testing Auto Suggest functionality


auto_suggest_list

Testing AutoSuggest functionality – Verification of Autosuggest list:

I am taking an example of a text box that will suggest city names from a list of cities according to inputs entered by user. Suggestions displayed are list entries that start with the string given as input. The maximum display limit of suggestions will be 10. The list of suggestions should be displayed in ascending alphabetical order.

 

1. Enter 1 character in the autosuggest field for which values are not present in the auto suggest list.

Eg. Enter “x” when there is no city name in the list that starts with ‘x’
>> No suggestions should be given to the user
>> On replacing the “x” with a character that is the first letter of a city in the list (like “n”), suggestions will be given to user accordingly (cities whose name starts with ‘n’)

2. Enter 1 character in the autosuggest field for which values are present more than the max display limit of auto suggest list. (Max limit + 1)

For example, there are 11 cities with names starting with “h” in our database. So, we enter “h” in the input field, and check the suggestion list
>> All city names displayed in the list should start with the letter “H”
>> Suggestion list should display only 10 out of the 11 available cities.
>> Confirm which 10 of the records should be displayed, and which 1 city should be ignored (should be mentioned in the requirements)
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)

3. Enter 1 character in the autosuggest field for which count of values present is exactly equal to the max display limit of auto suggest list. (Max limit)

For example, there are 10 cities with names starting with “L” in our database. So, we enter “L” in the input field, and check the suggestion list
>> All city names displayed in the list should start with the letter “L”
>> Suggestion list should display all the 10 available cities.
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)

4. Enter 1 character in the autosuggest field for which count of values present is exactly 1 less than the max display limit of auto suggest list. (Max limit – 1)

For example, there are only 9 cities with names starting with “E” in our database. So, we enter “E” in the input field, and check the suggestion list
>> All city names displayed in the list should start with the letter “E”
>> Suggestion list should display all the 9 available cities.
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)

5. Enter 1 character in the autosuggest field for which count of values present is exactly 1.

For example, there is only one city that has its name starting with “Y” in our database.
So, we enter “Y” in the input field, and check the suggestion list
>> Only the city name starting with the letter “Y” should be displayed in the list
>> Suggestion list should display the city name that starts with “y”.

6. Check for case-sensitivity
>> Suggestions provided for “H” should be the same as those provided for “h”
>> If suggestions are not provided for “x”, they should not be provided for “X”
>> If records are displayed, the input string should be highlighted in the records that are displayed in the suggestion list.

7. Assuming, cities exist whose names start with “H”
Enter “H”. Remove the character using backspace. Enter “h” (or vice-versa; replacing “h” with “H”)
>> Suggestions provided for “h” should be the same as those provided for “H”
(I found a bug in Google search with this test case)

autocomplete issue in google search

8. Verify that user is able to select any value from autosuggest list
Assuming, at least 3 cities exist whose names start with “H”.
>> After user enters “H”, user should be able to select any value using only the keyboard (up & down keys)
>> After user enters “H”, user should be able to select any value by clicking on it
>> User should be able to select the first displayed suggestion
>> User should be able to select a suggestion in between extremes (the 2nd one)
>> User should be able to select the last displayed (3rd) suggestion

9. Enter 1 character in the autosuggest field for which values are present in the auto suggest list. Then, replace it with another character for which values are present.

Eg. Assuming cities starting with letters ‘s’ & ‘t’ exist in the test list
Enter “s”. Remove the character using backspace. Enter “t”
>> On entering “s”, suggestions should be displayed with city names that start with “s”
>> On pressing backspace, the displayed suggestions should be removed (hidden from view)
>> On replacing the “s” with “t”, suggestions will be given to user accordingly (only cities whose name starts with ‘t’)

10. Enter 1 character in the autosuggest field for which values are present in the autosuggest list. Then, replace it with another character for which values are not present.

Eg. Assuming cities starting with letter ‘s’ exist in the test list, and there are no city names that start with “x” in the list.
Enter “s”. Remove the character using backspace. Enter “x”
>> On entering “s”, suggestions should be displayed with city names that start with “s”
>> On pressing backspace, the displayed suggestions should be removed (hidden from view)
>> On replacing the “s” with “x”, no suggestions should be given to the user

11. Enter 2 letters such that city names starting with 1st letter exist, but city names starting with the 2 letter combination don’t.
For eg., we have cities that have names starting with “s”. But, there is no city name that starts with “sd”.
Enter “sd”, and check the displayed suggestions.
>> No suggestions should be given to the user

12. Enter 2 letters such that city names starting with 2nd letter exist, but city names starting with the 2 letter combination don’t.
For eg., we have cities that have names starting with “d”. But, there is no city name that starts with “kd”.
Enter “kd”, and check the displayed suggestions.
>> No suggestions should be given to the user

13. Enter a 2 letter combination such that the count of city names starting with the 2 letter combination is more than the max display limit of auto suggest list. (Max limit + 1)

For example, there are 11 cities with names starting with “ha” in our database. So, we enter “ha” in the input field, and check the suggestion list
>> All city names displayed in the list should start with the string “Ha”
>> Suggestion list should display only 10 out of the 11 available cities.
>> Confirm which 10 of the records should be displayed, and which 1 city should be ignored (should be mentioned in the requirements)
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)

14. Enter a 2 letter combination such that the count of city names starting with the 2 letter combination is exactly equal to the max display limit of auto suggest list. (Max limit)
For example, there are 10 cities with names starting with “Le” in our database. So, we enter “Le” in the input field, and check the suggestion list
>> All city names displayed in the list should start with the string “Le”
>> Suggestion list should display all the 10 available cities.
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)

15. Enter a 2 letter combination such that the count of city names starting with the 2 letter combination is 1 less than the max display limit of auto suggest list. (Max limit – 1)

For example, there are only 9 cities with names starting with “Ed” in our database. So, we enter “Ed” in the input field, and check the suggestion list
>> All city names displayed in the list should start with the string “Ed”
>> Suggestion list should display all the 9 available cities.
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)

16. Verify that user is able to select any value from autosuggest list after entering a 2 letter combination.
Assuming, at least 3 cities exist whose names start with “Hu”.
>> After user enters “Hu”, user should be able to select any value using only the keyboard (up & down keys)
>> After user enters “Hu”, user should be able to select any value by clicking on it
>> User should be able to select the first displayed suggestion
>> User should be able to select a suggestion in between extremes (the 2nd one)
>> User should be able to select the last displayed (3rd) suggestion

17. Enter 2nd,3rd, 4th char (and so on..), and verify the values displayed in the autosuggest list.
>> Suggestions should keep getting updated according to the newest letter added as input
>> The input string should be highlighted in the records that are displayed in the suggestion list.
>> If we have a city “Ahmedabad” in our list, and there is no other record that starts with the string “Ahmedabad”. When we enter “Ahmedabad” as our input, only one suggestion of the city should be displayed (duplicates should not be present, and full name should narrow down the suggestion list).

18. Copy-Paste should work.
Assuming cities starting with letter ‘Si’ exist in the test list
Copy the string “Si”, and paste it into the text box
>> All city names displayed in the list should start with the string “Si”
>> Suggestion list should not display more than 10 cities.
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)

19.Enter first character as special character and verify the autosuggest list.
Eg. Assuming cities starting with letter ‘s’ exist in the test list.
Enter any special character (like +,_,*,$,etc…), and then enter “s”
>> Confirm requirements. One of the two results might occur:
i) No suggestions should be given to the user
ii) Special characters should be ignored while checking inputs, and suggestions should be displayed to you for city names that start with “s”

20. Enter a city name that contains a special character. Check for all possible special characters.
Eg. “St. Louis”, “New Delhi”, “Chittur-Thathamangalam”, “Daman & Diu”,”O’ Valley”
>> Proper suggestions should be displayed to user if the cities exist in the list

21. Check what happens when you enter names with non-english special characters.
Eg. “Orléans”
>> Confirm requirements

22. Without entering anything in the search text box, click Search icon or hit enter key
>> Confirm requirements. If city is mandatory, user should be displayed an error, otherwise, results should be displayed according to default.

23. Without selecting anything from suggestion list, hit enter key or click search icon
Eg. Enter a full city name like “New Delhi”, and hit enter key or click search icon.
>> If requirements require selection, an error should be displayed to the user
>> Otherwise, results should be displayed for the city “New Delhi”

24. Enter a city name that is not present in the suggestion list, and hit enter key or click search icon
Eg. Assuming “Paris” is not in our list, and hence will not be displayed as a suggestion in any case.
Enter “Paris”, and hit enter key or click search icon.
>> An error should be displayed to the user

25. Check scenario where a city name contains more than 1 word.
Eg. If “New Delhi” is in the test list,
Enter “New” and check auto suggest list. Enter “Delhi” and check auto suggest list.
>> If users are likely to enter a word other than the first for the city name, entering the contained words (other than 1st word) should also display the city name in suggestions.
As in India, people are as likely to call the city “Delhi” as they are to call it “New Delhi”, the suggestion list should display “New Delhi” when either of the “New” or “Delhi” is typed by the user.

26. Check by entering input with a preceding space character
Eg. Assuming cities starting with letter ‘s’ exist in the test list.
Enter a space character (” “), and then enter “s”.
>> Preceding space character should be ignored, and suggestions should be displayed to you for city names that start with “s”.
>> Suggestion list should not display more than 10 cities.
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)
>> The matching text should be highlighted in the auto-suggest list

27. Check by entering input with a succeeding space character
Eg. Assuming cities starting with letter ‘s’ exist in the test list.
Enter “s”, and then enter a space character (” “).
>> Succeeding space character should be ignored, and suggestions should be displayed to you for city names that start with “s”.
>> Suggestion list should not display more than 10 cities.
>> Check the sorting order of display of the suggestions. (According to given requirement, the list of suggestions should be displayed in ascending alphabetical order.)
>> The matching text should be highlighted in the auto-suggest list

28. Check handling of input to be entered that can be called by different names (different spellings).
Eg. In our example of city names, a city can have an old name, and a new name. The name of a city called “Baroda” was changed “Vadodara”. A user is likely to type in any of the two names.
>> Confirm requirement on whether the user should be displayed the new name in suggestion list when typing old name, or whether both the names are to be treated as independant & separate records.

29. Enter some characters, select a value from the auto suggest list, delete the value from the text box, then enter a different input and select from auto suggest list.
Eg. Assuming “Mumbai” and “Chandigarh” are in the test list.
Enter “Mum”. Select “Mumbai”. Clear the input text box, and then type “Cha”. Select “Chandigarh”
>> The last selected value (“Chandigarh”) should be displayed as selected. On hitting enter key or clicking button, results should be displayed according to input = “Chandigarh”

30. If values in auto suggest list come from more than one categories, check display of the list values on entering input
>> Confirm requirements on the sorting order of values to be displayed from across categories.
>> Check that all related values from across categories are displayed in the auto suggest list. None of the available categories should get missed out

31. Check that the auto suggest functionality works as expected across various browsers and their different versions. (Cross Browser compatibility check)

32. In all pages where the auto suggest is implemented, check that existing functionality of page is working properly. At times, javascript errors occur, or the new code starts interfering with the existing functions.

33. Check widening of suggestion list when characters are removed from input field.
Eg. Assuming there are 11 cities with names starting with “ha” in our database, and there are 6 cities with names starting with “hal” in our database.

Enter “HA”. Enter “L”. Remove “L”.
>> On entering “HA”, 10 cities should be displayed in the suggestion list (max. limit)
>> When “L” is added to make it “HAL”, suggestion list should be updated to display only the 6 cities that start with “HA”
>> When “L” is removed to make the input “HA” again, suggestion list should be updated to display the same 10 cities that were being displayed earlier (before typing “L”).

34. Check how drag-drop of text is being handled by the input text box
Eg. Assuming city “Pune” is present in our database, and the page containing the auto suggest functionality input box also has the text “Pune” written somewhere in it.

Drag-drop the text “Pune” from the page into the input text box
>> “Pune” should be displayed in the suggestion list to the user
Along with my own list of test cases, I also used the list in given link as guidance material. A very big thanks to the writer! 🙂

How use of Regular Expressions affects Website Performance


A few months back, I inadvertently came across a bug related to regular expressions. It was a new learning for me that improper regular expressions can cause catastrophic performance problems.

Let me first give you more details about the bug I found.

The form I was testing had a text box “Special Note” with maximum character limit set as 500.
When the form was submitted by the user, a regular expression was used to check that the text did not contain any Email address.
Everything worked fine when I entered strings with short words.
The problem started occurring when I entered a long character string (eg. “asdfghjiklasdfsdfsdkjhdfseds”) in the Special Note field, and then submitted the form. The software stopped responding to user input in this scenario.

The Performance was getting adversely affected when trying to match the regex pattern with the entered long character string.

To find out more about the issue I had faced, I researched online about how regular expressions can affect performance. I found that the performance issue occurs because of  backtracking. I also found  Microsoft’s example of a regex for email address that can cause performance issues. The linked articles provide more detail on backtracking, and on how the issue occurs if the regular expression used is not optimized.

So, when you are required to test a text field that uses a regular expression, always include the following test cases in your testing:

1. Different possibilities of text that matches the regular expression pattern.

2. Different possibilities of text that does not match the regular expression pattern.

3. Different possibilities of text that almost matches the regular expression pattern –  Including, a long string of characters, with no whitespace in between, that nearly (but not completely) matches the regular expression.

Assuming no one will find that bug is a very bad idea!!


Rodney recently posted an article  on incorrect policies of some companies, where they assume that not telling anyone about their security flaws will somehow protect them.
Such companies can not last very long because they incorrectly assume that they are the only intelligent people in the planet.
Someone with malicious intent can always find out your security flaws without you telling him/her. So it’s crucial to remove those flaws instead of trying to hide them.

On a similar note, I want to tell you to never make assumptions about any bug.
Eg. When I am telling you of a server error that occurs in your website, don’t just ignore it by assuming the scenario I told you about will rarely occur. Users are not 100% predictable. No human is. So, your assumption – that only a tester would get such a server error and users would not – is wrong.

Also, if the “rare” bugs you chose to ignore are a lot in number, there is more probability of a user coming across at least some of them. Each bug a user finds has a cumulative effect on driving the user away from you.
If by chance, a user comes across such an error, he/she will be confused and frustrated, and you might lose your audience to someone else who took the time to fix their bugs.

And you wouldn’t want that, would you?

Dilbert Software Quality

Bugs I found in my phone


Nokia_MessagingThere are bugs in my phone’s software. It being a Symbian and a discontinued phone, It would be quite advisable  to buy a new phone. But, I am putting that off for now, because my phone still acts like a phone – most of the times..

Anyway, this post is to list out the bugs I found in my phone. Anyone who is testing a mobile phone should test these scenarios too.

1) If I switch off my phone while it is in the process of sending an SMS, it will delete all the messages stored in it

(I have no option other than to erase all my stored messages in this way when my phone hangs while sending an SMS)

2) If I am deleting the first message, and simultaneously receive an SMS, the just received message will get deleted, and the one I was deleting will still be present in the message folder.

nokia_5800_display_issue   3) This bug is known to any user who has this phone model – Nokia 5800 ExpressMusic.

The display stops working at times, and starts displaying bright, colourful lines instead.

(This  has been present since around one month after I bought the phone)

Have you found any bugs in your phone? List them out so we could help fellow testers who test mobile phones.

SQL Queries – DateTime should be passed in single quotes


I learnt a new thing today.. I learnt that a DateTime value should always be passed within single quotes in a query.

Found this out when we were debugging a Query, used in our code, to find the cause of a bug I raised. The issue caused was due to DateTime value being passed in the SELECT query without being enclosed in single quotes.

On further research, I found that DateTime should always be enclosed within single quotes in all queries – whether it is a SELECT query, an UPDATE query, or an INSERT query. Otherwise, the DateTime value is not read/written correctly by the SQL Server.

For example, for the below given query,

SELECT * FROM TABLENAME 
 WHERE DateTime >= 12/04/2011

No error will be raised by the SQL server, but it will divide the date value given (12/04/2011) and get zero, and then take the minimum possible DateTime value as the (default date + 0)

Making the effective SQL query into:

SELECT * FROM TABLENAME 
 WHERE DateTime >= '1900-01-01 00:00:00.000'

Hence, though no error/exception is raised, and the query does appear to work, the results that you get from the query are incorrect.

A similar problem occurs when you pass DateTime values without quotes in INSERT and UPDATE queries.

(Microsoft Support: a value without quotes that is used as a datetime value is treated as the default date plus the number of days equal to the computed amount of the assigned value)

 

Other Reference:

* The bug I found today 🙂

* http://stackoverflow.com/questions/6119369/simple-datetime-sql-query

Testing URL format – URL should contain only allowed characters


Sometimes, issues occur due to incorrect URL formatting.

For example:

In a website page, URL is dynamically created according to the user input.

User uploads photos for a Car Model, and the URL for the photo location is created according to the car name.

URL Format being – http://www.domain.com/makename-modelname-uniqueid/

If a User uploads a photo for a Honda Jazz car, the image will be saved with a URL  http://www.domain.com/honda-jazz-1093/

Testing in these cases should involve checking the URL that is dynamically created. You need to verify that the URL does not contain invalid characters in any possible scenario.

Some passed and failed test scenarios for above example would be as listed below:
For Car = Maruti Suzuki Wagon R 1.0

1. http://www.domain.com/maruti suzuki-wagon r 1.0-2455/

=> Make, and model names contain space character, and hence, URL contains invalid space characters; Model name contains a dot (.) character, and hence does the URL; URL is invalid because it contains invalid characters

2. http://www.domain.com/marutisuzuki-wagonr10-2455/

=> Space and dot (.) character have been removed while forming the URL; URL contains only valid characters, and is hence a valid URL

For Car = Ford Fiesta (2006-2011)

1. http://www.domain.com/ford-fiesta (2006-2011)-2456/

=> Model name contains space and bracket character, and hence, URL is invalid because it contains invalid characters

2. http://www.domain.com/ford-fiesta20062011-2456/

=> Space and Bracket characters have been removed while forming the URL; URL contains only valid characters, and is hence a valid URL

Following are the allowed URL characters

Unreserved

These characters can be used unencoded anywhere in the URL

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 - _ ~

Reserved

These characters are used as delimiters, and should not be used for any other purpose as unencoded.

Reserved characters will only be used in URL formatting. Should not be contained in the dynamic values passed.

: / ? # [ ] @ ! $ & ' ( ) * + ; , = .

From among the above mentioned characters, only the unreserved characters (a-z , A-Z , 0-9 , – ,  _ , and ~) can be used for the actual name parts of the URL. Any other character needs to be Percent-encoded

(Read more about reserved/unreserved characters here…)

And this is why

1. Unencoded and invalid characters (like space, bracket or å) in a URL don’t work in all user agents. Newer versions of browsers seem to handle them fine but older browsers may not be able to follow links or load images.

2. It may make URLs ugly and hard to read since browsers may percent encode some of these characters before displaying them in the location bar. This varies from browser to browser. A URL like http://example.com/å ä ö/ may be displayed as http://example.com/å ä ö/http://example.com/å%20ä%20ö/http://example.com/%C3%A5%20%C3%A4%20%C3%B6/, or even http://example.com/√•%20√§%20√∂/.

Always check that the URLs generated/specified in your website contain valid characters as specified above.