0% found this document useful (0 votes)
14 views20 pages

STUnit - 1

The document provides an overview of software testing, defining it as the process of evaluating and verifying software applications for defects and functionality. It highlights the importance of testing in ensuring quality, identifying bugs early, enhancing user experience, and improving security while detailing various testing classifications, techniques, and life cycle stages. Additionally, it includes examples of test cases and discusses specific testing methods such as boundary value testing and random testing.

Uploaded by

sonujayaram7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views20 pages

STUnit - 1

The document provides an overview of software testing, defining it as the process of evaluating and verifying software applications for defects and functionality. It highlights the importance of testing in ensuring quality, identifying bugs early, enhancing user experience, and improving security while detailing various testing classifications, techniques, and life cycle stages. Additionally, it includes examples of test cases and discusses specific testing methods such as boundary value testing and random testing.

Uploaded by

sonujayaram7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Unit -1

Chapter 1- Introduction to Software Testing


What is software testing

Software Testing : Software testing is the process of evaluating and verifying that a software application or system works as expected and is
free from defects or bugs.

Importance of Software Testing:

 Ensures Quality: Software testing ensures that the application meets quality standards and functions as expected, reducing the chances
of defects in the final product.

 Identifies Bugs and Issues Early: It helps find and fix bugs or issues early in development, preventing costly fixes later in the process.

 Enhances User Experience: Thorough testing ensures that the software is reliable, user-friendly, and functions smoothly, leading to
better user satisfaction.

 Improves Security: Testing helps identify vulnerabilities and security flaws, protecting the software and its users from potential threats.

 Reduces Development Costs: By catching defects early, software testing helps reduce the time and cost associated with fixing issues
after the product is released.
• Goals of software Testing:
 Verify Functionality: To ensure the software performs the required functions as specified in the requirements.
 Ensure Reliability: To confirm that the software operates consistently under various conditions without unexpected
failures.
 Guarantee Usability: To make sure the software is user-friendly, easy to navigate, and meets user expectations.
 Test Performance: To check the software’s performance, including its speed, stability, and scalability under load.
 Improve Security: To detect potential vulnerabilities and safeguard the software from security breaches.
 Confirm Compatibility: To ensure the software works across different devices, browsers, and operating systems.

Classification of software testing

• Based on Testing Objectives:

• Functional Testing: Focuses on testing the functionality of the software, ensuring that it works according to the
specifications.

• Non-Functional Testing: Evaluates aspects of the software such as performance, security, usability, and compatibility.
1. Performance Testing: Measures the software’s performance under varying conditions (e.g., load testing, stress testing, and
scalability testing).
2. Security Testing: Identifies vulnerabilities in the software and ensures that data is protected from unauthorized access or threats.
3. Usability Testing: Evaluates the ease of use, user experience, and how intuitive the software interface is for end-users.
4. Compatibility Testing: Ensures that the software works across different environments (e.g., different browsers, devices, or operating
systems).
• Based on Testing levels:
 Unit Testing: Focuses on testing individual components or units of code to ensure they function correctly in isolation.
 Integration Testing: Tests the interaction between different modules or components to verify that they work together as expected.
 System Testing: Evaluates the entire software system as a whole to ensure it meets specified requirements.
 Acceptance Testing: Confirms that the software meets the business requirements and is ready for deployment, often done by the end user
(User Acceptance Testing - UAT).
• Based on Testing Techniques:

 Manual Testing: Involves human testers who manually execute test cases without using automation tools.

 Automated Testing: Involves using specialized software tools to run predefined test scripts automatically.

 Based on Test Execution:

 White-box Testing: Testers have access to the internal workings of the application and test the internal logic and
structure

(e.g., code-level testing, control flow testing).

 Black-box Testing: Testers focus on the inputs and outputs of the application without knowledge of the internal
workings

(e.g., functional testing).

 Gray-box Testing: A combination of both white-box and black-box testing, where testers have some knowledge of
the internal workings but focus on the software’s functionality.
.
Based on Testing strategies

• Top-Down Testing:

 In Top-Down Testing, integration starts with the top-level (higher-level) modules and progressively integrates and tests lower-level
modules. If lower modules are unavailable, stubs (temporary placeholders) are used to simulate their behavior.

 Bottom-Up Testing:

 In Bottom-Up Testing, integration starts with the lower-level (subordinate) modules, testing them first before moving upwards to
