💡 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
Java File Handling for QA Automation
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 – #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
-
💡 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 – #27: Java + Selenium (How Java Powers UI Automation 🔥) So far, we’ve learned Java concepts… 👉 But where do we actually use them in real QA work? The answer is 👉 Selenium + Java --- 🔹 What is Selenium? Selenium is a tool used to automate web applications (UI testing) 👉 Java is one of the most widely used languages with Selenium --- 🔥 Basic Example import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; WebDriver driver = new ChromeDriver(); driver.get("https://example.com"); System.out.println(driver.getTitle()); driver.quit(); --- 🔥 QA Use Case 👉 Automate login flows 👉 Validate UI elements 👉 Perform end-to-end testing --- 🎯 Where Java Concepts Fit? ✔ Variables → Store test data ✔ Methods → Reusable steps ✔ OOP → Page Object Model ✔ Collections → Handle multiple elements ✔ Exception Handling → Handle failures --- ❗ Common Mistakes ❌ Jumping into Selenium without Java basics ❌ Writing scripts without framework structure ❌ Hardcoding values --- 💡 Pro Tip 👉 Don’t just learn Selenium commands 👉 Focus on how Java builds scalable frameworks --- 💡 My Learning Selenium is just a tool… 👉 Java is what makes your automation powerful and maintainable --- 📌 Tomorrow → Java in API Testing (RestAssured basics 🔥) Follow for more QA-focused Java concepts 👍 #Java #QA #AutomationTesting #SDET #Selenium #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 – #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
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
-
-
🚀 Selenium + Java Streams | Automating Sort, Pagination & Filtering in Web Tables like a Pro After working extensively with Selenium, I realized one thing: 👉 Handling web tables efficiently is a true mark of an automation expert. Modern web tables come with: ✔ Sorting ✔ Pagination ✔ Dynamic filtering And this is where Java Streams + Selenium become a powerful combination 💡 Here’s how I approach it 👇 🔹 1. Capture Web Table Data Efficiently Fetch all rows and store them in a list for processing 👉 Clean and structured data = better automation 🔹 2. Sorting Validation using Streams Instead of traditional loops, I use Java Streams to: ✔ Extract column data ✔ Apply .sorted() ✔ Compare with UI values 👉 Makes validation concise and readable 🔹 3. Pagination Handling (Smart Way) ✔ Loop through pages dynamically ✔ Collect data across all pages ✔ Validate complete dataset 👉 No data should be missed! 🔹 4. Filtering Validation ✔ Apply filter on UI ✔ Capture filtered results ✔ Validate using Stream conditions (filter(), allMatch()) 👉 Ensures accurate UI behavior 🔹 5. Why Java Streams? ✅ Less code, more readability ✅ Functional programming approach ✅ Faster validation logic 💡 Pro Tip: Combine Selenium actions with Java Streams to reduce code complexity and improve test clarity significantly. 🔥 Final Thought: Automation is evolving… 👉 It’s no longer just Selenium, it’s how smartly you use Java with it. If you’re still using loops everywhere, it’s time to upgrade 🚀 👉 What’s your approach to handling web tables in automation? #Selenium #Java #AutomationTesting #QA #TestAutomation #SDET #JavaStreams #SoftwareTesting #Learning #Tech
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. 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
Explore related topics
- Software Testing Best Practices
- How to Test and Validate Code Functionality
- Tips for Testing and Debugging
- How to Understand Testing Techniques
- Foundations of Test Automation in Software Testing
- Software Testing Processes Explained
- Best Practices for Handling Software Edge Cases
- Using Sample Data for Software Testing
- How to Understand Testing in the Development Lifecycle
- Software Testing as a Process of Discovery
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