0% found this document useful (0 votes)
9 views7 pages

White Box Testing Techniques Explained

wt

Uploaded by

vinitgaonkar2006
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)
9 views7 pages

White Box Testing Techniques Explained

wt

Uploaded by

vinitgaonkar2006
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

White Box Testing

White box testing techniques analyze the internal structures the used data structures,
internal design, code structure, and the working of the software rather than just the
functionality as in black box testing. It is also called glass box testing or clear box testing or
structural testing. White Box Testing is also known as transparent testing or open box
testing.

The white box testing contains various tests, which are as follows:

o Basis Path testing

o Loop testing

o Condition testing

o Testing based on the memory perspective

o Test performance of the program

Basis Path Testing: In this technique, control flow graphs are made from code or flowchart
and then Cyclomatic complexity is calculated which defines the number of independent
paths so that the minimal number of test cases can be designed for each independent path.
Steps:
1. Make the corresponding control flow graph
2. Calculate the cyclomatic complexity
3. Find the independent paths
4. Design test cases corresponding to each independent path
5. V(G) = P + 1, where P is the number of predicate nodes in the flow graph
6. V(G) = E – N + 2, where E is the number of edges and N is the total number of
nodes
7. V(G) = Number of non-overlapping regions in the graph
8. #P1: 1 – 2 – 4 – 7 – 8
9. #P2: 1 – 2 – 3 – 5 – 7 – 8
10. #P3: 1 – 2 – 3 – 6 – 7 – 8
11. #P4: 1 – 2 – 4 – 7 – 1 – . . . – 7 – 8
Aim: To design test cases using white box testing techniques for College
Management System .

White Box Testing:


Code 1 (To login as student, as Faculty and as admin):

<?php
include '[Link]';
$roleId = $_SESSION['Role'];
$sql = "SELECT * FROM `role` WHERE `roleID` = $roleId";
$res = $conn->query($sql);
$result = '';

if($result['roleName'] == "student"){
?>
//student footer
<?php }else if($result['roleName'] == "student head"){ ?>
//student head footer
<?php }else if($result['roleName'] == "admin"){ ?>
//admin footer
<?php }?>

Flowgraph 1:

3 4

5 6

8
Calculate CC:
Method 1:
Cyclomatic complexity (CC) = Edges (E) – Nodes (N) + 2
=9–8+2
=3
Method 2:
Cyclomatic complexity (CC) = No of regions + 1
=2+1
=3
Method 3:
Cyclomatic complexity (CC) = No. of predicate nodes + 1
=3+1
=4

Basic Paths:
Path 1: 1-2-3-8
Path 2: 1-2-4-5-8
Path 3: 1-2-4-6-7-8

Test Cases:

Project Name: College Management System


Test Case 1
Test Case ID: TC11 Test Designed By:
Test Priority: High Test Designed Date:
Module Name: User Login Screen Test Executed By:
Test Title: Verify the user Login page Test Executed Date:
Description: Test the login of the user.

Steps Text Test Data Expected Actual Status Notes


Steps Result Result (Pass/Fail)
1 Navigate User User gets Pass
to Login should be logged in
Page able to and
2 Provide Mayur2023@[Link] login and redirected
valid see the to user
username dashboard dashboard
3 Provide 123456 . .
valid
Password
4 Click on
Login
button
Project Name: College Management System
Test Case 2
Test Case ID: TC12 Test Designed By:
Test Priority: High Test Designed Date:
Module Name: Faculty Login Screen Test Executed By:
Test Title: Verify the Faculty Login page Test Executed Date:
Description: Test the login of the Faculty

Steps Text Test Data Expected Actual Status Notes


Steps Result Result (Pass/Fail)
1 Navigate Faculty Faculty Pass
to Login should be gets
Page able to logged in
2 Provide HODComps@[Link] login and and
valid m see the redirected
username dashboard. to user
3 Provide 123456 dashboard
valid .
Password
4 Click on
Login
button

Project Name: College Management System


Test Case 3
Test Case ID: TC13 Test Designed By:
Test Priority: High Test Designed Date:
Module Name: Admin Login Screen Test Executed By:
Test Title: Verify the Admin Login page Test Executed Date:
Description: Test the login of the Admin.

Steps Text Test Data Expected Actual Status Notes


Steps Result Result (Pass/Fail
)
1 Navigate Admin Admin gets Pass
to Login should be logged in
Page able to login and
2 Provide admin@[Link] and see the redirected to
valid m dashboard. user
username dashboard.
3 Provide 123456
valid
Password
4 Click on
Login
button
Code 2 (to view the are complaints are posted or not):

<?php
$id = $_SESSION["UserId"];
$sql = "SELECT * FROM `complaint_table` WHERE `userid` = '$id'";
$res = $conn->query($sql);
$row = "";
if($res->num_rows > 0){
while($rows = mysqli_fetch_assoc($res)) {
// Complaint details Table
?>
<?php
}
} else {
?>
// No Data Found
<?php
}
?>

Flowgraph 2:

3 4

6
Calculate CC:
Method 1:
Cyclomatic complexity (CC) = Edges (E) – Nodes (N) + 2
=7–6+2
=3
Method 2:
Cyclomatic complexity (CC) = No of regions + 1
=2+1
=3
Method 3:
Cyclomatic complexity (CC) = No. of predicate nodes + 1
=2+1
=3

Basic Paths:
Path 1: 1-2-3-6
Path 2: 1-2-3-5-3-6
Path 3: 1-2-4-6

Test Cases:

Project Name: College Management System


Test Case 1
Test Case ID: TC21 Test Designed By:
Test Priority: Medium Test Designed Date:
Module Name: Complaint History Page Test Executed By:
Test Title: To see previous complaint details Test Executed Date:
Description: Test the condition to see if
previous complaints are there or not.

Steps Text Steps Test Data Expected Actual Status Notes


Result Result (Pass/Fail)
1 Navigate to User should User should User sees Pass
Complaint have posted see only 1 only 1
History page exactly 1 Complaint in complaint in
complaint. the list. the list.
2 Wait until
complaints are
fetched
3 Table shows
list of
complaints
Project Name: College Management System
Test Case 2
Test Case ID: TC22 Test Designed By:
Test Priority: Medium Test Designed Date:
Module Name: Complaint History Page Test Executed By:
Test Title: To see previous complaint details Test Executed Date:
Description: Test the condition to see if
previous complaints are there or not.

Steps Text Steps Test Data Expected Actual Status Notes


Result Result (Pass/Fail
)
1 Navigate to User should User should User sees Pass
Complaint have posted see more than more than 1
History page more than 1 1 Complaints complaints in
complaint. in the list. the list.
2 Wait until
complaints
are fetched
3 Table shows
list of
complaints

Project Name: College Management System


Test Case 3
Test Case ID: TC23 Test Designed By:
Test Priority: Medium Test Designed Date:
Module Name: Complaint History Page Test Executed By:
Test Title: To see previous complaint details Test Executed Date:
Description: Test the condition to see if
previous complaints are there or not.

Steps Text Steps Test Data Expected Actual Result Status Notes
Result (Pass/Fail)
1 Navigate to User should User should User sees no Pass
Complaint have posted see no complaints in
History page no complaints the list.
complaints. in the list.
2 Wait until
complaints are
fetched
3 Table shows
list of
complaints

Conclusion : Studied White box technique(Basis path Testing) for testing .

You might also like