Basics of Automation
Testing
     Ruban Suvidhar R
          What is Automation Testing?
❑ Test automation is the practice of using software tools and
  scripts to run tests on other software automatically, rather
  than conducting them manually.
❑ This process helps improve software quality by running tests
  automatically, managing test data, and utilizing results to
  enhance the development process.
 Key Benefits of   Efficiency: Automation      Accuracy: Automated      Coverage: Automation      Cost Savings: While
                   significantly speeds up     tests perform the same   allows for a broader      the initial setup cost
Test Automation:   the testing process,        steps precisely every    and deeper scope of       can be high,
                   especially for repetitive   time, eliminating        testing, enabling         automated testing
                   and time-consuming          human errors.            thousands of complex      saves money in the
                   tasks.                                               test cases to be run      long run by reducing
                                                                        during each test cycle.   the need for repetitive
                                                                                                  manual testing.
Types of Automation Testing?
Unit Testing: Testing individual units of code.
Integration Testing: Testing the interaction between different modules.
Regression Testing: Retesting after code changes to ensure no new bugs are introduced.
Smoke Testing: Basic sanity checks to ensure critical functionality works.
UI Testing: Testing the user interface for usability and functionality.
API Testing: Testing the application programming interface.
Performance Testing: Testing the application's speed, scalability, and stability.
When to Automate?
• Repetitive Tests: Tests that are executed frequently.
• Data-Driven Tests: Tests that require multiple sets of input data.
• Complex Tests: Tests that are difficult or time-consuming to perform manually.
• Regression Tests: To ensure stability after code changes.
• Cross-Browser/Cross-Platform Testing: Testing on different browsers and operating systems.
• High Manual Effort & Error-Prone Areas: Automate time-consuming and error-prone tasks to
  reduce human intervention.
• Integration with CI/CD & DevOps: Helps in automating nightly builds, smoke tests, and
  deployment validations.
