Docsity

Automated Testing Tools and Frameworks, Study notes of Software Engineering

Toggle sidebar
bg1
STQA
Unit 3 - Automated Testing Tools and
Frameworks
What is Automation Testing?
Automation Testing is a software testing technique in which test cases are
executed automatically using tools and scripts instead of manual effort.
In this method, a tester writes scripts once and runs them multiple times to check
whether the software is working correctly. It is mainly used to test repetitive,
time-consuming, and critical test cases. Automation testing helps reduce human
errors and speeds up the software testing process.
Goal:
✅
Save time
✅
Reduce human errors
✅
Improve software quality
✅
Support CI/CD Continuous Integration & Delivery)
Why Automation Testing is Needed?
STQA
1
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25

Partial preview of the text

Download Automated Testing Tools and Frameworks and more Study notes Software Engineering in PDF only on Docsity!

STQA

Unit 3 - Automated Testing Tools and

Frameworks

What is Automation Testing?

Automation Testing is a software testing technique in which test cases are executed automatically using tools and scripts instead of manual effort.

In this method, a tester writes scripts once and runs them multiple times to check whether the software is working correctly. It is mainly used to test repetitive, time-consuming, and critical test cases. Automation testing helps reduce human errors and speeds up the software testing process.

Goal:

✅ Save time

✅ Reduce human errors

✅ Improve software quality

✅ Support CI/CD Continuous Integration & Delivery)

Why Automation Testing is Needed?

Manual testing is slow, boring, and error-prone Software is updated frequently in Agile & DevOps Automation helps in fast testing and quick deployment

Main Reasons:

Better Quality Assurance Fewer bugs No manual effort required More test coverage Tests can be run anytime, repeatedly

Tests Better Done Manually

✅ Exploratory Testing – needs human thinking

✅ Usability & UI testing – look and feel

✅ Visual checks – design, layout, user experience

Types of Automation Testing

Unit Testing Integration Testing Smoke Testing Regression Testing Performance Testing Security Testing API Testing UI Testing Acceptance Testing

✅ High test coverage

✅ More reliable results

✅ Saves time & money

✅ Early bug detection

✅ Less human error

Disadvantages of Automation Testing

❌ High initial cost

❌ Programming knowledge required

❌ Cannot automate everything

❌ UI & usability need manual testing

Difference Between Manual Testing and Automation

Testing

Parameter Manual Testing Automation Testing

Meaning

Test cases are executed manually by a tester without using tools.

Test cases are executed automatically using scripts and testing tools.

Reliability Less reliable due to possiblehuman errors.^ More reliable and consistent as itis tool-based.

Time Very time-consuming. Faster execution of test cases.

Human effort Requires continuous humaninvolvement.^ Requires minimal humanintervention after scripting.

Cost High cost due to manpower. High initial cost for tools, but cost-effective in the long run.

Programming knowledge Not required.^

Programming knowledge is required to write scripts. Test coverage Limited coverage. Wider coverage is possible. Regression testing Difficult and slow. Easy and efficient.

Suitability Best for exploratory and usabilitytesting.^ Best for regression, performance,and repetitive testing.

Parameter Manual Testing Automation Testing

CI/CD support Not suitable. Well supported and widely used inCI/CD pipelines.

What is Selenium?

Selenium is an open-source automation testing tool used to test web-based applications. It allows testers to automate browser actions such as clicking buttons, entering text, and navigating web pages to verify that a website works correctly.

Selenium supports multiple browsers Chrome, Firefox, Edge, Safari), works on different operating systems , and allows test scripts to be written in various programming languages like Java, Python, and C#. It is widely used for functional testing, regression testing, and cross-browser testing , especially in Agile and DevOps environments.

Features of Selenium

Cross-browser support  Works on Chrome, Firefox, Edge, Safari, etc. Multi-language support  Supports Java, Python, C#, Ruby, etc. Open source  Free to use with strong community support. Platform independent  Works on Windows, Linux, and macOS. Reusable test scripts  Same scripts can be reused multiple times. Supports dynamic elements  Can handle modern web applications.

Applications (Uses) of Selenium

Automated web application testing to verify website functionality. Cross-browser testing to ensure compatibility across browsers. Functional testing to validate application behavior. CI/CD integration for continuous testing with tools like Jenkins.

4. Selenium Grid

Selenium Grid is used for running multiple test cases simultaneously on different browsers and operating systems.

It follows a hub and node architecture , where the hub controls the execution and nodes are the machines where browsers run. Selenium Grid helps in reducing execution time and enables efficient cross-browser and cross-platform testing.

