Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Download as pdf or txt
Download as pdf or txt
You are on page 1of 74

SOFTWARE TESTING

UNIT-I [12 Hours]

Introduction: Basic definitions, A testing life cycle, Test Cases, Fundamental approaches to apply Test Cases,
Levels of Testing, Examples: The NextDate function, Triangle problem and The Commission Problem and
The SATM (Simple Automatic Teller Machine) problem. Boundary Value Testing: Generalizing Boundary
Value Analysis, Limitations of Boundary Value Analysis, Robustness Testing, Worst-Case Testing, Special
Value Testing, Test cases for the Triangle problem, Test cases for the NextDate function, Test cases for the
Commission Problem, Random Testing and Guidelines for Boundary Value Testi
INTRODUCTION TO
SOFTWARE TESTING
Software Testing
Software testing is a process of identifying the correctness of
software by considering its all attributes (Reliability, Scalability,
Portability, Re-usability, Usability) and evaluating the execution
of software components to find the software bugs or errors or
defects.
Why software testing ?
• Defects can be identified early: Software testing is important because if there are any
bugs that can be identified early and can be fixed before the delivery of the software.
• Improves quality of software: Software Testing uncovers the defects in the software,
and fixing them improves the quality of the software.
• Increased customer satisfaction: Software testing ensures reliability, security, and high
performance which results in saving time, costs, and customer satisfaction.
• Helps with scalability: Software testing type non-functional testing helps to identify
the scalability issues and the point where an application might stop working.
• Saves time and money: After the application is launched it will be very difficult to trace
and resolve the issues, as performing this activity will incur more costs and time. Thus,
it is better to conduct software testing at regular intervals during software
development.
What is Testing ?
Testing is a group of techniques to determine the correctness of the application under the
predefined script but, testing cannot find all the defects of an application.
Its main focus is on where the software is NOT WORKING not to confirm that if it is working in all
conditions .

The mechanism of testing consists of


✓ Relevant standards
✓ Comparable products
✓ Interfaces of the expected purpose
✓ Past versions of the same software etc.
Software testing –Two main steps
1. Verification: It refers to the set of tasks that ensure that the software correctly
implements a specific function. It means “Are we building the product right?”.
2. Validation: It refers to a different set of tasks that ensure that the software that has
been built is traceable to customer requirements. It means “Are we building the right
product?”.
Types of Testing
1. Manual testing :The process of checking the functionality of an application as per the customer
needs without taking any help of automation tools is known as manual testing.
While performing the manual testing on any application, we do not need any specific knowledge of
any testing tool, rather than have a proper understanding of the product so we can easily prepare the
test document.
Testers use test plans, test cases, or test scenarios to test software to ensure the completeness of
testing.

2. Automation Testing :Automation testing is a process of converting any manual test cases into the
test scripts with the help of automation tools, or any programming language is known as automation
testing.
With the help of automation testing, we can enhance the speed of our test execution because here,
we do not require any human efforts. We need to write a test script and execute those scripts.
1. Manual Testing
i) White Box Testing : White box testing is a software testing technique that involves testing the
internal structure and workings of a software application. The tester has access to the source code and uses
this knowledge to design test cases that can verify the correctness of the software at the code level.
It is also called glass box testing clear box testing or structural testing/transparent testing or open box
testing.
ii) Black Box Testing : Black-box testing is a type of software testing in which the tester is not concerned
with the internal knowledge or implementation details of the software but rather focuses on validating the
functionality based on the provided specifications or requirements. Two types : Functional & Non-functional
iii) Gray box Testing : Gray Box Testing is a software testing technique that is a combination of the Black
Box Testing technique and the White Box Testing technique.
▪ In the Black Box Testing technique, the tester is unaware of the internal structure of the item being tested
and in White Box Testing the internal structure is known to the tester.
▪ The internal structure is partially known in Gray Box Testing.
▪ This includes access to internal data structures and algorithms to design the test cases.
Types of BlackBox testing
1. Functional Testing : It is a type of Software Testing in which the system is tested
against the functional requirements and specifications . It ensures that the requirements
or specifications are properly satisfied by the application. This type of testing is
particularly concerned with the result of processing. Three types : Unit,Integration and
System Testing
2. Non-functional Testing : is a type of software testing that is performed to verify
the non-functional requirements of the aspects that are not tested in functional testing.
It checks the non-functional attributes of the system like performance,usability etc.
Three types : Performance,Usability and Comapatibitility
Types of Functional Testing
1. Unit Testing: is a method of testing individual units or components of a software
application. It is typically done by developers and is used to ensure that the individual units of
the software like a small function or a method are working as intended in isolation.
2. Integration Testing :is a method of testing how different units or components of a
software application interact with each other. It is used to identify and resolve any issues that
may arise when different units of the software are combined and checks whether they work
together as intended. Eg. Top-down,Bottom-up etc.
It is performed after unit testing and before functional testing .types- Incremental & Non-
Incremental
3. System Testing : is a type of software testing that evaluates the overall functionality and
performance of a complete and fully integrated software solution. It tests if the system meets
the specified requirements and if it is suitable for delivery to the end-users. This type of testing
is performed after the integration testing and before the acceptance testing
Types of Integration Testing
i) Incremental Testing :Several stubs and drivers are used to test the modules one
after one which helps in discovering errors and defects in the specific module. Defects
are detected in smaller modules rather than denoting errors and then editing and re-
correcting large files. The customer gets the chance to respond to each building.
Two Types : Top-Down and Bottom-up testing