the higher-level modules. If higher modules are not available, drivers (temporary placeholders) are used to invoke the lower-level
modules for testing

• Verification AND Validation

• Verification

Verification ensures the software is being built correctly according to specifications.

 Review: Examining documents or code by peers for correctness.

 Formal Review: Structured process with defined roles.

 Informal Review: Casual feedback among team members.


• Inspection: A formal, structured review to find defects in software artifacts.

• Walkthrough: Author explains the design/code to the team for feedback.

• Validation

Validation ensures the software meets user needs and works in the real world.

 User Acceptance Testing (UAT): End-users test the software to confirm it meets requirements.

 Beta Testing: A select group of users test the software before release to provide feedback.
•Basic Definition
 Error: A mistake made by a person during development.
Example: A programmer accidentally types the wrong variable name in the code.
 Fault: A problem in the code caused by an error.
Example: The wrong variable name in the code causes a program to crash when it runs.
 Failure: When the software doesn’t work as expected because of a fault.
Example: The program crashes (failure) when trying to load a file because of the wrong variable name (fault).
 Incident: Any unexpected event that causes a problem with the software.
Example: A user tries to log in, but the system is down due to a server issue (incident).
 Test: An action to check if the software works as it should.
Example: You test whether clicking a button saves your data correctly.
 Test Case: A set of steps to check if a part of the software works as expected.
Example: A test case could be to check if a login button works by entering a username and password and verifying
the user can log in.
• Testing Life Cycle

(REFER THE DIAGRAM FROM 1.10)

Specification
 Defining the requirements and specifications of the software.

 Understanding what the software needs to do.

Design:
 Designing how the software will meet those specifications (including architecture and user interfaces).

 Reviewing design documents to ensure they align with the specifications.

Coding:
 Writing the actual code to implement the design.

Testing:

 The testing phase where different levels of tests (unit, integration, system, etc.) are performed.

 :Executing various test cases to find bugs and ensure the software meets the requirements .
Classify Fault:

 Identifying and categorizing faults (bugs or issues) in the software.

 Classifying a fault as a logic error or performance issue.

Isolate Fault:

 Pinpointing the source of the fault by reproducing the error or debugging the code.

 Finding that a specific function causes the system crash.

Fault Resolution:

 Fixing the identified faults or bugs by modifying the code, design, or configurations.

 Correcting a coding error that causes a program to crash when the user enters incorrect data .
• Test cases :
Test Cases is a set of conditions or steps to verify that a software application functions as expected
Components of Test cases:
• Test case Id : A unique identifier assigned to the Test cases
• Purpose : A brief summary of the test scenario
• Test Created by : Name of the person who created the test case
• Test Environment : The Environment where the test will be executed (e.g. windows 10, chrome browser)
• Prerequisites : conditions that must be met before executing the test (e.g. configuration, data setups or previous test completion)
• Test Procedure : step by step actions to perform the test
• Test Data : input data required for the test (e.g. Username: test user, password : 12345 )
• Expected Result : The expected outcome after executing the test (e.g. User should log in successfully )
• Actual Result : The actual Outcome observed after executing the test
• Verdict(Pass or fail ) : status based on expected vs actual result
• Comments : additional observations or issues faced during testing.
• Example:
• Test case Id : TC001
• Purpose : verify user login Functionality
• Test created by : haritha
• Test Environment : windows 10, chrome Browser.
• Prerequisites : User account should be created.
• Test Procedure : Login page (step by step)
• Test Data : Username : test user ( textbox), password : 12345 (textbox)
• Expected result : user should be log successfully and be redirected to homepage
• Actual Result : user logged in Successfully
• Verdict (pass/fail) : pass
• Comment : login function is working as expected.
Test Suite : A test suite is a group of test cases that check if a specific part of a software works correctly.
E.g. : Login
Test if login works with correct username or password.
Test if it shows error with wrong username or password.
Test if it shows a warning when fields are empty.
Test if the “Forgot password” options works.
Levels of Testing:

1. Unit Testing

• Focus: Tests individual components or functions of the code.

• Objective: Ensures that each unit (e.g., function, method, class) performs as intended.

