[go: up one dir, main page]

0% found this document useful (0 votes)
70 views18 pages

CHAPTER 2 Software Testig

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

CHAPTER 2 Software Testig

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

CHAPTERCHAPTER 2

Software Testing Strategies and


Techniques

Q.1.Short Answer Question


1. Define test strategy:
Test strategy is a high-level plan that outlines the approach and objectives of
software testing. It includes the scope, resources, schedule, and methodologies
for testing to ensure the software meets specified quality standards.

2. Define test case:


A test case is a detailed set of conditions or variables under which a tester
will determine whether an application, system, or one of its features is working
as intended.

3. List techniques for software testing:


Some software testing techniques include:
- Unit Testing
- Integration Testing
- System Testing
- Acceptance Testing
- Regression Testing
- Performance Testing
- Security Testing

4. Define data flow testing:

Abhishek Shinde| PVP College,Loni


Data flow testing is a white-box testing technique that focuses on the paths
that data takes through the software. It aims to identify and test the paths of
data from input to output in order to ensure proper data handling.

5. Define white box testing:


White-box testing, also known as structural or glass-box testing, involves
testing the internal logic, structure, and code of a program. Testers have
knowledge of the internal workings of the application, allowing them to design
test cases based on code analysis.

6. What is basic path testing:


Basic path testing is a white-box testing technique that aims to test all
possible paths through a program's source code at least once. It helps identify
and execute the basic set of paths that cover the program's logic.

7. Define loop testing:


Loop testing is a testing technique that focuses on testing the functionality of
loops within a program. It ensures that loops execute the correct number of
times, handle boundary conditions, and terminate appropriately.

8. Define data flow testing:


Data flow testing is a white-box testing technique that focuses on the paths
that data takes through the software. It aims to identify and test the paths of
data from input to output to ensure proper data handling.

9. Define equivalence partitioning:


Abhishek Shinde| PVP College,Loni
Equivalence partitioning is a testing technique where input data is divided
into partitions, and test cases are designed to cover each partition. It helps
ensure that the application behaves consistently within each partition.

10. List any two test characteristics:


- Reliability
- Maintainability

11. Define black box testing:


Black-box testing is a testing approach where the tester does not have
knowledge of the internal structure, logic, or code of the application. It focuses
on testing the functionality and behavior of the software.

12. Define testability:


Testability is the degree to which a system or application allows for easy
testing. A testable system is designed in a way that facilitates the creation and
execution of test cases.

13. Define Cyclomatic complexity:


Cyclomatic complexity is a software metric used to measure the complexity
of a program by counting the number of linearly independent paths through its
source code. It provides insights into the testing effort required.

14. What is the purpose of BVA (Boundary Value Analysis):


Boundary Value Analysis is a software testing technique that focuses on
testing values at the boundaries of input domains. The purpose is to ensure
that the application handles boundary values effectively, as these values often
lead to errors.

Abhishek Shinde| PVP College,Loni


Q.2.Long Answer Questions
1. What is test strategy? What is its purpose in testing? Also state its
characteristics:

Test Strategy:
Test strategy is a comprehensive plan outlining the approach, scope,
resources, and schedule for testing a software application. Its purpose is to
provide guidance on how testing will be conducted to ensure that the software
meets specified quality standards.

Characteristics of Test Strategy:


- Scope: Clearly defines what will be tested, including features,
functionalities, and aspects to be covered.
- Resources: Specifies the human, hardware, and software resources required
for testing.
- Schedule: Outlines the timelines for different testing phases and activities.
- Test Levels: Describes the various testing levels such as unit testing,
integration testing, system testing, etc.
- Test Types: Identifies the types of testing to be performed, such as
functional, non-functional, and regression testing.
- Entry and Exit Criteria: Defines conditions for entering and exiting each
testing phase.
- Risks and Contingencies: Addresses potential risks in the testing process
and outlines contingency plans.
- Communication: Establishes communication channels and reporting
mechanisms within the testing team and with stakeholders.

2. What is a test case? How to create it? Explain with an example:

Abhishek Shinde| PVP College,Loni


Test Case:
A test case is a detailed set of conditions or variables under which a tester will
determine whether an application, system, or one of its features is working as
intended.

Creating a Test Case:


1. Test Case ID: Unique identifier for the test case.
2. Test Case Description: A brief description of the test scenario.
3. Preconditions: Conditions that must be satisfied before executing the test.
4. Test Steps: Detailed steps to execute the test, including input data and
expected results.
5. Expected Result: The anticipated outcome after executing the test steps.
6. Actual Result: Record the actual result after test execution.
7. Status: Pass, fail, or not executed.