Short Conclusion (for exam)

The four components of Selenium— Selenium IDE, Selenium RC, WebDriver, and Selenium Grid —together make Selenium a powerful tool for automated web testing. WebDriver and Grid are widely used in modern testing environments.

How Selenium Works

 Write Test Code The tester writes automation test scripts using a supported programming language such as Java, Python, or C# with Selenium WebDriver libraries.  WebDriver Controls the Browser Selenium WebDriver communicates with the web browser using a browser- specific driver like ChromeDriver Chrome) or GeckoDriver Firefox).  Driver Sends Commands Test scripts send commands such as open URL, click button, enter text, or fetch data to the WebDriver.  Browser Executes Actions The browser performs the actions instructed by WebDriver, like clicking elements, filling forms, or navigating pages.  Result Returned After execution, Selenium returns results such as page content, element status, or error messages , which helps verify test success or failure.

Steps for Testing with Selenium IDE (Short)

 Install Selenium IDE Install the Selenium IDE browser extension from the Chrome Web Store or Firefox Add-ons.  Record Test Case Create a new project and record user actions such as clicking links and typing text on a website.  Edit Test Case Modify recorded commands and add assertions to check expected results.  Run the Test Play the test case to execute it automatically and observe Pass/Fail results.  Export Test Optional) Export the test script into languages like Java or Python for use with Selenium WebDriver.

Advantages of Selenium

Free and open-source tool. Supports multiple browsers and platforms. Faster execution compared to manual testing. Easy integration with automation frameworks. Large community support. Suitable for Agile and DevOps environments.

Disadvantages of Selenium

Cannot automate desktop applications. Limited support for mobile app testing (needs Appium). Handling dynamic elements can be difficult. Test execution can be slow for large applications.

JUnit uses annotations like (^) Test , (^) BeforeEach , and (^) AfterEach to define test methods and their execution flow.  Assertions Assertions are used to verify whether the actual output matches the expected output.  Test Runners JUnit allows tests to be run individually, in groups, or in parallel using test runners.  Lifecycle Management Provides setup and teardown methods to run code before and after tests.  Integration Support Easily integrates with Maven, Gradle , and CI tools like Jenkins.  Extensibility Can be extended using custom rules and external libraries.

Key Concepts in JUnit

1. Test Method

A test method is a Java method annotated with Test. Each test method tests one specific functionality.

2. Assertions

Assertions check whether the test result is correct.

Common assertions:

assertEquals(expected, actual) assertNotNull(object) assertTrue(condition) assertFalse(condition)

3. Annotations

JUnit annotations define test structure:

Test (^) – marks a test method BeforeEach – runs before each test AfterEach – runs after each test BeforeAll – runs once before all tests AfterAll – runs once after all tests Disabled (^) – disables a test

4. Test Lifecycle

Setup  Prepare data or initialize objects Execution  Run test methods Teardown  Clean up resources after tests

5. Test Suites

A test suite groups multiple test cases together. Used to run related tests at once.

6. Parameterized Tests

Allows running one test method with multiple input values. Useful for testing different data combinations.

Role of JUnit in Development Cycle

Used in Test-Driven Development TDD where tests are written before code. Integrated into Continuous Integration CI systems to run tests automatically after every code change.

Steps for Testing with JUnit (Short)

Supporting TDD Continuous integration testing Integration testing with additional tools

What is TestNG?

TestNG Test Next Generation) is an open-source automation testing framework for Java.

It is inspired by JUnit but provides more advanced and flexible features. TestNG is mainly used for unit testing, integration testing, and functional testing.

TestNG allows testers to group test cases, run tests in parallel, manage test dependencies, use data-driven testing , and generate detailed reports , making it popular in automation testing and CI/CD environments.

Features of TestNG

 Annotation Support  Uses annotations to control test execution flow.  Parallel Test Execution  Executes multiple tests at the same time to reduce testing time.  Test Grouping  Allows grouping of test cases (e.g., smoke, regression).  Data-Driven Testing  Supports parameterized tests using DataProvider.  Test Dependency Management  Allows one test to depend on another.  Built-in Reports  Generates HTML and XML test reports.  Flexible Configuration  Uses testng.xml^ for test configuration.  CI/CD Integration  Works well with Maven, Gradle, Jenkins.

Key Annotations in TestNG

Annotations control the test lifecycle.

Commonly Used Annotations:

Test  Marks a method as a test case. BeforeMethod  Runs before each test method. AfterMethod  Runs after each test method. BeforeClass  Runs once before all test methods in a class. AfterClass  Runs once after all test methods in a class. BeforeSuite / AfterSuite  Runs before/after the entire test suite.

