Mukhtar Ahmed
BAN USERWe can structure testing Bing Search:
1. BVT
2. UI Testing
3. Functional Tesitng
a) Data correctness
b) Advanced search option
c) Search based on locale
d) Modify search tools such as filter etc
e) Offline mode
4. Usability Testing
5. Load and Stress
6. Search content relevance testing based on keyword search and result shown
On this pattern you can easily start writing test cases such as:
1. Test home page content and cursor is at the text box to let you start typing.
2. If a keyword is searched make sure result displayed on the top links, should have those keyword on their webpages, verify by visiting the links to make sure it works
3. Search a keyword with 'I am feeling lucky' and make sure the content is most relevant.
4. Test max and min length of search text box
5. When you search, just type few words with incorrect spelling or incomplete word, verify that it gives you a suggestion. Validate suggestion link redirects you with result of correct keyword search.
And so on...
Check if a substring permutation exists in a string
Check if a substring permutation exists in a string. Ex. A = “most random” B = “mod”
So the function should return true since “mod” a permutation of “dom” exists in string A
—————————————————————————————————————–
// Have this as class field to expose to multiple methods
private Hashtable mTable;public bool SubStringExistsAsPermutation(string A, string B)
{
if (String.IsNullOrEmpty(A))
{
throw new ArgumentException(“A cannot be null”);
}
if (String.IsNullOrEmpty(B))
{
throw new ArgumentException(“B cannot be null”);
}
mTable = new Hashtable();
// Fill hashtable with B string
foreach (char ch in B)
{
mTable[ch] = Convert.ToInt32(mTable[ch]) + 1;
}
// Read each character from String A. Keep comparing it with hashtable characters
// If character in A is not found in hashtable, keep moving A pointer
// If character in A is found in hashtable, Set a flag LookForConsecutiveCharacter = true
// If you find LookForConsecutiveCharacter = true, and next character is not found Then –
// Set LookForConsecutiveCharacter = false and reset hashmap to its initial state to look for next pattern ahead
bool LookForConsecutiveCharacter = false;
int count = 0;
foreach(char ch in A)
{
if (count == B.Length)
{
break;
}
if (Convert.ToInt32(mTable[ch]) >= 1)
{
mTable[ch] = Convert.ToInt32(mTable[ch]) – 1;
LookForConsecutiveCharacter = true;
count++;
}
else
{
// If we expected consecutive characters for permutation and its not found, reset hashtable
if (LookForConsecutiveCharacter)
{
ResetHashTableToDefault(B);
LookForConsecutiveCharacter = false;
count = 0;
}
}
}
// Verify if we found permutation
bool permutationFound = true;
foreach (char key in mTable.Keys)
{
if (Convert.ToInt32(mTable[key]) != 0)
{
permutationFound = true;
break;
}
}
return permutationFound;
}
private void ResetHashTableToDefault(string B)
{
mTable.Clear();
foreach (char key in B)
{
mTable[key] = Convert.ToInt32(mTable[key]) + 1;
}
}
string encodedString = String.Empty;
char previous = inputString[0];
int repeatCount = 1;
for (int i = 1; i < inputString.Length; i++)
{
// When same character is found
if (inputString[i] == previous)
{
repeatCount++;
}
else
{
// When you find different character, just encode if we have repeat count > 1
if (repeatCount > 1)
{
encodedString = encodedString + previous + repeatCount;
}
else
{
encodedString = encodedString + previous;
}
repeatCount = 1;
}
previous = inputString[i];
}
return encodedString + previous;
The terms 32-bit and 64-bit refer to the way a computer's processor handles information. If it is 64-bit version of Windows then it will be able to handle large amounts of random access memory (RAM) more effectively than a 32-bit system.
- Mukhtar Ahmed July 03, 2013