Example:
Test Case ID: TC001
Test Case Description: Verify login functionality.
Preconditions: User credentials are valid.
Test Steps:
1. Open the application.
2. Enter valid username and password.
3. Click the "Login" button.
Expected Result: User should be successfully logged in.

3. What are the characteristics of a test?

Abhishek Shinde| PVP College,Loni


Characteristics of a Test:
- Relevance: The test should be relevant to the functionality being tested.
- Accuracy: The test should produce accurate and reliable results.
- Efficiency: The test should be designed and executed efficiently without
unnecessary complexity.
- Consistency: The test should provide consistent results when executed
repeatedly.
- Traceability: The test should be traceable to requirements or specifications.
- Maintainability: The test should be easily maintainable for updates and
changes.
- Independence: Tests should be independent of each other to ensure
isolated validation.

4. What is testability? What are its characteristics? Explain two of them in


detail:

Testability:
Testability is the degree to which a system or application facilitates testing. It
involves designing software in a way that makes it easy to create and execute
test cases.

Characteristics of Testability:
- Observability: The ability to observe and measure the system's internal
state and outputs during testing. It involves having proper logging and
monitoring mechanisms.
- Controllability: The degree to which testers can control and manipulate the
system during testing. It includes features like input control and test
environment setup.

Abhishek Shinde| PVP College,Loni


Details on Observability:
Observability ensures that the system's behavior and outputs can be
monitored and recorded during testing. This characteristic is crucial for
identifying issues and understanding how the system responds to different
inputs. It involves implementing logging mechanisms, instrumentation, and
monitoring tools to capture relevant data.

Details on Controllability:
Controllability focuses on the tester's ability to control and manipulate the
system during testing. This characteristic is essential for creating diverse test
scenarios and ensuring that the system behaves as expected under different
conditions. Controllability includes features such as input control, test
environment configuration, and the ability to simulate specific conditions for
testing.

5. With the help of a diagram and example, describe white box testing. Also,
state its advantages and disadvantages:

White Box Testing:


White-box testing, also known as structural or glass-box testing, involves
testing the internal logic, structure, and code of a program. Testers have
knowledge of the internal workings of the application, allowing them to design
test cases based on code analysis.

Diagram:

+------------------+
| Application Code |
+------------------+
|

Abhishek Shinde| PVP College,Loni


V
+------------+
| White Box |
| Testing |
+------------+

Example:
Consider a function that calculates the sum of two numbers. A white-box test
would involve analyzing the code and creating test cases to ensure all code
paths are covered.

python
def add_numbers(a, b):
if a > 0 and b > 0:
return a + b
elif a < 0 and b < 0:
return a - b
else:
return 0

Advantages:
- Thorough Coverage: It ensures comprehensive coverage of the code paths.
- Early Bug Detection: Can detect issues at the early stages of development.

Disadvantages:

Abhishek Shinde| PVP College,Loni


- Complexity: Designing white-box tests requires knowledge of the internal
code, making it complex.
- Limited Perspective: Focuses on the internal structure, potentially missing
external behavior.

6. What is black box testing? Describe with a diagram and example:

Black Box Testing:


Black-box testing is a testing approach where the tester does not have
knowledge of the internal structure, logic, or code of the application. It focuses
on testing the functionality and behavior of the software.

Diagram:

+------------------+
| Application |
| Code |
+------------------+
|
V
+------------+
| Black Box |
| Testing |
+------------+

Example:

Abhishek Shinde| PVP College,Loni


Consider testing the login functionality of a web application. In black-box
testing, the tester would input valid and invalid credentials without knowledge
of the underlying code, focusing on the expected behavior of the login process.

html
<!-- Web Application Login Form -->
<form>
<input type="text" placeholder="Username">
<input type="password" placeholder="Password">
<button type="submit">Login</button>
</form>

7. How to design a test case in MS-Excel? Design test cases for mobile and
web applications:

Designing Test Cases in MS-Excel:


1. Create Columns:
- Test Case ID
- Test Case Description
- Preconditions
- Test Steps
- Expected Result
- Actual Result
- Status

2. Enter Test Case Details:

Abhishek Shinde| PVP College,Loni


- Populate each row with relevant information for a test case.

3. Format and Organize:


- Use different colors for clarity.
- Apply borders and formatting for a professional look.

Example Test Cases:


Test Case ID: TC001
9. Describe basic path testing with an example:

Basic Path Testing:


Basic path testing is a white-box testing technique that aims to test all possible
paths through a program's source code at least once. It helps identify and
execute the basic set of paths that cover the program's logic.

Example:
Consider a simple program with conditional statements:

python
def calculate_discount(price, quantity):
total_amount = price * quantity

if total_amount > 1000:


discount = 0.1 * total_amount
else:
discount = 0