• Tools: Popular frameworks include JUnit, pytest, NUnit, etc.

• Example: Testing a single function that calculates the average room price in your California Housing Prices dataset.

2. Integration Testing

• Focus: Tests the interaction between integrated units or modules.

• Objective: Ensures that combined components work together properly.

• Tools: Popular frameworks include JUnit (with integration features), pytest, Postman (for API integration), etc.

• Example: Verifying that your exponential growth model correctly interacts with the data preprocessing pipeline.
3. System Testing

• Focus: Tests the entire system as a whole.

• Objective: Ensures the complete application meets the specified requirements.

• Types: Includes functional testing, performance testing, security testing, etc.

• Tools: Popular tools include Selenium, TestComplete, JMeter, etc.

• Example: Testing your salary prediction model's web interface to ensure data input, prediction output, and UI interactions work
seamlessly.

Structural and Behavioral Testing


• Structural Testing:
• Focuses on internal code structure and logic.
• Example: Testing conditions, loops, and branches.
• Behavioral Testing:
• Focuses on system functionality and user interactions.
• Example: Testing valid/invalid login attempts.
• Fundamental Approaches to Apply Test Cases

1. Functional Testing (Black Box Testing)

Approach: Focuses on testing the software's functionality based on specifications without knowing the internal code. It ensures the
system works as expected from the user's perspective.

Characteristics:

• No code knowledge required.

• Focus on input/output behavior.

• Based on user requirements.

Techniques:

• Equivalence Partitioning

• Boundary Value Analysis

• Decision Table Testing

Advantages: User-centric, no coding knowledge needed. Disadvantages: Limited in detecting internal logic issues.
2. Code-Based Testing (White Box Testing)
Approach: Tests the internal code structure, logic, and paths. Requires knowledge of the code.
Characteristics:
• Code knowledge required.
• Focus on code coverage (statements, branches, paths).
• Tests internal logic.
Techniques:
• Statement Coverage
• Branch Coverage
• Path Coverage
• Advantages: Thorough code validation, detects internal issues. Disadvantages: Requires coding knowledge, time-
consuming.
Chapter -2 – Boundary Value Testing
1. Test Cases for the Triangle problem.

The triangle problem typically asks to determine if three given side lengths can form a valid triangle and, in some
variations, to classify the triangle (e.g., equilateral, isosceles, scalene). Below are some potential test cases for the
triangle problem.

Normal Boundary Value Test Cases.

Case a b c Expected
outcome
1 100 100 1 Isosceles
2 100 100 100 Equilateral
3 100 1 200 Scalene
4 ? 100 200 Not a Triangle
2. Next date function
A Next Date function is a function that, when provided with a specific date, calculates and returns the date of the
following day.
• Key Purpose:
• It accepts a given date as input.
• It calculates the date that follows the provided date by one day.
• It handles special cases like moving from the last day of a month to the first day of the next month or from
December 31 to January 1 of the next year.

worst Case Test Cases


Case Month Day Year Expected
Outcome

1 1 22 2005 1-22-2005
2 2 7 2007 2-8-2007
3 3 3 2025 4-3-2025
3. Test Cases for the commission Problem
• The commission problem is about calculating the payment (commission) that someone earns for selling a product
or service. The commission is usually a percentage of the sale price.
• Example:
• If a salesperson sells a product for ₹1,000 and earns a 10% commission, they will make ₹100 as commission .

Test Sales Input Expected Commission Description


Case
1 800 40 Commission for sales below $1,000 (5%)
2 3500 245 Commission for sales between $1,000
and $5,000 (7%)
3 6200 620 Commission for sales above $5,000
(10%)
• Random Testing

Random testing is a type of software testing technique where test cases are generated randomly, often without
any predefined structure or patterns. The goal is to find unexpected bugs or errors in the software by using
unpredictable inputs and scenarios.
• Advantages of Random Testing
• It is very cheap so that anyone can use this software.
• It doesn’t need any special intelligence to access the program during the tests.
• Errors can be traced very easily; it can easily detect the bug throughout the testing.
• Disadvantages of Random Testing
• This software only finds changes errors.
• They are not practical. Some tests will be of no use for a longer time.
• Most of the time is consumed by analyzing all the tests.
• New tests cannot be formed if their data is not available during testing.

You might also like