โ ๐ฆ๐๐ถ๐น๐น ๐๐๐ฟ๐๐ด๐ด๐น๐ถ๐ป๐ด ๐๐ถ๐๐ต ๐๐ฎ๐๐ฎ ๐ฐ๐ผ๐ฑ๐ถ๐ป๐ด ๐ฟ๐ผ๐๐ป๐ฑ๐?
The issue isnโt your logicโitโs the lack of pattern recognition. As an SDET, knowing when to apply which pattern is the game-changer.
โ ๐ฆ๐๐ถ๐น๐น ๐๐๐ฟ๐๐ด๐ด๐น๐ถ๐ป๐ด ๐๐ถ๐๐ต ๐๐ฎ๐๐ฎ ๐ฐ๐ผ๐ฑ๐ถ๐ป๐ด ๐ฟ๐ผ๐๐ป๐ฑ๐?
The issue isnโt your logicโitโs the lack of pattern recognition. As an SDET, knowing when to apply which pattern is the game-changer.
๐ ๐๐ผ๐น๐น๐ฒ๐ฐ๐๐ถ๐ผ๐ป๐ & ๐ ๐ฎ๐ฝ๐ โ ๐ง๐ต๐ฒ ๐๐ผ๐ฟ๐ฒ ๐ผ๐ณ ๐๐๐๐ผ๐บ๐ฎ๐๐ถ๐ผ๐ป ๐๐ฎ๐๐ฎ ๐๐ฎ๐ป๐ฑ๐น๐ถ๐ป๐ด
When to use: Working with test data, mapping request/response pairs, or storing UI elements.
Example:
Map locators = new HashMap<>();
locators.put("loginBtn", "//button[text()='Login']");
Coding Problem Example:
Count frequency of characters or words โ Use HashMap.
๐ ๐ง๐๐ผ ๐ฃ๐ผ๐ถ๐ป๐๐ฒ๐ฟ๐ โ ๐๐ผ๐ฟ ๐ฆ๐๐ฟ๐ถ๐ป๐ด๐, ๐๐ฟ๐ฟ๐ฎ๐s
When to use: Useful in validations like palindromes, comparing logs, or merging sorted logs.
Example:
int i = 0, j = arr.length - 1;
while (i < j) {
if (arr[i] != arr[j]) return false;
i++; j--;
}
Coding Problem Example:
Is string a palindrome? Find pairs with given sum.
๐ ๐ฆ๐น๐ถ๐ฑ๐ถ๐ป๐ด ๐ช๐ถ๐ป๐ฑ๐ผ๐ โ ๐๐ผ๐ฟ ๐ฆ๐๐ฏ๐๐๐ฟ๐ถ๐ป๐ด๐ ๐ฎ๐ป๐ฑ ๐ฃ๐ฒ๐ฟ๐ณ๐ผ๐ฟ๐บ๐ฎ๐ป๐ฐ๐ฒ ๐ช๐ถ๐ป๐ฑ๐ผ๐๐
When to use: Identify performance drops, memory leaks, or longest continuous pass/fail patterns in logs.
Example:
Find the longest substring with no repeating characters.
๐ ๐ฆ๐๐ฟ๐ถ๐ป๐ด ๐ ๐ฎ๐ป๐ถ๐ฝ๐๐น๐ฎ๐๐ถ๐ผ๐ป โ ๐๐ผ๐ฟ ๐๐น๐ฒ๐ฎ๐ป๐๐ฝ๐, ๐ฃ๐ฎ๐ฟ๐๐ถ๐ป๐ด, ๐ฎ๐ป๐ฑ ๐๐ผ๐ฟ๐บ๐ฎ๐๐๐ถ๐ป๐ด
When to use:When cleaning API responses, generating dynamic test data, or parsing HTML/XML/text logs.
Example:
String response = "status=200&message=Success";
String[] parts = response.split("&");
for (String part : parts) {
String[] keyValue = part.split("=");
System.out.println(keyValue[0] + ": " + keyValue[1]);
}
Coding Problem Example:
Reverse a string, remove duplicates, extract digits from test input, etc.
๐ ๐ง๐ฟ๐-๐๐ฎ๐๐ฐ๐ต โ ๐๐ผ๐ฟ ๐ฆ๐ฎ๐ณ๐ฒ ๐๐๐๐ผ๐บ๐ฎ๐๐ถ๐ผ๐ป ๐๐ผ๐ฑ๐ฒ
When to use:Handling exceptions during test execution, parsing, or when dealing with unstable inputs like API responses, browser states, or external systems.
Example:
Handle potential exceptions during array access or parsing
try {
int result = Integer.parseInt("123a"); // Will throw NumberFormatException
System.out.println("Parsed number: " + result);
} catch (NumberFormatException e) {
System.err.println("Invalid number format: " + e.getMessage());
}
๐ ๐ฅ๐ฒ๐ด๐ฒ๐ & ๐ฃ๐ฎ๐๐๐ฒ๐ฟ๐ป ๐ ๐ฎ๐๐ฐ๐ต๐ถ๐ป๐ด โ ๐๐ผ๐ฟ ๐๐ผ๐ด ๐๐ถ๐น๐ฒ ๐ฉ๐ฎ๐น๐ถ๐ฑ๐ฎ๐๐ถ๐ผ๐ป
Extract timestamps, validate test output format, match dynamic URLs.
Example:
Pattern p = Pattern.compile("Error: (\\d+)");
Matcher m = p.matcher(logLine);
if (m.find()) Sysout("Error Code: " + m.group(1));
-x-x-x-
๐ Watch Mock Interviews here: http://youtube.com/@automatewithsidharth
#sidpost #qa #sdet #career #automation