Steps for Testing with TestNG (Short)

 Set Up TestNG Add TestNG dependency using Maven or Gradle.  Create Test Class Write Java test class with methods annotated using Test^.  Configure Test Optional) Use (^) testng.xml to group tests, set priorities, or run tests in parallel.  Run Test Cases Run tests via IDE or using build tools.  View Test Reports Analyze HTML/XML reports for pass/fail results.

Advantages of TestNG

 Supports parallel execution , reducing test time.  Better test control using annotations.  Supports data-driven testing.  Allows test dependencies and grouping.  Generates detailed reports.  Ideal for large test suites.

testing, and dependency management , it is widely used in automation testing and DevOps environments.

Difference Between JUnit and TestNG

Feature JUnit TestNG

Definition Unit testing framework forJava^ Advanced testing framework forJava

Meaning JUnit  Java Unit Testing TestNG  Test Next Generation Inspired by Original framework Inspired by JUnit Complexity Simple and easy to learn More powerful but slightly complex Test Configuration Limited configuration Highly flexible using testng.xml Annotations Basic annotations Rich set of annotations Parallel Execution Limited support Strong support for parallel execution Test Grouping Not supported Supported Test Dependency Not supported Supported Data-Driven Testing Limited support^ Supported using^ DataProvider Reports Basic reports Detailed HTML/XML reports CI/CD Support Supported Strong CI/CD integration Usage Best for small projects Best for large & complex projects

Continuous Integration (CI) Tools

What are CI Tools?

Continuous Integration CI tools are software tools that help developers automatically integrate, build, and test code changes whenever new code is added to a shared repository. These tools ensure that the application remains error-free and stable by detecting bugs early in the development process.

CI tools are an important part of modern software development, Agile, and DevOps practices.

Key Features of CI Tools

 Automated Builds CI tools automatically compile and build the application whenever code is committed.  Automated Testing They execute various tests such as unit tests, integration tests, and regression tests to verify code correctness.  Version Control Integration CI tools integrate with version control systems like Git, SVN, or Mercurial.  Code Quality Checks Perform static code analysis, linting, and quality checks to improve code standards.  Notifications Automatically notify developers via email, Slack, or dashboards if a build or test fails.  Deployment Support Some CI tools can deploy applications to staging or production environments after successful testing.

Popular Continuous Integration Tools

1. Jenkins

Jenkins is an open-source and widely used CI tool.

Highly customizable with a rich plugin ecosystem Supports tools like Maven, Gradle, JUnit, TestNG Provides distributed builds, pipelines, and Docker support

Test results are generated and developers are notified if any error occurs.  Deployment Optional) If the build is successful, the application can be automatically deployed.

Benefits of Using CI Tools

 Early Bug Detection Bugs are detected early, reducing fixing cost and time.  Faster Development Cycle Automation speeds up testing and releases.  Consistent Builds Ensures code works consistently across environments.  Better Team Collaboration Frequent integration reduces conflicts among developers.  Automated Deployment Ensures the latest code is always available in test or production environments.

Conclusion

Continuous Integration tools help improve software quality, speed, and reliability by automating the build and testing process. Tools like Jenkins, GitLab CI/CD, TeamCity, and Azure DevOps are widely used to support modern Agile and DevOps workflows.

What is Jenkins?

Jenkins is an open-source automation server used to implement Continuous Integration CI and Continuous Delivery/Deployment CD in software development.

It automates tasks such as building, testing, and deploying applications , reducing manual effort and improving software quality.

Jenkins continuously monitors source code repositories and automatically runs builds and tests whenever changes are committed. This helps in early bug detection , faster development cycles, and consistent code quality.

Key Concepts of Jenkins

1. Continuous Integration (CI)

Jenkins automatically integrates code changes from multiple developers into a shared repository and runs automated builds and tests.

2. Continuous Delivery (CD)

After successful testing, Jenkins can automatically deploy applications to environments like development, staging, or production.

3. Pipeline as Code

Jenkins allows defining CI/CD workflows using a Jenkinsfile , which stores pipeline steps (build, test, deploy) as code in the repository.

How Jenkins Works

 Code Commit Developers commit code changes to a version control system like Git or SVN.  Build Trigger Jenkins detects the change or triggers a build based on a schedule.  Automated Build Jenkins compiles code, resolves dependencies, and packages the application JAR, WAR, Docker image).  Automated Testing Jenkins runs automated tests such as unit tests and integration tests.