ii) Non-Incremental Testing :is a method that involves integrating and testing all the units
or modules at once, after they have been individually tested and verified. This way, you can save
time and resources, avoid redundant testing, and test the system as a whole.
Types of Non-Functional Testing
1. Performance Testing:It is a testing technique carried out to determine system
performance in terms of sensitivity, reactivity, and stability under a particular
workload. It helps identify the bottlenecks like memory usage,network congestion etc.
under various system usage conditions .
2. Usability Testing : You design a product (say a refrigerator) and when it becomes
completely ready, you need a potential customer to test it to check it working. the best
example of usability testing is when the software also undergoes various testing
processes which is performed by potential users before launching into the market
3. Compatibility Testing : it is performed on an application to check its compatibility
(running capability) on different platforms/environments. This testing is done only when
the application becomes stable. It is crucial to avoid future issues with different
environment set ups .
Types of Performance Testing
i) Load testing : Load testing determines the behavior of the application when
multiple users use it at the same time. It is the response of the system measured under
varying load conditions.
ii) Stress testing : In Stress Testing, we give unfavorable conditions to the system and
check how it perform in those conditions like max disk usage,test cases with maximum
memory usage ,thrashing in virtual OS etc.
iii) scalability: the performance of a software application, system, network, or process is
tested in terms of its capability to scale up or scale down the number of user request load
or other such performance attributes. It can be carried out at a hardware, software or
database level.
iv) Stability : Stability Testing is a type of Software Testing to checks the quality and
behavior of the software under different environmental parameters. It is defined as the
ability of the product to continue to function over time without failure.
2. Automatic Testing
Automated Testing is a technique where the Tester writes scripts on their own and uses suitable
Software or Automation Tool to test the software. It is an Automation Process of a Manual
Process. It allows for executing repetitive tasks without the intervention of a Manual Tester.
• It is used to automate the testing tasks that are difficult to perform manually.
• Automation tests can be run at any time of the day as they use scripted sequences to examine the
software.
• Automation tests can also enter test data compare the expected result with the actual result and
generate detailed test reports.
• The goal of automation tests is to reduce the number of test cases to be executed manually but
not to eliminate manual testing.
• It is possible to record the test suit and replay it when required.
Software Testing Life Cycle
What is Software Testing Life Cycle
(STLC)?

The Software Testing Life Cycle (STLC) is a series of steps/phases of testing a


software application to ensure that it meets the requirements and is free of defects.
STLC involves both verification and validation activities. Contrary to popular belief, Software
Testing is not just a single/isolate activity, i.e. testing. It consists of a series of activities carried
out methodologically to help certify your software product.
Its main goal is early detection of defects so that the software issues are resolved before it is
released to public.
The stages of the STLC include Test Planning, Test Analysis, Test Design, Test
Environment Setup, Test Execution, Test Closure, and Defect Retesting.
1. Requirement Analysis
In this phase quality assurance team understands the requirements like what is to be tested. If
anything is missing or not understandable then the quality assurance team meets with the
stakeholders to better understand the detailed knowledge of requirements.

