1. Aim: To Develop test cases for White box testing
2. Objectives: From this experiment, the student will be able,
● To stress the importance of a testing in the development of a software
● Learn how traceability of tests from the source, allowing future changes to the
software to be easily captured in changes to the tests.
3. Outcomes: The learner will be able to
● To validate the software project
● To engage in continuing professional development and higher studies.
4. Hardware / Software Required: Any open source tool or technology can be used for
implementation.
5. Theory:
• White-box testingis also known as clear box testing, glass box testing, transparent
box testing, and structural testing. It is a method of testing software that tests
internal structures or workings of an application, as opposed to its functionality
(i.e. black-box testing ). In white-box testing an internal perspective of the system,
as well as programming skills, are used to design test cases. The tester chooses
inputs to exercise paths through the code and determine the appropriate outputs.
This is analogous to testing nodes in a circuit, e.g. in-circuit testing (ICT).
• White-box testing is testing that takes into account the internal mechanism of a
system or component
• White-Box Testing Techniques
• Statement coverage
• Loop testing
• Path testing
• Branch testing
• 100% method coverage: All methods in all classes are called.
• 100% statement coverage: All statements in a method are executed.
void foo (int a, b, c, d, e)
{
if (a == 0)
{
return;
}
int x = 0;
53
if ((a==b) OR ((c==d) AND bug(a) ))
{
x =1;
}
e = 1/x;
}
• Make sure all the paths are covered.
• Determine the paths
• Construct a logic flow chart
• Path testing: Determine Paths
• Logic flow diagram
• Cyclomatic complexity measures the amount of decision logic in the program
module.Cyclomatic complexity gives the minimum number of paths that can
generate all possible paths through the module. It is used to define minimum
number of test cases required for a module and it is used during software
development lifecycle to quantify maintainability and testability. Cyclomatic
complexity is defined as
54
CC = E – N + P
• Where
E = the number of edges of the graph
N = the number of nodes of the graph
P = the number of connected component
In case of connected graph
CC = E – N + 2
In simplified way it can be defined as
CC = D +1
Where
D = the number of decision points in the graph
• In following example the CC is 4, thus this module has 4 linearly independent
paths and this is the minimum number of test paths to achieve maximum
coverage
• TC0: 0->1->2->3->11
• TC1: 0->1->2->4->5->6->11
• TC2: 0->1->2->4->5->7->8->10->2->3->11
• TC3: 0->1->2->4->5->7->9->10->2->4->5->6->11
6. Procedure:
● Develop at least 2 test cases from case study & calculate cyclomatic complexity
with the help of above description.
● Results are kept in following format:
55
Sr
No.
Test cases Expected
output
Actual output
7. Conclusion:
● Test cases play important role in basis path testing. Using flow graph, we can
compute the number of independent paths through the code.
8. Viva Questions:
● What are different testing techniques?
● What is difference between white box testing & Black box testing?
9. References Books & Links:
1. agile.csc.ncsu.edu/SEMaterials/WhiteBox.pdf
2. airccse.org/journal/ijesa/papers/2212ijesa04.pdf
3. http://www.whiteboxtest.com/cyclomatic-complexity.php
4. http://www.tutorialspoint.com/software_testing_dictionary/cyclomatic_compl
exity.htm
GET INSTANT HELP FROM EXPERTS!
- Looking for any kind of help on your academic work (essay, assignment, project)?
- Want us to review, proofread or tidy up your work?
- Want a helping hand so that you can focus on the more important tasks?
Hire us as project guide/assistant. Contact us for more information
StudyMumbai.com is an educational resource for students, parents, and teachers, with special focus on Mumbai. Our staff includes educators with several years of experience. Our mission is to simplify learning and to provide free education. Read more about us.
Leave a Reply
You must be logged in to post a comment.