Challenges of Automation Testing
Initial Setup Costs: Investment in tools and infrastructure.
Maintenance Overhead: Keeping scripts updated as the application evolves.
Test Script Creation: Requires specialized skills and time.
False Positives/Negatives: Identifying and resolving test failures.
Not Suitable for All Tests: Some tests are better suited for manual execution.
No-Code & Low-Code Test Automation Tools
• Katalon Studio (Low-Code)
• TestProject (No-Code & Low-Code)
• Leapwork (No-Code)
• Tricentis Tosca (No-Code)
• ACCELQ (No-Code)
• UIPath Test Suite (Low-Code)
• Perfecto Scriptless (No-Code)
• Functionize (No-Code)
Selenium
An open-source tool for automating web browsers.
Supports multiple programming languages (Java, C#, Python, etc.).
Frameworks Models :
Data-Driven Framework: Uses external data sources (e.g., Excel, CSV) to drive test cases.
Keyword-Driven Framework: Uses keywords to represent actions to be performed on the application.
Hybrid Framework: Combines features of both Data-Driven and Keyword-Driven frameworks for more flexibility.
Behaviour-Driven Development (BDD) Framework - Writing test cases in natural language using Given-When-
Then format, making them easy to understand for non-technical team members
Popular Selenium Frameworks
TestNG: A testing framework inspired by JUnit, designed for test configuration and parallel execution.
JUnit: A simple framework to write repeatable tests, commonly used with Java.
Cucumber: Supports Behavior-Driven Development (BDD), allowing tests to be written in plain language.
When to Choose Selenium?
• For web application testing only.
• When the team has skilled developers or testers proficient in programming.
• For cost-sensitive projects where open-source tools suffice.
                                                                                    try {
                                                                                      // Open Facebook
                                                                                      driver.get("https://www.facebook.com/");
        Sample Selenium Automation Script                                             driver.manage().window().maximize();
                                                                                     // Wait for the page to load
                                                                                     Thread.sleep(2000);
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;                                                // Locate the email and password fields
import org.openqa.selenium.WebElement;                                               WebElement emailField = driver.findElement(By.id("email")); // Locate the email field
import org.openqa.selenium.chrome.ChromeDriver;                                      WebElement passwordField = driver.findElement(By.id("pass")); // Locate the password field
public class FacebookLoginAutomation {                                               // Input credentials
 public static void main(String[] args) {                                            emailField.sendKeys("your_email@example.com"); // Replace with your Facebook email
   // Set the path for the ChromeDriver                                              passwordField.sendKeys("your_password"); // Replace with your Facebook password
   System.setProperty("webdriver.chrome.driver", "path/to/chromedriver");
                                                                                     // Click the login button
   // Initialize the WebDriver                                                       WebElement loginButton = driver.findElement(By.name("login"));
   WebDriver driver = new ChromeDriver();                                            loginButton.click();
                                                                                     // Wait for a few seconds to observe the result
                                                                                     Thread.sleep(5000);
                                                                                    } catch (Exception e) {
                                                                                       e.printStackTrace();
                                                                                    } finally {
                                                                                       // Close the browser
                                                                                       driver.quit();
                                                                                    }
                                                                                }
                                                                            }
Related Tools :
Maven: A build automation tool used primarily for Java projects, helps manage project dependencies.
Jenkins: An open-source automation server used to automate the building, testing, and deployment of software.
Appium: An open-source tool for automating mobile applications, compatible with Selenium WebDriver.
  Introduction to TOSCA
• Tosca is a widely used test automation tool designed to streamline and
  optimize the software testing process.
• Developed by Tricentis, it focuses on automating functional, regression,
  and end-to-end testing.
• Tosca’s model-based testing approach enables users to create and
  manage test cases with minimal scripting knowledge, making it
  accessible to both technical and non-technical team members.
Key Features of Tosca:
Model-Based Test Automation:
Tosca uses business components or modules to represent application elements. These modules allow for efficient test case design and
maintenance.
End-to-End Testing:
Tosca supports testing across various platforms, including web, mobile, desktop, APIs, and enterprise applications like SAP and
Salesforce.
Scriptless Testing:
It eliminates the need for complex programming knowledge, enabling teams to design test cases through a drag-and-drop interface.
Reusability:
Tosca enables users to reuse test components and modules, reducing redundancy and improving efficiency.
Continuous Testing Integration:
It integrates seamlessly with CI/CD pipelines, facilitating continuous testing in Agile and DevOps environments.
Risk-Based Testing:
Tosca prioritizes test cases based on risk analysis, ensuring that critical functionalities are tested first.
API Testing:
It provides comprehensive API testing capabilities, allowing teams to validate data exchanges between systems.
Popular Automation Tools - Feature-by-Feature Comparison
                            Selenium Vs Tosca
              Feature                Selenium                              Tosca
Licensing               Open-source (free)                 Commercial (licensed)
Scripting               Requires coding knowledge          Minimal scripting required
Approach                Technical (object-oriented)        Model-based
Flexibility             Highly flexible and customizable   Less flexible, but easier to use
Learning Curve          Steeper learning curve             Easier to learn and use
Support                 Community-based support            Dedicated support from Tricentis
Cost                    Free                               Can be expensive
 Automation ROI:
Return on Investment (ROI) in test automation measures the financial and operational benefits gained from
automation compared to the costs incurred.
Achieving automation ROI depends on several factors, including test frequency, stability, and maintenance effort.
ROI is not immediate; it takes time to break even and start seeing benefits. Generally, ROI can be achieved:
• Short-Term (3-6 Months): If automating high-volume, repetitive tests (e.g., regression, smoke, sanity).
• Mid-Term (6-12 Months): If integrating automation into CI/CD for continuous testing.
• Long-Term (12+ Months): If maintaining automation scripts efficiently while reducing manual efforts over multiple
  releases.
Factors Affecting ROI Achievement
• Test Frequency: The more often a test runs, the faster ROI is achieved.
• Test Stability: ROI is higher when tests require minimal maintenance.
• CI/CD Integration: Automating within a DevOps pipeline accelerates ROI.
• Reduction in Manual Effort: The more manual work replaced, the faster ROI.
 When Automation Has Low ROI:
• One-Time or Rarely Executed Tests.
• Highly Dynamic UI with Frequent Changes.
• Exploratory or Ad-Hoc Testing.
Step-by-Step Calculation
Identify Costs (Investment in Automation)
•   Tool Costs – Licensing fees for automation tools (e.g., Selenium is free, Tosca is paid).
•   Development Costs – Initial setup, script development, framework creation.
•   Maintenance Costs – Script updates, debugging, training costs.
Identify Benefits (Savings Due to Automation)
•   Reduction in Manual Testing Effort – Cost of hours saved by automation.
•   Increase in Test Coverage – Faster and more tests lead to fewer defects in production.
•   Faster Release Cycles – Reducing test time accelerates deployments.
•   Fewer Defects in Production – Reducing post-release defect fixes saves costs.
Apply the ROI Formula:
                                    (Savings - Investment) X 100
                          ROI=
                                         Investment
Factor                   Manual Testing              Automated Testing   Savings
Tester Hourly Cost       $40                         $40                 -
Time per Regression Test
                         40 hours                    10 hours            30 hours saved
Cycle
Frequency per Year       10 cycles                   10 cycles           -
Total Yearly Cost        $16,000                     $4,000              $12,000 saved
Planning & Strategy
•   Define Automation Scope: Identify which tests are suitable for automation (e.g., regression tests, smoke
    tests, data-driven tests).
•   Select Automation Tools: Choose the right tools based on the application type, budget, team skills, and
    testing requirements.
•   Create a Test Automation Framework: Establish a structured approach for writing, organizing, and
    maintaining test scripts.
•   Resource Allocation: Allocate appropriate resources (budget, personnel, infrastructure) for the
    automation project.
Test Case Selection & Design
•   Prioritize Test Cases: Select test cases that provide the highest return on investment (ROI) for automation.
•   Design Test Cases for Automation: Ensure test cases are well-defined, clear, and easily automatable.
•   Create Test Data: Prepare test data sets for various scenarios.
Test Environment Setup
• Configure Test Environments: Set up and configure the necessary
  hardware and software for test execution.
• Integrate with CI/CD: Integrate automation tests into the
  Continuous Integration/Continuous Delivery pipeline.
Test Script Development
Write Test Scripts: Develop automated test scripts using appropriate programming languages or scripting tools.
Implement Test Data Handling: Incorporate mechanisms for handling test data effectively.
Create Reusable Test Modules: Develop reusable components to improve efficiency and maintainability.
Test Execution & Monitoring
Execute Test Suites: Run automated tests regularly and monitor their execution.
Analyze Test Results: Review test results, identify failures, and generate reports.
Debug and Fix Issues: Troubleshoot and fix any issues encountered during test execution.
Reporting & Analysis
Generate Test Reports: Generate comprehensive test reports that include pass/fail rates, execution times, and other
relevant metrics.
Analyze Test Results: Analyze test results to identify trends, patterns, and areas for improvement.
Communicate Test Results: Communicate test results to stakeholders effectively.
Test Maintenance
Maintain Test Scripts: Update and maintain test scripts as the application evolves.
Manage Test Data: Update and maintain test data sets as needed.
Optimize Test Suites: Regularly review and optimize test suites to improve efficiency and effectiveness.
Continuous Improvement
Review and Refine Processes: Continuously review and refine the test automation process based on lessons learned
and best practices.
Explore New Technologies: Stay updated with the latest advancements in test automation tools and technologies.
Improve Team Skills: Continuously improve the skills and knowledge of the test automation team.