The activities :
• Reviewing the software requirements document (SRD) and other related documents
• Interviewing stakeholders to gather additional information
• Identifying any ambiguities or inconsistencies in the requirements
• Identifying any missing or incomplete requirements
• Identifying any potential risks or issues that may impact the testing process
• Creating a requirement traceability matrix (RTM) to map requirements to test cases

At the end :
The testing team should have a clear understanding of the software requirements and should
have identified any potential issues that may impact the testing process.
2. Test Planning
Test Planning is the most efficient phase of the software testing life cycle where all testing plans are defined. In this phase manager of the
testing, team calculates the estimated effort and cost for the testing work. This phase gets started once the requirement-gathering phase
is completed.
The activities :
• Identifying the testing objectives and scope
• Developing a test strategy: selecting the testing methods and techniques that will be used
• Identifying the testing environment and resources needed
• Identifying the test cases that will be executed and the test data that will be used
• Estimating the time and cost required for testing
• Identifying the test deliverables and milestones
• Assigning roles and responsibilities to the testing team
• Reviewing and approving the test plan
• At the end
the testing team should have a detailed plan for the testing activities that will be performed, and a clear understanding of the testing
objectives, scope, and deliverables
3. Test Case Development
In this phase testing team notes down the detailed test cases and prepares the required test
data for the testing.
When the test cases are prepared then they are reviewed by the quality assurance team.
The activities :
• Identifying the test cases that will be developed
• Writing test cases that are clear, concise, and easy to understand
• Creating test data and test scenarios that will be used in the test cases
• Identifying the expected results for each test case
• Reviewing and validating the test cases
• Updating the requirement traceability matrix (RTM) to map requirements to test cases
At the end :
A comprehensive set of test cases covering the entire software test requirements
4. Test Case Environment Set up
Basically, the test environment decides the conditions on which software is tested. This
is independent activity and can be started along with test case development. In this
process, the testing team is not involved. either the developer or the customer creates
the testing environment.
5. Test Case Execution
In this phase testing team starts executing test cases based on prepared test cases in the earlier step.
It is an iterative phase ,till all the defects are removed.
The activities :
• Test execution: The test cases and scripts created in the test design stage are run against the software
application to identify any defects or issues.
• Defect logging: Any defects or issues that are found during test execution are logged in a defect
tracking system, along with details such as the severity, priority, and description of the issue.
• Test data preparation: Test data is prepared and loaded into the system for test execution
• Test result analysis: The results of the test execution are analyzed to determine the software’s
performance and identify any defects or issues.
• Defect retesting: Any defects that are identified during test execution are retested to ensure that they
have been fixed correctly.
• Test Reporting: Test results are documented and reported to the relevant stakeholders.
6. Test Closure
Test closure is the final stage of the Software Testing Life Cycle (STLC) where all testing-related activities are completed and documented.
The main objective-the testing is completed and that the software is ready for release.
The activities :
• Test summary report: A report is created that summarizes the overall testing process, including the number of test cases executed, the
number of defects found, and the overall pass/fail rate.
• Defect tracking: All defects that were identified during testing are tracked and managed until they are resolved.
• Test environment clean-up: The test environment is cleaned up, and all test data and test artifacts are archived.
• Test closure report: A report is created that documents all the testing-related activities that took place, including the testing objectives,
scope, schedule, and resources used.
• Knowledge transfer: Knowledge about the software and testing process is shared with the rest of the team and any stakeholders who may
need to maintain or support the software in the future.
• Feedback and improvements: Feedback from the testing process is collected and used to improve future testing processes

