Unit 4 ST Full Notes
Unit 4 ST Full Notes
Ans: Testing in software development is a critical process that ensures the quality, functionality,
and performance of software applications. It can be categorized into several levels, each
serving a specific purpose and focusing on different aspects of the software.
1. Unit Testing
Definition: Unit testing is the first level of testing where individual components or units of the
software are tested in isolation.
Purpose: The main goal is to verify that each unit functions correctly according to its
specifications. This type of testing is typically performed by developers during the coding
phase.
Benefits:
● Early detection of errors, reducing development risks.
● Facilitates easier debugging and code maintenance.
● Example: Testing a single function that calculates the area of a rectangle.
2. Integration Testing
Definition: Integration testing involves combining multiple units or components and testing them
as a group to ensure they work together correctly.
Purpose: This level focuses on identifying issues related to data flow and interaction between
integrated components.
Benefits:
● Detects interface defects between modules.
● Validates that combined components perform as expected.
● Example: Testing a payment gateway integration with a shopping cart.
Types: Can be performed in various ways, including top-down, bottom-up, and sandwich (hybrid)
approaches.
3. System Testing
System testing is the third level of testing, where the entire software system is tested from end
to end. The goal is to ensure that the system meets the specified requirements and works as
expected.
● Types: Includes functional testing, non-functional testing (performance, security,
usability), and regression testing.
● Responsibility: Typically performed by a dedicated testing team
Example: Testing a complete e-commerce website, including user registration, product search,
payment processing, and order management.
4. Acceptance Testing
Definition: Acceptance testing is conducted to determine whether the software meets end-user
requirements and is ready for deployment.
Purpose: This level often involves user acceptance testing (UAT), where actual users validate
the software against their needs and expectations.
Benefits:
● Ensures the final product aligns with user requirements.
● Identifies any last-minute issues before the software goes live.
Example: Testing a software application to ensure it meets the requirements outlined in the
project scope statement.
Ans: Debugging is the process of identifying, analyzing, and removing errors or bugs from
software applications. It involves locating the source of the problem, understanding the root
cause, and applying fixes to prevent the issue from occurring again.
Debugging Techniques Debugging techniques are methods used to identify and resolve errors
or bugs in software applications. The choice of technique often depends on the complexity of
the software, the type of error, and the available tools. Here are some common debugging
techniques:
1. Print Debugging
● Explanation: This technique involves adding print or logging statements to the code at
various points to output the values of variables, program state, or flow of execution. By
analyzing the printed output, developers can pinpoint where the error occurs.
● Example: Adding print(variable_name) statements in Python to print variable values.
● Advantages: Simple and does not require special tools.
● Disadvantages: Not scalable for large or complex applications, and may clutter the
code.
2. Backtracking
● Explanation: When a program fails, backtracking involves tracing the execution path in
reverse, from the point of failure to identify where the problem originated.
● Example: Rechecking each step of the program flow or data processing to find
inconsistencies.
● Use Case: Useful for understanding the sequence of events that led to a bug.
● Tools: Can be done manually or with the help of debugging tools that allow you to step
back in execution.
3. Binary Search
Binary search involves dividing the code into smaller sections and testing each section to
identify the source of the error.
Example: Dividing a large codebase into smaller modules and testing each module individually.
5. Cause Elimination
The Cause Elimination Method is a more focused and systematic approach to debugging. It
involves forming hypotheses about possible causes of the bug and then testing those
hypotheses to eliminate incorrect possibilities, eventually narrowing down to the root cause.
Advantages: Efficient, as it focuses on likely causes rather than examining the entire codebase.
● Top Down Integration testing is one of the approach of Integration testing in which
integration testing takes place from top to bottom means system integration begins with
top level modules.
● In this testing the higher level modules are tested first then the lower level modules are
tested and then the modules are integrated accordingly.
● Top Down Integration testing approach is beneficial if the significant defect occurs toward
the top of the program.
● Requires stubs (dummy modules) to simulate lower-level modules that are not yet
integrated.
● In this testing the lower level modules are tested first then the higher level modules are
tested and then the modules are integrated accordingly.
● Requires drivers (dummy programs) to simulate higher-level modules that are not yet
integrated.
4. Performance Testing
● Definition: A type of non-functional testing that assesses the speed, scalability, and
stability of the software under various conditions.
● Applicability:
● Load testing (to evaluate performance under expected load).
● Stress testing (to determine the breaking point of the application).
5. Security Testing
● Definition: A testing technique that identifies vulnerabilities, threats, and risks in the
software and ensures that data and resources are protected.
● Applicability:
● Penetration testing (simulating attacks to identify vulnerabilities).
● Vulnerability scanning (automated tools to find security weaknesses).
● Risk assessment (evaluating potential security risks).
● Suitable for applications handling sensitive data or requiring compliance with
security standards.
Description: Focuses on testing values at the boundaries of input ranges to uncover potential
issues related to boundary conditions.
Applicability: Particularly beneficial when inputs are expected to fall within specific ranges
(e.g., age limits).
Structure:
● All testers are part of a single, centralized testing team, separate from development
teams.
● A Test Manager leads the team and allocates testers to different projects as needed.
Key Features:
Advantages:
Challenges:
Structure:
Key Features:
Advantages:
Challenges:
Best For:
Structure:
Key Features:
Advantages:
Best For:
Structure:
Key Features:
Advantages:
Challenges:
Best For:
Definition:
A Random Test Data Generator is a tool or technique used to create input data for testing
purposes by generating values randomly. The inputs can include numbers, strings, or other data
types, and they are often created without any specific logic or constraints.
Key Features:
● Unbiased Data Creation: The data generated does not follow a predefined pattern or
logic.
● Wide Coverage: It allows testing various unexpected scenarios that might not be
covered by manual test cases.
Example:
Suppose we want to test an e-commerce application's search functionality. A Random Test Data
Generator can produce random search queries, such as:
● Random keywords (e.g., "apple", "banana", "orange")
● Random search phrases (e.g., "buy iPhone", "cheap laptops")
● Random special characters and symbols (e.g., "@", "#", "$")
2. Goal-Oriented Generator
A Goal-Oriented Generator is a type of test data generator that produces data aimed at
achieving specific testing goals or objectives. The generated data is tailored to test particular
aspects of the software application, such as functionality, performance, or security.
Characteristics:
● Generates data focused on specific testing goals or objectives
● Data is created to test particular features, functions, or workflows
● Can produce data that simulates real-world scenarios or edge cases
● Can be used for various testing types, including functional, performance, and security
testing
Example:
Suppose we want to test a banking application's transaction processing feature. A
Goal-Oriented Generator can produce data aimed at testing specific scenarios, such as:
● Valid transactions (e.g., deposit, withdrawal, transfer)
● Invalid transactions (e.g., insufficient funds, invalid account numbers)
● Edge cases (e.g., large transactions, concurrent transactions)
Key differences:
● Random Test Data Generator focuses on generating random data, while Goal-Oriented
Generator focuses on generating data aimed at achieving specific testing goals.
● Random Test Data Generator is often used for exploratory testing, while Goal-Oriented
Generator is used for targeted testing.
7) Explore the difference between static and dynamic test data generation.
Ans: Test data generation is the process of creating data to test software applications. There
are two primary approaches to test data generation: static and dynamic.
Static Test Data Generation-
● Test data is created before testing begins, typically manually or using predefined rules.
● Performed before the testing process starts.
● Often manual or semi-automated.
● Flexibility is Limited, as the data is predefined and cannot adapt during execution.
● Reusability is High; the same data can be reused across multiple test runs.
● Complexity is Simple, as it relies on predefined rules or manual creation.
● Suitable for scenarios where the test data requirements are well understood in advance.
● Examples: Manually creating a set of valid and invalid inputs for a login form.
8) Discuss and draw a control flow diagram for test generation using
genetic algorithms.
Ans: Genetic algorithms (GAs) are a type of optimization algorithm inspired by the process of
natural selection. They are used in various fields, including software testing, to generate test
cases that can effectively cover a wide range of scenarios and improve the quality of the
software. In the context of test generation, GAs can help create test cases that maximize code
coverage, find defects, or meet specific testing objectives.
Steps in the Control Flow for Test Generation Using Genetic Algorithms
1. Initialization:
3. Selection:
● The best-performing test paths are selected based on their fitness scores.
● Select the fittest test cases to act as parents for the next generation.
● This step ensures that only the most promising candidates are carried forward to
the next generation.
4. Crossover:
5. Mutation: Introduce random changes to some of the offspring test cases to maintain
diversity in the population and explore new areas of the solution space.
6. Replacement: Replace the old population with the new generation of test cases, typically
keeping the best-performing test cases from the previous generation.
7. Termination: Repeat the evaluation, selection, crossover, mutation, and replacement steps
until a termination condition is met (e.g., a maximum number of generations, a satisfactory
fitness level, or convergence).
8. Output: Return the best test cases from the final generation as the output.
Explanation of the Control Flow Diagram
Ans: There are numerous software testing tools available, each designed to address specific
testing needs and methodologies.
1. Selenium
2. JUnit
● Functionality: JUnit is a widely used testing framework for Java applications. It supports
unit testing, test-driven development (TDD), and test automation. JUnit allows
developers to write repeatable tests and execute them automatically, with features like
assertions, test suites, and fixtures.
3. Postman
● Functionality: Postman is a popular tool for API testing. It allows testers to create, send,
and analyze HTTP requests and responses. It supports automated testing through
collections and can be integrated with CI/CD pipelines.
4. Appium
5. Apache JMeter
● Functionality: Apache JMeter is an open-source tool primarily used for performance and
load testing. It can simulate a large number of users and measure the performance of
web applications, databases, and other services. JMeter supports creating test plans,
running stress tests, and generating performance reports.
6. Cucumber
● Functionality: Cucumber is a tool for behavior-driven development (BDD) that allows
writing tests in plain English using Gherkin syntax. It promotes collaboration between
developers, testers, and business stakeholders by defining application behavior in terms
of user stories and scenarios.
10) Discuss the static and dynamic testing tools with the help of examples.
Ans:
Static Testing Tools
Definition: Static testing tools analyze the code, documentation, or other project artifacts
without executing the program. The primary goal is to identify potential issues early in the
development process, such as coding errors, security vulnerabilities, and adherence to coding
standards.
Characteristics:
1. SonarQube: A popular static analysis tool that examines code quality, security, and
reliability.
2. Checkstyle: Checkstyle is a tool used for enforcing coding conventions in Java code. It
can detect issues related to naming conventions, whitespace, indentation, and other
programming practices
3. FindBugs: A tool that identifies potential bugs and vulnerabilities in Java code.
4. CodeCoverage: A tool that measures the percentage of code covered by unit tests.
5. Pylint: Pylint is a static code analysis tool for Python that checks for errors in Python
code, enforces coding standards, and looks for code smells.
Dynamic testing involves executing the software to verify that it behaves as expected under
real-world conditions. Dynamic testing tools automate the process of running tests and checking
the software's behavior during execution, often through interactions with the system's interfaces.
1. Selenium: Selenium is a widely used tool for automating web browser interactions. It
supports writing automated tests in multiple programming languages like Java, Python, C#, and
JavaScript.
2. JUnit: JUnit is a unit testing framework for Java applications. It allows developers to write
automated tests to validate individual components or functions of a program.
3. Appium: Appium is a cross-platform mobile application testing tool that allows you to
automate testing for both iOS and Android applications. It supports a range of programming
languages and works on both native and hybrid apps.
4. JMeter: An open-source tool for load testing and performance testing of web applications.
5. Postman: Postman is a popular tool for API testing. It allows testers to create, send, and
analyze HTTP requests and responses, supporting automated testing through collections.
11) Discuss factors considered for selecting a testing tool for test
automation.
Ans: When selecting a test automation tool, several factors must be considered to ensure that
the tool aligns with the project’s requirements, budget, and technical capabilities. Below are the
key factors to consider when choosing a testing tool for test automation:
● Objective of Automation: The first step is to clearly define what you want to achieve with
automation. Whether it’s for functional testing, regression testing, performance testing,
or load testing, different tools may serve different purposes.
● Type of Application: Consider the type of application being tested (e.g., web, mobile,
desktop, or API). Some tools specialize in specific types of applications, so the tool
should be chosen based on the nature of the application.
2. Supported Technologies
● Compatibility with Programming Languages: The automation tool should support the
programming languages and frameworks used in the project. For example, if your
application is built in Java, you may prefer tools that support Java (like Selenium or
JUnit).
● Cross-platform Support: If the application runs on multiple platforms (e.g., Windows,
macOS, Linux), the tool should be compatible across these platforms. For web
applications, the tool should also support various browsers (e.g., Chrome, Firefox, Edge,
Safari).
● Supported Technologies (UI/Database/API): Ensure the tool supports the type of testing
needed, such as web UI testing, API testing, or database testing. For example, Selenium
is great for UI testing, while tools like Postman are designed for API testing.
3. Ease of Use
● Learning Curve: The tool should be easy to learn and use, especially for teams with
limited experience in automation. If the tool requires advanced skills or extensive
training, it might slow down the implementation and adoption process.
● Script Writing: Consider whether the tool supports scripting, or whether it offers a
codeless interface. While scripting offers flexibility, codeless tools are more accessible
to non-technical testers.
● CI/CD Pipeline Support: The automation tool should integrate easily with continuous
integration (CI) and continuous deployment (CD) pipelines, such as Jenkins, Bamboo, or
GitLab CI. This ensures that tests can be run automatically during the build and
deployment process.
● Version Control Integration: The tool should also support version control systems like
Git, allowing teams to manage test scripts in repositories and track changes over time.
5. Test Maintenance
● Script Maintenance: Over time, test scripts might need to be updated due to changes in
the application. A good test automation tool should minimize maintenance overhead by
supporting features like modular scripting, reusable components, and easy maintenance
of test scripts.
● Test Data Management: Tools should allow efficient management of test data, which is
crucial when running automated tests for various data sets.
6. Scalability
● Handling Large Test Suites: The tool should be able to handle large and complex test
suites as your project grows. This includes running tests on multiple browsers,
platforms, and environments simultaneously.
● Parallel Execution: The ability to run tests in parallel across different environments,
devices, or configurations can speed up test execution significantly.
A test plan is created early in the software development lifecycle and is updated as the project
progresses. It ensures that all aspects of the software are tested and the testing is aligned with
the business and technical requirements.
Scope:
The scope of this test plan includes testing the website's user interface, functionality,
performance, and security.
Test Objectives:
● Verify that the website's user interface is intuitive and easy to use.
● Ensure that the website's functionality meets the requirements outlined in the
specification document.
● Measure the website's performance under various load conditions.
● Identify potential security vulnerabilities in the website.
Test Strategy:
The testing approach will include:
● Unit testing of individual components
● Integration testing of components and subsystems
● System testing of the entire website
● Acceptance testing to verify the website meets the requirements
Test Environment:
● Hardware: Windows 10, 16 GB RAM, 2.5 GHz processor
● Software: Google Chrome, Mozilla Firefox, Microsoft Edge
● Network: High-speed internet connection
Test Deliverables:
● Test plan document
● Test cases and test scripts
● Test reports and summary
● Defect tracking and resolution document
Test Schedule:
● Test planning: 2 weeks
● Test case development: 4 weeks
● Test execution: 8 weeks
● Test completion: 14 weeks
Test Resources:
● 2 test engineers
● 1 test lead
● 1 technical writer
● Test equipment and software
Test Metrics:
● Test coverage: 90%
● Defect density: 0.5 defects per function point
● Test efficiency: 80%