
In this introductory lecture, we will explore TestNG, a powerful testing framework for Java. We’ll discuss its purpose, advantages, and how it fits into the broader ecosystem of testing tools. Attendees will gain a clear understanding of TestNG’s role in automated testing and its basic concepts.
This lecture dives into the core features of TestNG. We’ll cover its key functionalities, including test configuration, parallel test execution, and flexible test management. By understanding these features, you'll see how TestNG enhances test efficiency and effectiveness.
Here, we will walk through a hands-on example of creating a basic TestNG class. You’ll learn how to set up a TestNG project, create a test class, and write simple test methods. This practical demonstration will lay the foundation for more advanced TestNG features.
Expanding on the previous lecture, we’ll create a TestNG class focused on managing and testing employee details. This example will demonstrate how to structure your test cases and use TestNG annotations to manage your tests effectively.
In this session, we’ll run the TestNG tests created in earlier lectures and analyze the test results. We’ll discuss how to interpret the output, troubleshoot common issues, and ensure that your tests are executing as expected.
TestNG annotations are crucial for configuring and controlling test execution. This lecture provides an in-depth look at various annotations such as @Test, @BeforeMethod, and @AfterMethod. We’ll use practical examples to demonstrate how these annotations impact test behavior.
We will explore how to manage test dependencies with TestNG. This lecture will cover how to specify dependencies between tests and handle scenarios where certain tests must be executed before others, ensuring that your test suite is both organized and reliable.
Learn how to test for exceptions using TestNG in this lecture. We’ll discuss how to verify that your code correctly handles exceptional conditions and how to use TestNG’s facilities to assert that exceptions are thrown as expected.
This lecture introduces TestNG test suites and how to configure them. We will cover the basics of creating and organizing test suites, and how to define groups of tests that can be executed together to validate different aspects of your application.
Building on the previous lecture, we will delve deeper into advanced configurations for TestNG test suites. Topics include suite-level configurations, parallel execution, and optimizing your test suite for large-scale testing scenarios.
In this lecture, we’ll focus on TestNG’s grouping feature. Learn how to categorize tests into groups and how to execute specific groups. This is useful for running subsets of tests based on different criteria or phases of development.
Continuing from the previous lecture, we will explore advanced techniques for managing and executing test groups. We’ll cover how to configure and fine-tune group execution to align with various testing strategies.
Learn how to use TestNG to ignore specific tests under certain conditions. This lecture will demonstrate how to use the @Ignore annotation and related features to selectively bypass tests that are not currently applicable or that are known to be failing.
Discover how to use TestNG’s Data Providers to supply different sets of parameters to your tests. We’ll show you how to create data-driven tests that can run multiple scenarios using varying input data, improving test coverage and robustness.
In this final lecture, we will explore additional techniques for parameterizing tests. We’ll discuss how to use parameters effectively within TestNG to handle different test cases and configurations, enhancing your test flexibility and efficiency.
Develop and test an embedded doctor management system in Java using test engine, perform CRUD operations, and apply unit testing concepts to manage doctor specialization and hospital records.
Learn to implement a schema (pojo) class for a doctor in a hospital management app, including constructors and getters/setters within a Java Eclipse project.
Define a doctor schema with id, first name, last name, and specialization, implement default and parameterized constructors, and generate getters and setters in eclipse for crud data handling.
Create a doctor collection using an array list to add doctors and display them, including by specialization, using generics, auto generated ids, and an iterator.
Create and manage a collection of doctor objects to perform CRUD operations, including add, delete by id, update, and display by specialization in a tabular format.
Create a UI package, a hospital main class, and a console menu to add, display all doctors, delete doctors, and display by specialization.
Create and manage a doctor collection through a simple UI: add, display all, display by specialization, and delete by ID, with a menu-driven flow and input handling.
Develop doctor data validations with a dedicated validation class, using regex patterns for a 3-digit id, names, and a limited specialization list (heart, kidney, brain, eye, lungs).
Apply id, first name, last name, and specialization validations in a Java TestNG mastery course, and implement true/false checks with error messages and exception handling.
Define a user defined exception class for validations, extend exception or throwable, implement default and parameterized constructors, and use try-catch with throw and throws to propagate errors.
Install the TestNG engine in Eclipse via the update site and configure Maven to run tests, noting TestNG’s dependency testing and support for annotation-based and XML-based configurations.
Discover how to configure TestNG in Java, set up before and after test annotations, and write unit tests for a doctor collection that cover adding, displaying, and managing doctors.
Master unit testing with TestNG by validating doctor display logic, empty lists, and specialization filtering, using before test, after test, before method, and after method annotations.
Learn to implement a test engine and testing framework in a Java embedded application, compare JUnit and NUnit concepts, and master test suites, collections, and validation.
create a java pojo class named customer with fields for customer id, name, salary, account type, and loan amount; generate getters, setters, and an auto-incrementing constructor.
Create a console-based Java UI for XYZ bank application, defining a com.demo.UI package, a main-class, and a scanner-driven menu with options to add, display, check loan eligibility, or exit.
Develop a persistent user interface in java testng mastery by implementing an infinite while loop with add customer and display customer, switch cases, and method implementations.
Create a com.demo.data.customerData class with an ArrayList of customer, an addCustomer method using name, account type and salary, plus loan amount logic and customer ID output.
Display all customers with an iterator over an array list, printing id, name, and salary with a header, then check loan eligibility by id and loan amount.
Implement a user interface layer in Java that creates a customer data object, seeds an ArrayList, adds and displays customers, and checks loan eligibility through interactive prompts.
Create a customer validation class in the com.demo.validation package that uses regex patterns to validate a name, a salary, and an account type (savings or current).
Implement and enforce data validations for user inputs by validating name, account type, and salary using a validation class and regular expressions, with clear error messages and proper error handling.
Explore how to create and use a custom exception in Java by building a customer exception, throwing it in validation, and handling it with try-catch.
Validate customer data in a Java application by enforcing savings or current account formats and seven-digit IDs. Compare static and non-static ID handling while debugging to ensure customer ID generation.
TestNG-based validation of a Java banking app’s customer data workflow, including add customer, display customer, and loan eligibility, with setup initializing the CustomerData object.
Learn how to test customer data with TestNG by validating loan eligibility and adding customers, including creating a customer object, setting and retrieving the customer ID, and asserting expected results.
Master testing customer validation with TestNG by creating a customer validation object, implementing tests for name, salary, and account type, and configuring suites to run multiple classes.
Run the UI segment to verify the app, add and display data, check loan eligibility, and review TestNG suite results, including parameters and failures.
Explore the basics of Selenium, address common questions for newcomers, and set up the required Java installation and Eclipse download to run Selenium tests.
Learn what Selenium is and why to use it for web automation, including browser automation, cross-browser support, languages, and core components such as Selenium IDE, RC, WebDriver, and Grid.
Learn how to install Java and set up a test environment for Selenium scripts. Verify installation via program files paths and Java -version to confirm 64-bit or 32-bit setup.
Download Eclipse from the official pages, select Eclipse IDE for Java EE developers on Windows 64-bit, extract the zip, and launch Eclipse with a workspace.
Create a rectangle area program in Eclipse by adding a class in src and writing a main method, then run .class file. Covers build path, Java version, and save actions.
Master Eclipse preferences—from appearance and fonts to line numbers and editor hovers—and configure startup, updates, Javadoc, and Java editors for efficient Java and Selenium work.
Master the different types of views discussed in this lecture, including console, declaration, error log, javadoc, navigator, project explorer, outline, and terminal, and switch to the debug perspective for testing.
Master debugging in Java with Eclipse by setting breakpoints, toggling them, and using the debug perspective to modify values, step through code, and inspect variables.
Consolidate Eclipse IDE tooling for business workflows and prepare for the next session on Selenium IDE, where you will learn how it works and how to prepare Selenium test scripts.
The lecture introduces Selenium IDE, its recording and debugging features, and guides you to create a Flipkart project to automate six tests, plus installing the Firefox extension and browser limitations.
Install Selenium IDE for Firefox and verify its readiness, and learn JavaScript basics to write extensions for Selenium IDE while using Firebug and FirePath to identify elements and generate XPath.
Record and debug scripts with selenium IDE to capture base URL, test cases, and commands, then debug login flows on Flipkart using CSS and XPath for element identification.
Master pause and step execution to control test flows with breakpoints and slow mode, and learn recording actions, inserting commands, and echoing stored variables like product name.
Master wait commands in Selenium IDE to handle alerts and page load timing, including wait for alert, wait for alert present, pausing scripts, and using alternate element identifiers.
Explains the difference between verify, assert, and wait for alert vs wait for alert present in Java test automation, including automatic alert acceptance and text verification.
Demonstrate verify versus assert for page title validation in Selenium IDE, showing how verify title logs failures but continues test execution, while assert title stops the test immediately on mismatch.
Master storing values with the store command, echoing variables, and copying data between variables in Selenium IDE, then access storedVars array and handle JavaScript case sensitivity.
Master store eval with stored vars to access and update variables without the JavaScript keyword, including role assignment and salary increments, and convert text to numbers for arithmetic.
Master JavaScript basics for Selenium IDE, enabling user extensions with external plugins and custom commands. Learn to write scripts, manipulate the DOM, and create objects with properties through hands-on examples.
Move a JavaScript function to a separate file, link it via a script tag, and call getdate with an onclick event to demonstrate modular, reusable JavaScript.
Master user extensions basics for Selenium IDE by creating custom JavaScript functions and loading them through Selenium core extensions. Load an extension file, restart IDE, and execute prototype do and do while commands.
Learn to use the while function in selenium IDE, and build custom user extensions with JavaScript, including store eval, parameter passing, and IDE reloads to reflect changes.
Learn how to use regular expressions to extract and validate text in automated tests, with practical examples in selenium IDE, JavaScript, and xpath.
Master regular expressions to extract text and numbers, such as 3.5, using core patterns and the regex cheat sheet. Apply these techniques in automated tests and custom functions.
Create a new test case in Selenium IDE and learn to use regular expressions with regexp in the target to locate links such as Flipkart customer care and track order.
Automate six Flipkart tests with selenium IDE, including login, view gift card balance, count links, add item, delete from cart, and logout.
Learn how to store text from elements using the correct command and locator, and verify the balance while running the Java TestNG test suite.
Shows how to count all page links using a JavaScript snippet: window.document.getElementsByTagName('a').length, demonstrated on the Flipkart home page with 771 links. Also demonstrates embedding JavaScript in the test target.
Explore debugging a TestNG Selenium script that uses XPath variations, send keys, and clicks to search a product, add to cart, and handle element not found with waits.
Master selenium web driver to add items to the cart on flipkart, using xpath-based identification and waits to verify the item is added.
Explore constructing and debugging a test suite for an e-commerce flow in Java with TestNG, focusing on login, add to cart, and deleting from cart while managing waits and timeouts.
Automate deleting items from a cart and verify removal using XPath, stored messages, and final message checks, with waits and logging in a Java TestNG workflow.
Execute the log out test case on the Flipkart base url, asserting the logout text to verify sign out and handle waits while adding and deleting items from the cart.
Learn to parameterize test cases in Selenium IDE by using JavaScript to read a test data XML file, enabling login with multiple credentials without duplicating tests.
Parameterize test cases by loading multiple credentials from a test data XML. Use a data load function to parse username and password tags with a while loop in Selenium IDE.
Learn to parameterize test cases using an external data source, read login credentials from an XML data file, and drive a login workflow in Flipkart with validation.
Learn how to capture screenshots in selenium ide using the built-in capture entire page screenshot command and the screenshot on fail plugin, saving images with timestamps to a designated folder.
Wrap up this module by covering Selenium IDE basics, including install and record, waits, verifications, and assertions, plus JavaScript, custom functions, external files, loops, extensions, parameterization, and screenshots.
Learn why test frameworks like TestNG and JUnit streamline executing many tests, enable parallel runs, grouping, and reports. Explore installing TestNG in Eclipse with JDK seven plus and verification steps.
Learn the different types of annotations in test engine, set up a project, add the library, resolve imports, and run a @Test method that prints a message.
Explore how TestNG annotations drive test execution, generate test engine reports, and view passed, failed, and skipped results through html and xml reports.
Understand the testng annotation sequence, from before suite to after suite, including before test, before method, after method, before class, and after class.
Explore the TestNG annotation calling sequence, detailing before suite and after suite setup and teardown, as well as before test data fetch from XML and login and add-to-cart tests.
Demonstrate TestNG timing: before class runs before the first test in the current class, while before test runs before any test in all classes in the test tag.
Create a test engine XML to run TestNG tests by defining suite, test, and class sequences, then execute before test and before class annotations, with utf eight encoding.
Execute testng.xml from a Java main method by loading the XML into a list, setting test suites, and running the test engine as a Java application.
Learn to run a test ng xml file from the command prompt by invoking test ng suite without a main method, and manage dot class files and classpath via javac.
Compile class files into the bin directory, then run testng from the command prompt by setting the class path to include testng.jar and bin directory, and executing org.testng.TestNG with testng.xml.
Learn to run testng tests via a batch file by setting the project path, navigating to the project, and executing test engine xml using the bin and lib directories.
Schedule a batch file in Windows Task Scheduler to automate your Java test suite at a scheduled time, running with highest privileges and configured triggers, actions, and server-based runs.
Learn how TestNG annotations control test execution order with priority, before/after hooks, and XML-driven sequencing. Implement timeouts to ensure tests complete within a defined period.
Learn how to control test execution with invocation count and invocation timeout in TestNG, ensuring a method runs multiple times and handles timeouts correctly.
Learn how to use the enabled attribute in TestNG to selectively run or ignore tests, control at method and class levels, and override behavior via test engine XML.
Group test methods in TestNG using group names and testng.xml, and control execution with enabled flags and skip exceptions. Understand how grouping affects total runs, failures, and skips.
Master TestNG grouping by running specific groups with include options; combine groups like add items and delete items to execute related tests, plus data prep tasks and XML data fetch.
Explore how to organize TestNG tests with groups of groups, dependencies, and XML data, then simulate end-to-end email workflows using open Gmail, compose email, and send email.
Parameterize test cases in test engine using the @parameters method and the @data provider, passing a product name like Sennheiser via testng.xml and accessing it in tests.
Explore how to use the parameter annotation to pass multiple parameters, ensure parameter names match exactly, and understand how suite-level versus test-level definitions control the scope of parameter values.
Learn how data providers pass multiple data sets to TestNG tests by linking external sources and returning a two-dimensional array for each username and password entry.
Demonstrates retrieving test data from an external source using TestNG DataProvider by reading credentials from an Excel sheet via a utility reader, handling path issues, and iterating rows and columns.
Master data provider in TestNG by reading login data from Excel into a two-dimensional array, mapping rows and columns to usernames and passwords for tests.
Centralize data providers in a dedicated hub class to feed login, add product, and search tests from Excel worksheets, using explicit provider names.
Master TestNG data providers by fetching test data from an Excel sheet to drive login and product searches, while resolving jar and data provider name issues.
Diagnose login test failures caused by a class mismatch in TestNG, import javax.inject and guice jars, and enable Excel-based data providers to run multiple data-driven tests from a single class.
Learn how data providers in TestNG are named and how omitting the name defaults to the method, causing skipped tests unless the login data provider is set to login.
Explore using a single data provider to support multiple test methods, customizing data via method names in a data repository for login, add product, and search product.
utilize ITestContext to access runtime test information and share data across tests through set attribute and get attribute within a data provider flow.
Explore how eye test context enables web service testing by saving a response as a unique key attribute for reuse in later tests, and support custom reports and console insights.
Learn how to run TestNG tests in parallel by configuring the suite with a thread-count and parallel attribute, compare parallel versus sequential execution, and balance threads to optimize resources.
Use a single data provider to support multiple test methods by branching on the method name, enabling login, add product, and search scenarios.
Explore how ITestContext shares data across tests via set attribute and get attribute, retrieve test names, and build custom reports for data providers and web service testing.
Learn to run tests in parallel with the test engine by configuring the suite tag and thread count, and balance threads to avoid resource limits.
Learn to run tests in parallel with TestNG by configuring suite-level and class-level parallelism, setting thread counts, and inspecting thread IDs to verify concurrent execution.
Explore how TestNG executes test methods in separate threads with parallel equals methods, preserving declared order across test, class, and method levels.
Configure the thread pool size to run test methods across multiple threads as defined by the invocation count, and observe how tests distribute between threads for parallel execution.
Learn how to retry failed TestNG tests with the IRetryAnalyzer interface, implement and configure a retry, and apply a workaround to align results when reporting retries.
Learn to automate retry of failed tests in TestNG by implementing an AI annotation transformer and a listener, registering in testng.xml and configuring transform method to set a retry analyzer.
Develop a custom after-suite correction using ITestContext to gather past, failed, and skipped tests, then apply a hash-based ID comparison to remove mismatches and produce a consolidated, accurate retry result.
Mastering TestNG course demonstrates using ITestContext to clean results, remove skipped tests, and log outcomes with a custom retry analyzer.
Apache Ant, a Java-based build and deploy tool, automates compilation, deployment, and test execution. Learn to configure and run a TestNG project via Ant from the command line.
Download the ant binary, unzip it, configure ANT_HOME and PATH to the bin directory, verify with ant -version, and handle tools.jar issues by copying from the JDK lib.
Create and configure a build.xml to drive Ant builds for testing, defining targets to compile, clean, and run tests, with base dir and properties guiding jars and reports.
Explore building a TestNG project with an existing build.xml: define properties like base dir and jars, configure classpath, run targets such as clean and compile, and generate TestNG XSLT reports.
Master executing classpath and ant build flows with OS-aware property setting, conditional wiring of set classpath, and running testng tasks to compile, run, and generate test engine XML reports.
Generate Excel XSLT reports with pie charts from test engine results using Saxon jars. Learn build.xml changes, project setup, and how to visualize pass, fail, and skip cases.
Learn to generate TestNG XSLT reports by executing tests with skip and failure outcomes, interpreting pass rate and results overview, and configuring build.xml paths, while comparing Ant and Maven later.
Compare maven and svn: svn handles code versioning with check-in and get latest, while maven resolves jar dependencies from the central repository via pom.xml.
Master the maven build life cycle and create a project from the command prompt using archetype, configuring group id, artifact id, version, and packaging in pom.xml.
Import a maven project into eclipse by running mvn eclipse, which downloads junit 4.12 and creates the .classpath and .project files for eclipse compatibility.
Import a Maven project into Eclipse, inspect pom.xml to manage dependencies (group ID, artifact ID, and version), and use mvn compile to download JUnit versions for test and main code.
Modify the test case in app test.java by adding sample tests and prints. Use test ng or junit with pom.xml, run maven phases, and generate a jar for central repository.
Convert an existing test project to Maven in Eclipse by converting to a Maven project, generating a pom.xml and target folder, and let Maven download dependencies from the central repository.
Learn to configure a Maven project, manage dependencies including POI, run clean builds and tests with the surefire plugin, and review emailable test reports.
Course Introduction
Welcome to the Java TestNG Mastery Course, your comprehensive guide to mastering TestNG, a powerful testing framework for Java applications. This course is designed to take you from a beginner to an advanced user, equipping you with the knowledge and skills needed to efficiently test and validate your Java applications using TestNG. Whether you're just starting out or looking to enhance your testing capabilities, this course provides a structured approach to learning TestNG.
Section 1: Java TestNG Fundamentals
In this section, you will be introduced to the basics of TestNG, including its features and how it enhances Java testing. You'll learn how to create and run TestNG classes, understand TestNG annotations, and explore dependency and exception tests. This section lays the groundwork for effectively using TestNG in your projects by covering essential topics such as test suites, groups, and data providers.
Section 2: Java TestNG Case Study - Doctor Management System
This section dives into a practical case study involving a Doctor Management System. You'll apply what you've learned to create schema classes, perform CRUD operations, and build a user interface. You'll also implement validations, handle exceptions, and conduct unit testing using TestNG. This hands-on project helps solidify your understanding of TestNG by applying it to a real-world scenario.
Section 3: Java TestNG Case Study
Building on the previous case study, this section presents another comprehensive project that involves creating a customer management application. You'll develop POJO classes, build a user interface, and implement methods for adding and displaying customers. The focus is on validating customer data and ensuring the application flows correctly, culminating in thorough testing using TestNG.
Section 4: Selenium - Selenium IDE
Here, you'll be introduced to Selenium IDE, a powerful tool for automating web application testing. You'll learn how to install and use Eclipse, record and debug scripts, and perform various commands like wait, verify, and assert. The section also covers JavaScript basics, user extensions, and regular expressions, providing a strong foundation for automating web tests with Selenium IDE.
Section 5: Selenium - TestNG Integration
This section focuses on integrating TestNG with Selenium for enhanced testing capabilities. You'll explore different types of annotations, test methods, grouping, and parameterizing test cases. The section also covers executing tests in parallel, retrying failed tests, and running TestNG suites, providing you with advanced techniques to streamline your testing process.
Section 6: Selenium - TestNG with Apache Ant and Maven
In the final section, you'll learn how to use Apache Ant and Maven with TestNG to manage and build your projects. You'll configure Ant, create and execute build files, and generate XSLT reports. The section also covers Maven project creation, importing, and modifying test cases, as well as converting existing projects to Maven, ensuring you can efficiently manage and automate your testing workflow.
Course Conclusion
By the end of this course, you will have a deep understanding of TestNG and its integration with Selenium, Ant, and Maven. You’ll be able to create, manage, and execute comprehensive test suites, automate testing processes, and apply best practices in your Java applications. This course empowers you with the skills to ensure your software is reliable, efficient, and ready for production.