At the end –testing team should have a clear understanding of the software’s quality and reliability, and any defects or issues that were
identified during testing should have been resolved. The test closure stage also includes documenting the testing process and any lessons
learned so that they can be used to improve future testing processes
Levels of Software Testing
1. Unit Testing
2. Integration Testing
3. System Testing
4. Acceptance Testing
Levels of Software Testing
1. Unit testing: It a level of the software testing process where individual
units/components of a software/system are tested. The purpose is to validate that each
unit of the software performs as designed.
2. Integration testing: It is a level of the software testing process where individual units
are combined and tested as a group. The purpose of this level of testing is to expose
faults in the interaction between integrated units.
3. System testing: It is a level of the software testing process where a complete,
integrated system/software is tested. The purpose of this test is to evaluate the
system’s compliance with the specified requirements.
4. Acceptance testing: It is a level of the software testing process where a system is
tested for acceptability. The purpose of this test is to evaluate the system’s compliance
with the business requirements and assess whether it is acceptable for delivery.
Test Cases
▪ The software testing process isn’t limited to finding faults in the present software but
also finding measures to upgrade the software in various factors such as efficiency,
usability, and accuracy. So, to test software the software testing provides a particular
format called a Test Case.
▪ A test case is a defined format for software testing required to check if a particular
application/software is working or not.
▪ A test case consists of a certain set of conditions that need to be checked to test an
application or software i.e. in more simple terms when conditions are checked it checks
if the resultant output meets with the expected output or not.
▪ A test case consists of various parameters such as ID, condition, steps, input, expected
result, result, status, and remarks.
Test Case -Parameters
• Module Name: Subject or title that defines the functionality of the test.
• Test Case Id: A unique identifier assigned to every single condition in a test case.
• Tester Name: The name of the person who would be carrying out the test.
• Test scenario: The test scenario provides a brief description to the tester, as in providing a
small overview to know about what needs to be performed and the small features, and
components of the test.
• Test Case Description: The condition required to be checked for a given software. for eg.
Check if only numbers validation is working or not for an age input box.
• Test Steps: Steps to be performed for the checking of the condition.
• Prerequisite: The conditions required to be fulfilled before the start of the test process.
• Test Priority: As the name suggests gives priority to the test cases that had to be
performed first, or are more important and that could be performed later.
Test Case -Parameters
• Test Data: The inputs to be taken while checking for the conditions.
• Test Expected Result: The output which should be expected at the end of the test.
• Test parameters: Parameters assigned to a particular test case.
• Actual Result: The output that is displayed at the end.
• Environment Information: The environment in which the test is being performed, such
as the operating system, security information, the software name, software version,
etc.
• Status: The status of tests such as pass, fail, NA, etc.
• Comments: Remarks on the test regarding the test for the betterment of the software.
Sample-Test Case
Why write Test Cases ?
• To check whether the software meets customer expectations: Test cases help to check if a
particular module/software is meeting the specified requirement or not.
• To check software consistency with conditions: Test cases determine if a particular
module/software works with a given set of conditions.
• Narrow down software updates: Test cases help to narrow down the software needs and
required updates.
• Better test coverage: Test cases help to make sure that all possible scenarios are covered
and documented.
• For consistency in test execution: Test cases help to maintain consistency in test execution.
A well-documented test case helps the tester to just have a look at the test case and start
testing the application.
• Helpful during maintenance: Test cases are detailed which makes them helpful during the
maintenance phase.
Fundamental approaches to apply Test
Cases
1. Define the area you want to cover from the test scenario.
2. Ensure the test case is easy for testers to understand and execute.
3. Understand and apply relevant test designs.
4. Use a unique test case ID.
5. Use the requirements traceability matrix in testing for visibility.
6. Include a clear description in each test.
7. Add proper preconditions and postconditions.
8. Specify the exact expected result.
9. Utilize suitable testing techniques.
10. Get your test plan peer-reviewed before moving forward.
Boundary Value testing
Boundary testing is the process of testing between extreme ends or boundaries between
partitions of the input values.
• So these extreme ends like Start- End, Lower- Upper, Maximum-Minimum, Just Inside-Just
Outside values are called boundary values and the testing is called “boundary testing”.
• The basic idea in normal boundary value testing is to select input variable values at their:
1. Minimum
2. Just above the minimum
3. A nominal value
4. Just below the maximum
5. Maximum
Boundary Value Testing
Boundary Value Analysis (BVA) is a black box software testing technique where test
cases are designed using boundary values.
It is based on the single fault assumption, also known as critical fault assumption which
states that failures are rarely the product of two or more simultaneous faults.
Hence, while designing the test cases for BVA we keep all but one variable to the
nominal value and allowing the remaining variable to take the extreme value.
Generalizing BVA
Test Case Design for BVA: While designing the test cases for BVA first we
determine the number of input variables in the problem.
For each input variable, we then determine the range of values it can take.
Then we determine the extreme values and nominal value for each input variable.
Consider an input variable t - taking values in the range [l, r].
Extreme values for t are – t = l
t = l+1
t = r-1
t=r

