💡 1 Java Concept Every QA Should Know – #21: List (ArrayList) – Most Used Collection in Automation 🔥 After arrays, the next big upgrade in automation is 👉 Collections And the most commonly used one is ArrayList --- 🔹 What is a List? A List is used to store multiple values dynamically 👉 Unlike arrays, it can grow or shrink in size --- 🔥 Example (ArrayList) import java.util.ArrayList; import java.util.List; List<String> users = new ArrayList<>(); users.add("admin"); users.add("user1"); users.add("user2"); --- 🔥 QA Use Case 👉 Store multiple test data 👉 Capture list of web elements 👉 Handle dynamic data for(String user : users){ System.out.println("Testing login with " + user); } --- 🎯 Why it matters? ✔ Dynamic size (no fixed limit like arrays) ✔ Easy to add/remove data ✔ Widely used in frameworks --- ❗ Common Mistakes ❌ Using arrays instead of List everywhere ❌ Not using generics ("<String>") ❌ Ignoring iteration --- 💡 Pro Tip 👉 Use "List" interface instead of "ArrayList" directly List<String> users = new ArrayList<>(); --- 💡 My Learning Moving from arrays → collections was a big shift for me It made my automation scripts more flexible and scalable 💪 --- 📌 Tomorrow → Set (HashSet) – Handling duplicates 🔥 Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #SoftwareTesting #LearningJourney
Java QA: ArrayList Basics and Best Practices
More Relevant Posts
-
💡 1 Java Concept Every QA Should Know – #22: Set (HashSet) – Handling Duplicates 🔥 In automation, I once faced a strange issue… 👉 Same test data was getting repeated That caused unexpected test results 😅 That’s when I started using Set 👇 --- 🔹 What is a Set? A Set is a collection that does NOT allow duplicate values --- 🔥 Example (HashSet) import java.util.HashSet; import java.util.Set; Set<String> users = new HashSet<>(); users.add("admin"); users.add("user1"); users.add("admin"); // duplicate System.out.println(users); 👉 Output will contain only unique values --- 🔥 QA Use Case 👉 Remove duplicate test data 👉 Validate unique elements 👉 Handle unique IDs / responses --- 🎯 Why it matters? ✔ Automatically removes duplicates ✔ Improves data accuracy ✔ Useful in validations --- ❗ Important Points ✔ No duplicates allowed ✔ Order is NOT guaranteed ✔ Faster lookup compared to List --- ❗ Common Mistakes ❌ Expecting ordered output ❌ Using Set when duplicates are needed ❌ Not understanding uniqueness behavior --- 💡 Pro Tip 👉 Use Set when uniqueness matters more than order --- 💡 My Learning Sometimes bugs are not in application… They are in test data duplication. Using Set helped me avoid such issues 💪 --- 📌 Tomorrow → Map (HashMap) – Key-value magic for test data 🔥 Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #TestAutomation #LearningJourney
To view or add a comment, sign in
-
💡 1 Java Concept Every QA Should Know – #25: Exception Handling (Handling Failures Gracefully 🔥) In automation, failures are inevitable… 👉 Element not found 👉 API failure 👉 Timeout issues But the real question is: 👉 Does your script crash or handle it smartly? That’s where Exception Handling comes in 👇 --- 🔹 What is Exception Handling? It helps you handle runtime errors without breaking execution --- 🔥 Basic Example try { int result = 10 / 0; } catch (Exception e) { System.out.println("Error handled"); } --- 🔥 QA Use Case 👉 Handle element not found 👉 Catch API failures 👉 Prevent test crashes try { System.out.println("Click login button"); } catch (Exception e) { System.out.println("Element not found"); } --- 🎯 Why it matters? ✔ Prevents script failure ✔ Helps in debugging ✔ Improves test stability --- 🔹 Finally Block (Important) finally { System.out.println("Cleanup actions"); } ✔ Always executes (even if exception occurs) --- ❗ Common Mistakes ❌ Catching generic Exception everywhere ❌ Ignoring errors silently ❌ Overusing try-catch --- 💡 Pro Tip 👉 Catch specific exceptions (like "NoSuchElementException") 👉 Always log meaningful messages --- 💡 My Learning Good automation doesn’t avoid failures… It handles them smartly. --- 📌 Tomorrow → File Handling (Reading test data 🔥) Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #TestAutomation #LearningJourney
To view or add a comment, sign in
-
💡 1 Java Concept Every QA Should Know – #26: File Handling (Reading Test Data 📂🔥) In real automation projects, test data rarely comes from code… 👉 It comes from files (Excel, JSON, Text, etc.) That’s where File Handling becomes important 👇 --- 🔹 What is File Handling? It allows you to read and write data from files --- 🔥 Basic Example (Reading a File) import java.io.File; import java.util.Scanner; File file = new File("test.txt"); Scanner sc = new Scanner(file); while(sc.hasNextLine()) { System.out.println(sc.nextLine()); } --- 🔥 QA Use Case 👉 Read test data from files 👉 Data-driven testing 👉 Validate logs or reports --- 🎯 Why it matters? ✔ Separates test data from code ✔ Easy to maintain ✔ Supports large datasets --- ❗ Common Mistakes ❌ Not handling exceptions ❌ Hardcoding file paths ❌ Not closing resources --- 💡 Pro Tip 👉 Use "try-with-resources" to auto-close files try(Scanner sc = new Scanner(new File("test.txt"))) { while(sc.hasNextLine()) { System.out.println(sc.nextLine()); } } --- 💡 My Learning Automation becomes powerful when data is external and dynamic File handling is the first step towards real-world frameworks 💪 --- 📌 Tomorrow → Java + Selenium (How Java powers UI Automation 🔥) Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #SoftwareTesting #LearningJourney
To view or add a comment, sign in
-
𝗤𝗔 𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗼𝗻 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗤𝘂𝗲𝘀𝘁𝗶𝗼𝗻𝘀 – 𝗖𝗮𝗽𝗴𝗲𝗺𝗶𝗻𝗶 1. Explain Java exception handling and its importance. 2. What is the difference between `final`, `finally`, and `finalize` keywords in Java? 3. Compare and contrast `ArrayList` and `LinkedList` in Java. 4. What are the key differences between `HashSet` and `Map` in Java? 5. Provide an example of using a `Map` in Java. 6. Write a Java program to reverse a string. 7. Explain the architecture of Appium and how it functions. 8. What are Desired Capabilities in Appium, and how are they used? 9. What is an Appium package and activity, and how are they configured? 10. Why is Appium preferred for mobile automation testing? 11. How do you handle timeouts in Appium tests? 12. What challenges have you encountered while using Appium, and how did you overcome them? 13. What are the different types of locators used in Appium? 14. What are the best practices to follow when using Appium for automation? 15. What is the difference between `findElement` and `findElements` in Appium/Selenium? 16. Explain the concept of Appium Grid and its use cases. 17. What is the purpose of `BeforeSuite` and `AfterSuite` annotations in TestNG? 18. Explain the structure and purpose of a TestNG XML file. 19. How does `dependsOnMethods` work in TestNG, and when would you use it? 20. What are the different types of waits available in Selenium, and when should each be used? 21. Explain the role of Jenkins in CI/CD pipelines. 22. How are reports generated in TestNG, and what types of reports can be produced? 23. What is the difference between method overloading and method overriding in Java? 24. Explain the concept of polymorphism in Java and provide examples. 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦-𝐉𝐚𝐯𝐚 & 𝐏𝐥𝐚𝐲𝐰𝐫𝐢𝐠𝐡𝐭-𝐓𝐲𝐩𝐞𝐒𝐜𝐫𝐢𝐩𝐭 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐒𝐭𝐚𝐫𝐭𝐬 𝐨𝐧 𝟐𝟎𝐭𝐡 𝐀𝐩𝐫𝐢𝐥 𝟐𝟎𝟐𝟔! 𝐑𝐞𝐠𝐢𝐬𝐭𝐞𝐫 𝐧𝐨𝐰 𝐟𝐨𝐫 𝐟𝐫𝐞𝐞 𝐝𝐞𝐦𝐨 𝐜𝐥𝐚𝐬𝐬𝐞𝐬: https://lnkd.in/gWW-pJxC Follow Krishna Kumari for more.
To view or add a comment, sign in
-
💡 1 Java Concept Every QA Should Know – #23: Map (HashMap) – Key-Value Magic for Test Data 🔥 In automation, we often deal with structured data like: 👉 username → admin 👉 password → 1234 Storing this in arrays or lists becomes confusing… That’s where Map becomes a game changer 👇 --- 🔹 What is a Map? A Map stores data in key-value pairs 👉 Each key is unique 👉 Value can be anything --- 🔥 Example (HashMap) import java.util.HashMap; import java.util.Map; Map<String, String> userData = new HashMap<>(); userData.put("username", "admin"); userData.put("password", "1234"); --- 🔥 QA Use Case 👉 Store test data (username, password) 👉 Handle API request/response data 👉 Manage dynamic values System.out.println(userData.get("username")); --- 🎯 Why it matters? ✔ Easy to manage structured data ✔ Faster access using keys ✔ Very useful in frameworks --- ❗ Important Points ✔ Keys must be unique ✔ Values can be duplicate ✔ Order is NOT guaranteed (HashMap) --- ❗ Common Mistakes ❌ Using wrong key names ❌ Not checking for null values ❌ Expecting ordered output --- 💡 Pro Tip 👉 Use meaningful keys like ""username"", ""token"" 👉 Helps in better readability --- 💡 My Learning When test data becomes complex… Map makes it simple and manageable 💪 --- 📌 Tomorrow → Iterator & Looping in Collections (Handling data efficiently 🔁🔥) Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #SoftwareTesting #LearningJourney
To view or add a comment, sign in
-
🚀 20 Core Java Concepts Every Tester MUST Master! If you’re into Automation Testing (SDET / QA), Java isn’t just a programming language — it’s the foundation of your scripts, frameworks, and logic 🧠 Here are the 20 must-know Core Java topics that make every automation tester stronger 👇 📘 BASICS 1️⃣ Data Types & Variables 2️⃣ Loops & Conditional Statements 3️⃣ Arrays & Strings 4️⃣ Methods (Static / Non-Static) 5️⃣ OOP Concepts (Encapsulation, Inheritance, Polymorphism, Abstraction) 6️⃣ Constructors 7️⃣ Access Modifiers 8️⃣ Packages & Imports 9️⃣ Exception Handling (try-catch-finally) 🔟 File Handling ⚙️ ADVANCED 11️⃣ Collections Framework 12️⃣ List, Set, Map Interfaces 13️⃣ Generics 14️⃣ Wrapper Classes 15️⃣ StringBuilder vs StringBuffer 16️⃣ Multithreading (Thread class & Runnable) 17️⃣ Synchronization & wait/notify 18️⃣ Lambda Expressions 19️⃣ Streams API 20️⃣ File I/O (Reader, Writer, InputStream, OutputStream) 💡 Master these, and you’ll not only write better scripts — you’ll debug, optimize, and scale like a pro. 👇 Which concept do you still find tricky #Java #SDET #SoftwareTesting #AutomationTesting #QATribe #TestingCommunity #CodingForTesters #LearningNeverStops
To view or add a comment, sign in
-
-
💡 1 Java Concept Every QA Should Know – #16: Encapsulation (Secret Behind Page Object Model 🔐🔥) When I first heard about Page Object Model (POM), it felt complex… But later I realized: 👉 It’s just Encapsulation in action. --- 🔹 What is Encapsulation? Encapsulation means hiding data and exposing only what is needed. 👉 We restrict direct access and control it using methods --- 🔥 Basic Example class LoginPage { private String username; public void setUsername(String username) { this.username = username; } public String getUsername() { return username; } } --- 🔥 QA Use Case (POM 🔥) 👉 Web elements are kept private 👉 Actions are exposed via public methods public void login(String user) { // enter username & password } --- 🎯 Why it matters? ✔ Protects data ✔ Improves security ✔ Makes framework clean ✔ Easy to maintain --- ❗ Common Mistakes ❌ Making everything public ❌ Directly accessing variables ❌ Not using getters/setters properly --- 💡 Pro Tip 👉 Always keep variables private 👉 Expose only required actions --- 💡 My Learning Encapsulation is not just a concept… It’s the reason why Page Object Model works so well. --- 📌 Tomorrow → Inheritance (Code reuse in frameworks 🔁🔥) Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #TestAutomation #LearningJourney
To view or add a comment, sign in
-
💡 1 Java Concept Every QA Should Know – #14: This Keyword (Small Concept, Big Impact 🔥) When I first saw "this", I ignored it thinking it’s not important… Later in frameworks, I realized: 👉 Without "this", many things break silently. --- 🔹 What is "this"? "this" refers to the current object of the class. --- 🔥 Example class LoginPage { String user; LoginPage(String user) { this.user = user; } } 👉 Here: - "this.user" → instance variable - "user" → constructor parameter --- 🔥 QA Use Case 👉 Passing test data into Page Objects 👉 Avoiding variable confusion 👉 Clean constructor initialization --- ❗ Common Problem Without "this" 👇 user = user; // ❌ does nothing 👉 Both refer to same variable → value not assigned properly --- 🎯 Why it matters? ✔ Avoids naming conflicts ✔ Helps in clean object initialization ✔ Used heavily in frameworks --- 💡 Pro Tip 👉 Use "this" when parameter name = instance variable name --- 💡 My Learning Small keywords like "this" may look simple… But they play a huge role in writing correct and bug-free code. --- 📌 Tomorrow → OOP Introduction (Foundation of all frameworks 🔥) Follow this series if you're learning automation 👍 #Java #QA #AutomationTesting #SDET #TestAutomation #LearningJourney
To view or add a comment, sign in
-
💡 1 Java Concept Every QA Should Know – #28: Java in API Testing (RestAssured Basics 🔥) UI testing is powerful… But real speed in automation comes from 👉 API Testing That’s where Java + RestAssured becomes a game changer 🚀 --- 🔹 What is RestAssured? RestAssured is a Java library used to test REST APIs easily 👉 It simplifies sending requests & validating responses --- 🔥 Basic Example (GET Request) import static io.restassured.RestAssured.*; given() .when() .get("https://lnkd.in/g7JYGise") .then() .statusCode(200); --- 🔥 QA Use Case 👉 Validate API status codes 👉 Verify response body 👉 Automate backend testing --- 🎯 Why it matters? ✔ Faster than UI tests ✔ More stable ✔ Covers backend logic --- 🔥 Response Validation Example given() .when() .get("https://lnkd.in/g7JYGise") .then() .statusCode(200) .body("data.id", equalTo(2)); --- ❗ Common Mistakes ❌ Only focusing on UI testing ❌ Not validating response body ❌ Ignoring negative test cases --- 💡 Pro Tip 👉 Combine API + UI testing for better coverage 👉 Validate both status code and data --- 💡 My Learning Strong QA engineers don’t just test UI… They validate the complete system (UI + API) 💪 --- 📌 Tomorrow → TestNG Basics (Structuring your automation 🔥) Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #APITesting #RestAssured #LearningJourney
To view or add a comment, sign in
-
💡 1 Java Concept Every QA Should Know – #24: Iterator & All Loops in Java (Handling Data Efficiently 🔁🔥) In automation, we constantly deal with data… 👉 Lists, Sets, API responses But the real skill is: 👉 How efficiently you loop through that data --- 🔹 1. Iterator (More Control) Iterator<String> it = users.iterator(); while(it.hasNext()) { System.out.println(it.next()); } ✔ Useful when you need controlled traversal --- 🔹 2. Enhanced For-Loop (Most Used ✅) for(String user : users) { System.out.println(user); } ✔ Clean and readable ✔ Best for most QA scenarios --- 🔹 3. Traditional For Loop for(int i = 0; i < users.size(); i++) { System.out.println(users.get(i)); } ✔ Useful when index is needed --- 🔹 4. While Loop int i = 0; while(i < users.size()) { System.out.println(users.get(i)); i++; } ✔ Used when condition-based looping is needed --- 🔹 5. Do-While Loop int i = 0; do { System.out.println(users.get(i)); i++; } while(i < users.size()); ✔ Executes at least once (even if condition fails) --- 🔥 Map Iteration Example for(Map.Entry<String, String> entry : userData.entrySet()) { System.out.println(entry.getKey() + " : " + entry.getValue()); } --- 🎯 QA Use Case 👉 Validate multiple UI elements 👉 Loop through test data 👉 Process API responses --- ❗ Common Mistakes ❌ Using complex loops unnecessarily ❌ Modifying collection during iteration ❌ Choosing wrong loop type --- 💡 Pro Tip 👉 Enhanced for-loop → Default choice 👉 Use others only when needed --- 💡 My Learning Automation is not about loops… It’s about choosing the right loop for the right situation 💪 --- 📌 Tomorrow → Exception Handling (Handling failures gracefully 🔥) Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #SoftwareTesting #LearningJourney
To view or add a comment, sign in
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development