Abhishek Shinde| PVP College,Loni


final_amount = total_amount - discount
return final_amount

Paths:
1. Path 1: Total amount > 1000 (True)
2. Path 2: Total amount > 1000 (False)

Basic Path Testing:


- Test data to cover Path 1 where the total amount is greater than 1000.
- Test data to cover Path 2 where the total amount is not greater than 1000.

10. What is loop testing? Explain with an example:

Loop Testing:
Loop testing is a testing technique that focuses on testing the functionality of
loops within a program. It ensures that loops execute the correct number of
times, handle boundary conditions, and terminate appropriately.

Example:
Consider a program with a 'for' loop to calculate the sum of numbers:

python
def calculate_sum(numbers):
total = 0
for num in numbers:
total += num

Abhishek Shinde| PVP College,Loni


return total

Loop Testing:
- Test with an empty list to ensure the loop handles zero iterations.
- Test with a single element in the list.
- Test with multiple elements in the list.

11. With the help of an example, describe a test case template:

Test Case Template:


1. Test Case ID: TC001
2. Test Case Description: Verify login functionality.
3. Preconditions: User credentials are valid.
4. Test Steps:
- Open the application.
- Enter valid username and password.
- Click the "Login" button.
5. Expected Result: User should be successfully logged in.
6. Actual Result: [Record actual result after execution]
7. Status: Pass/Fail/Not Executed

12. Differentiate between white box testing and black box testing:

White Box Testing:


- Knowledge: Tester has knowledge of the internal code and structure.

Abhishek Shinde| PVP College,Loni


- Focus: Tests internal logic, structure, and code paths.
- Design: Test cases are designed based on code analysis.
- Examples: Unit testing, integration testing.

Black Box Testing:


- Knowledge: Tester has no knowledge of the internal code.
- Focus: Tests functionality and behavior without looking at the code.
- Design: Test cases are designed based on specifications and requirements.
- Examples: Functional testing, acceptance testing.

13. What is data flow testing? Describe in detail:

Data Flow Testing:


Data flow testing is a white-box testing technique that focuses on the paths
that data takes through the software. It aims to identify and test the paths of
data from input to output to ensure proper data handling.

Components:
1. Nodes: Represent the points in the program where data is defined or used.
2. Edges: Represent the flow of data between nodes.

Example:
Consider a program with variables A, B, and C:

python
def calculate_sum(a, b):
c=a+b

Abhishek Shinde| PVP College,Loni


return c

Data Flow:
- A is defined as input.
- B is defined as input.
- C is defined as output.

Data Flow Testing:


- Test with different values for A and B to cover various data flow paths.
- Ensure data integrity from input to output.

14. With the help of an example, describe BVA and EP? Also, compare them:

Boundary Value Analysis (BVA):


BVA is a testing technique that focuses on testing values at the boundaries of
input domains.

Example:
For a range of acceptable values (10 to 50), test cases would include 9, 10, 11,
49, 50, and 51.

Equivalence Partitioning (EP):


EP is a testing technique that divides input data into partitions and selects
representative values from each partition.

Example:

Abhishek Shinde| PVP College,Loni


For a range of acceptable values (10 to 50), partitions could be 1 to 9, 10 to 50,
and 51 onwards.

Comparison:
- BVA: Tests specific values at the edges or boundaries.
- EP: Tests representative values from different partitions.
- Overlap: Some overlap between BVA and EP is possible.
- Focus: BVA is more focused on edge cases, while EP considers a broader
range of values.

15. What is Cyclomatic complexity and Graph matrix? Explain with an


example:

Cyclomatic Complexity:
Cyclomatic complexity is a software metric used to measure the complexity of
a program by counting the number of linearly independent paths through its
source code.

Example:
For a program with three decision points, the formula is:
\[ M = E - N + 2P \]
Where:
- \( M \) is the Cyclomatic Complexity.
- \( E \) is the number of edges.
- \( N \) is the number of nodes.
- \( P \) is the number of connected components.

Graph Matrix:

Abhishek Shinde| PVP College,Loni


A graph matrix represents the flow of control or data in a program. It is used to
calculate Cyclomatic Complexity.

Example:
Consider a simple program with decision points and control flow:

if (condition1) {
// Code Block 1
} else {
// Code Block 2
}

while (condition2) {
// Code Block 3
}

Graph Matrix:

123
1010
2101
3010

Abhishek Shinde| PVP College,Loni


In this matrix, rows and columns represent nodes (decision points), and 1s
indicate edges between nodes.

Comparison:
- Cyclomatic Complexity: Quantifies the complexity based on graph analysis.
- Graph Matrix: Visualizes the program's control or data flow to calculate
complexity.

Abhishek Shinde| PVP College,Loni

You might also like