The nominal value for the variable can be any value in the range (l, r).
In most of the BVA implementations, it is taken as the middle value of the
range (r+l)/2.
Under the single fault assumption, the total number of test cases in BVA for
a problem with n inputs is 4n+1 ( 4 –extreme values + 1 (nominal value)
Generalizing BVA
Generalizing changes depends upon the nature of the variables.
For eg:
In nextDate function ,the variables are month,day and year which are encoded as
Jan=1,Feb=2 etc. in typed languages like Fortran or enum types are used in language like
Pascal,C, etc. Which supports user defined types.

When variables don’t have discrete limits ,the limits are artificially determined as in triangle
problem where the min value is 1 ,max value is created .

BVA doesn’t makes sense for Boolean values as already they have only extreme values like
TRUE or FALSE.
Limitations of BVA
Boundary Value Analysis (BVA) is a functional testing technique that focuses on testing the boundary values of valid and
invalid partitions. While it has its merits, it’s essential to be aware of its limitations:
1. Assumption of Concentrated Defects Near Boundaries:
◦ BVA assumes that defects are primarily concentrated near the boundaries of input ranges. However, this may not
always hold true. Some defects might occur within the interior of the input domain.
◦ In complex systems, interactions between multiple input variables can lead to defects that are not solely boundary-
related.
2. Neglecting Functional Dependencies:
◦ BVA does not consider the functional dependencies between variables. It treats each variable independently.
◦ For instance, if two variables are interrelated, BVA might miss defects arising from their combined behavior.
3. Rudimentary Approach:
◦ BVA is relatively straightforward and doesn’t delve into the internal system behavior.
◦ It focuses solely on input ranges and doesn’t explore other aspects of system functionality.
4. Combinatorial Explosion:
◦ When dealing with systems having multiple input variables, BVA can lead to a large number of test cases.
◦ The effort required to test all possible combinations can become significant.
Example : Boundary value
Boundary Value Analysis– in Boundary Value Analysis, you test boundaries between equivalence
partitions

In our earlier equivalence partitioning example, instead of checking one value for each partition, you will
check the values at the partitions like 0, 1, 10, 11 and so on. As you may observe, you test values at both
valid and invalid boundaries. Boundary Value Analysis is also called range checking.
Example- Median X Y Z Median

To calculate median of values from 100 to 500 (median is middle 100 300 300 300
value of ordered elements 101 300 300 300
300 300 300 300
for x, y, z : 499 300 300 300
min value = 100
500 300 300 300
close to min = 101
nominal = 300 300 100 300 300
close to max = 499 300 101 300 300
max = 500 300 499 300 300
300 500 300 300
Number of Test Cases = 4n + 1 ; where n is no. of variables
(4-cases + 1-nominal value) 300 300 100 300
4*3 + 1 = 13 300 300 101 300
300 300 499 300
300 300 500 300
Robust Case Testing
Robustness testing is a type of testing that is performed to assess the ability of a system or
component to function correctly when it is subjected to invalid or unexpected inputs, or
when it is operating outside of its specified operating conditions.
It is typically used to test for the presence of memory leaks or other types of errors like
high temperature,humidity, etc. that can cause a system to crash.
Robustness testing is also sometimes referred to as reliability testing, stress testing, or
endurance testing.
The purpose of robustness testing is to identify the parts of the system that are most
vulnerable to failure and to determine how the system can be made more resistant to
failure.
It basically focuses on expected outputs (as what would occur for certain out of bound input
values ) rather that input variables
It is conducted after the system has been tested under normal conditions.
Robust Case Testing - Example
Here, we go outside the legitimate boundary, it is an
extension of boundary value analysis.
for x, y, z :
min value : 100
close to min : 101
nominal : 300
close to max : 499
max : 500
lesser than min value : 99
larger than max value : 501

Total test cases , 6n+1 ,where n -> no. of variables


= 6*n+1 = 6*3+1 = 19

So there will be extra 6 cases apart from the above 13


cases –
Why is Robustness Testing important?

• Handle Unexpected Inputs: Robustness testing is important because it helps ensure


that a system can handle unexpected or abnormal inputs without crashing.
• Uncover Potential Issues: This type of testing can help uncover potential issues that
could cause a system to fail in unexpected ways. By uncovering these issues early on,
they can be fixed before the system is put into production.
• Test Limits: It allows developers to test the limits of their software and ensure that it
can handle unexpected inputs and situations.
• Uncover Hidden Bugs: This type of testing can help uncover hidden bugs that could
cause major problems in the field.
• Stability: This can help to prevent software failures and crashes, and can also help to
improve the overall stability of your software.
Worst Case testing
• These cases consider scenarios where multiple variables have extreme values.
• It challenges the “single fault assumption” theory.
• Total test cases: 125 (5^n, where n is the number of variables)

• Example: The set of worst cases involves a cross product of three sets:
{100, 101, 300,499, 500} for x, y, and z.

Total no. of test cases,


5^n = 5^3 = 125 cases

Mathematically, the test cases will be a cross product of 3 sets –

{100, 101, 300, 499, 500} x {100, 101, 300, 499, 500} x {100,
101, 300, 499, 500}
Special Value testing
Spccial Valuc ľcsti⭲g is one such testing technique, which aims at fulfilling all youí
testing needs effoítlessly. It is executed by expeít testeís who go thíough each and
eveíy aspect of the píogíam and use theií domain knowledge to devise test cases. ľhis
type of functional testing is highly populaí and píovides most accuíate íesults.
Benefits:
1. Past Experience: Testers draw from their past experiences to ensure no bugs or defects go
undetected.
2. Industry Knowledge: Their deep understanding of the industry informs their testing approach.
3. Effective Bug Detection: Although subjective, Special Value Testing often reveals hidden issues in
software.
Example
1. Arithmetic Operations:
• Consider an expression: (Y = K op J) ,where k -> constant and j-> any value
• If the operator ((op)) is multiplication ( dot ) or division (/), the special value would be 0 or 1.
• If the operator is addition (+) or subtraction (-), the special value would be 0.
2. Sorting Function:
• Suppose we have an integer sorting function: int sort(int arr[], int n) .
• Special Value Testing scenarios:
• When (n = 0): Test the behavior when the array is empty.
• When the array is empty (empty set): Test with a value of 1.
Different problems in Software testing
➢ nextDate function
➢ Triangle problem
➢ Commission problem
➢ SATM problem
nextDate Problem
The Next Date problem is a classic software testing challenge that involves determining the date
following a given input date. The problem statement is as follows:
Given a date in the format of day-month-year, your task is to find the next date after the given
date.
It shows a logical relationships between the input variables day,month,year.
To tackle this problem, we can apply two testing techniques: Boundary Value Analysis
(BVA) and Equivalence Class Testing.
nextDate function
Given a day in the format of day-month-year, you need to find the next date for the
given date. We take the boundary values for the input variables (day,month,year) to
consider the test cases .
Conditions :

Boundary value analysis :


nextDate function
If the values of D,M,Y are invalid like beyond their range of values ,it generates an output “invalid
input Date”.
The leap year is also considered here
▪ If the year which is not a century year , is divisible by 4 ; it is a LEAP YEAR
▪ If the year is a century year,then it should be a multiple of 400;it is LEAP YEAR
nextDate function -BVA
Test Case Expected
ID Day Month Year Output
001 1 6 2000 2-6-2000
002 2 6 2000 3-6-2000
003 15 6 2000 16-6-2000
004 30 6 2000 1-7-2000
005 31 6 2000 Invalid Date
006 15 1 2000 16-1-2000
007 15 2 2000 16-2-2000
008 15 11 2000 16-11-2000
009 15 12 2000 16-12-2000
010 15 6 1800 16-6-1800
011 15 6 1801 16-6-1801
012 15 6 2047 16-6-2047
013 15 6 2048 16-6-2048
Triangle problem
The problem involves determining if three values, representing the lengths of the sides of a
triangle, form a valid triangle.
To perform boundary value analysis, we start by selecting test cases that include values at
the boundaries of the input domain.
In the case of the triangle problem, the input domain is defined by the length of each side,
which can be any positive number.
Triangle Problem accepts three integers – a, b, c as three sides of the triangle .
We also define a range for the sides of the triangle as [l, r] where l>0. It returns the type of triangle
(Scalene, Isosceles, Equilateral, Not a Triangle) formed by a, b, c.
For a, b, c to form a triangle the following conditions should be satisfied – a < b+c
b < a+c
If any of these conditions are not satisfied,it is not a triangle c < a+b
Triangle problem
The following are some example test cases for the triangle problem using boundary
value analysis:
1. The smallest possible triangle: 3 sides of length 1. This test case tests the lower
boundary of the input domain.
2. A degenerate triangle: 3 sides of length 0. This test case tests the case where the
input values are at the lower boundary and are not valid.
3. An equilateral triangle: 3 sides of equal length. This test case tests the case where all
sides are equal.
4. An isosceles triangle: 2 sides of equal length, the third side is different. This test case
tests the case where two sides are equal.
5. A scalene triangle: 3 sides of different length. This test case tests the case where all
sides are different.
Triangle problem
Test case conditions for values in the range a/b/c = 1 to 200 :
c1 : 1<=a<=200 c4 : a<b+c
c2 : 1<=b<=200 c5 : b<c+a
c3 : 1<=c<=200 c6 : c<a+b
The output of the program is the type of triangle determined by the sides of the triangle
(Scalene,Isosceles,Equilateral)
If the input value fails any of the conditions c1/c2/c3, it displays the message “ Value of a or b or
c not in range” .If all condtions c1 and c2 and c3 are satisfied ,it checks for c4,c5,c6 to print the
type of triangle.
Expected
Test Case ID a b c The range value [l, r] is
Output taken as [1, 100] and
T1 1 50 50 Isosceles nominal value is taken
as 50.
T2 2 50 50 Isosceles The total test cases is,
T3 99 50 50 Isosceles
T4 100 50 50 Not a Triangle 4n+1 = 4*3+1 = 13
T5 50 50 50 Equilateral
T6 50 1 50 Isosceles
T7 50 2 50 Isosceles
T8 50 99 50 Isosceles
T9 50 100 50 Not a Triangle
T10 50 50 1 Isosceles
T11 50 50 2 Isosceles
T12 50 50 99 Isosceles
T13 50 50 100 Not a Triangle
int main() { Triangle Program implementation
int a,b,c,c1,c2,c3;

do {

printf("enter the sides of triangle\n");

scanf("%d%d%d",&a,&b,&c);

c1=((a>=1) && (a<=10));

c2=((b>=1) && (b<=10));

c3=((c>=1) && (c<=10));

if(!c1) printf("value of a is out of range");

if(!c2) printf("value of b is out of range");

if(!c3) printf("value of c is out of range");

}while(!c1 || !c2 || !c3);

if((a+b)>c && (b+c)>a && (c+a)>b)

{ if(a==b && b==c) printf("triangle is equilateral\n");

else if(a!=b && b!=c && c!=a) printf("triangle is scalene\n");

else printf("triangle is isosceles\n");

else printf("triangle cannot be formed \n");

getch( );
return 0; }
SHIVANJALI KESHARWANI
Commission problem
▪ A rifle salesperson in the former Arizona Territory sold rifle locks, stocks, and
barrels made by a gunsmith in Missouri.
▪ Locks cost $45,
▪ Stocks cost $30, and
▪ Barrels cost $25.
▪ The salesperson had to sell at least one lock, one stock, and one barrel (atleast
one complete rifle) per month
Production limits:
▪ Maximum of 70 locks ; 1<=locks<=70
▪ Maximum of 80 stocks ; 1<=stocks<=80
▪ Maximum of 90 barrels ; 1<=barrels<=90
Commission problem
▪ After each town visit, the salesperson sent a telegram to the Missouri gunsmith
with the number of locks, stocks, and barrels sold in that town.
▪ At the end of a month, the salesperson sends a very short telegram showing
–1 lock sold ( to indicate the end of inputs for a particular saleperson)
▪ The gunsmith then knew the sales for the month were complete and computed
the salesperson’s commission as follows:
▪ 10% on sales up to (and including) $1000
▪ 15% on the next $800
▪ 20% on any sales in excess of $1800.
Commission problem
The commission program produced a monthly sales report that gave the total number of
locks,stocks and barrels sold,the salesperson’s total dollar sales and finally the commission.
Sales = lock_price * tot_locks + stock_price * tot_stocks + barrel_price * tot_barrel
Commission -> If sales >1800
commission =0.10 * 1000.0
commission=commission + 0.15*800.0
commission=commission+0.20* (sales-1800.0)
Else If sales >1000
Commission =0.10 * 1000.0
Commission=commission + 0.15*(sales-1000.0)
Else
Commission=0.10*sales
Commission problem Test cases
For commission problem ,we look into boundary values for the output range especially near
the threshold range 1000$ and 1800$ .
[Note : This is Generalized table to produce test cases ,to be
written in rough to plan the test cases]
Sales value range from 100 (min) to 7800 (max).

LOCKS STOCKS BARRELS SALES COMMENT MIN+


1 1 1 100 MIN
BORDER -
5 5 5 500 MID
10 10 10 1000 BORDER BORDER +

14 14 14 1400 MID BORDER -


18 18 18 1800 BORDER BORDER +
48 48 48 4800 MID MAX-
70 80 90 7800 MAX
TEST CASES
Screen Outcome
1,4 PAN not found
1,2,3 PIN incorrect
1,2,5 PIN correct
5,6,14 Balance Inquiry
5,12 Problem in deposits
5,13,12 Problem in deposits
5,13,14,15 successful deposits
5,7,8 Problem in withdrawals
5,10 Problem in withdrawals
5,7,11,15 Successful withdrawals

PAN- Personal Account Number

SHIVANJALI KESHARWANI
Guidelines for Boundary Value testing
Boundary Value Analysis (BVA) is a valuable technique in software
testing. Let’s dive into the guidelines for conducting boundary value
testing:
1. Equivalence Partitioning:
◦ Begin by creating equivalence partitions to define the areas you want to test.
◦ Focus primarily on the valid partition and identify the boundaries within it.
2. Boundary Identification:
◦ Determine the exact boundary values for the input parameters.
◦ These boundaries represent the edge values of valid and invalid partitions.
Guidelines for Boundary Value testing
3. Test Case Design:
Construct test cases that cover the following scenarios:
• Minimum value: Test just above the minimum boundary.
• Nominal value: Test within the valid range.
• Maximum value: Test just below the maximum boundary.
• Invalid values: Test values outside the valid range.
4. Single Fault Assumption:
• When checking multiple variables, use a single fault assumption.
• Hold all but one variable at extreme values while allowing the remaining
variable to take the extreme value.
• For n variables, consider a maximum of 4n+1 test cases.
Example
Suppose we have a program that determines historical data based on input
parameters: Day, Month, and Year. The valid ranges are as follows:
• 1 ≤ Month ≤ 12
• 1 ≤ Day ≤ 31
• 1900 ≤ Year ≤ 2000
Using single fault assumptions, we can design test cases:
Year as Single Fault Assumption:
◦ Vary the year from 1900 to 2000 (nominal values for other parameters).
◦ Example test cases:
Month: 6, Day: 15, Year: 1990 → Output: 14 June 1990
Month: 6, Day: 15, Year: 1901 → Output: 14 June 1901
Random Testing
Random testing is software testing in which the system is tested with the help of generating random
and independent inputs and test cases. Random testing is also named monkey testing. It is a black box
assessment outline technique in which the tests are being chosen randomly and the results are being
compared by some software identification to check whether the output is correct or incorrect.
Characteristics of Random Testing:
▪ Random testing is implemented when the bug in an
application is not recognized.
▪ It is used to check the system’s execution and dependability.
▪ It saves our time and does not need any extra effort.
▪ Random testing is less costly, it doesn’t need extra
knowledge for testing the program.
Random Testing
Working
Step-1: Identify Input domain.
Step-2: Select test inputs independently/randomly from the input domain.
Step-3: Test the system on these inputs and form a random test set.
Step-4: Compare the result with system specification.
Step-5: If the Report fails then take necessary action.
Types of Random Testing
Types of Random Testing
1. Random input sequence generation: It is also known as Random Number Generator
(RNG) in which a random sequential number or symbols is being generated which
cannot be assumed during the random selection.
2. Random sequence of data inputs: In this, all the data are selected randomly for the
inputs which can be used during the testing.
3. Random data selection from an existing database: The record where all the data
are available from that record only the data can be selected for testing afterward no
additional data cannot be added which are not available in the record.
Advantages & Disadvantages of Random
Testing
Advantages
1. It is very cheap so that anyone can use this software.
2. It doesn’t need any special intelligence to access the program during the tests.
3. Errors can be traced very easily; it can easily detect the bug throughout the testing.
4. This software is lacking bias means it makes the groups evenly for the testing and it prefers not to
repeatedly check the errors as there can be some changes in the codes throughout the testing process.
Disadvantages
1. This software only finds changes errors.
2. They are not practical. Some tests will be of no use for a longer time.
3. Most of the time is consumed by analyzing all the tests.
4. New tests cannot be formed if their data is not available during testing.

You might also like