White Box Testing • Software testing method in which the internal design/implementation that is , the internal logic of the item being tested should be known to the tester. • A tester, usually a developer as well, studies the implementation code of certain module and hence decides all valid and invalid inputs to cover the paths through the code and determine the appropriate outputs and verifies them. White Box Testing: Steps • Source code understanding To understand the source code of the application being tested. The tester should know the programming language that is being used in developing the application. The tester should know the internal structure of the code. • Creation and execution of test cases To write test cases based on Statement/Decision/Condition/Branch coverage & actual execution of test cases for maximum testing coverage of the software application. White Box Testing: Code coverage techniques • Statement Coverage Whitebox testing technique where every statements, i.e each and every line of code is executed at least once during the testing process. • Branch/Decision Coverage Branch coverage covers every possible path ( true/false, or if-else and other conditional loops ). It covers all the possible outcomes of each condition at least once. It ensures that every possible branch from each decision point in the code is executed at least once. • Path Coverage Every path is executed at least once. It ensures that every statement in the program is guaranteed to be executed at least one time. • Other Coverage techniques Condition coverage, Multiple Condition coverage, Function coverage, etc. White Box Testing: Code coverage Example False True C1 A B if condition C1 then operation A else operation B endif C2 if condition C2 then operation C True False C White Box Testing: Code coverage Example False True C1 A B if condition C1 then operation A else operation B endif C2 if condition C2 then operation C True False C Testcase1: Execute operation A condition C1 = True. Testcase2: Execute operation B condition C1 = False. White Box Testing: Code coverage Example False True C1 A B if condition C1 then operation A else operation B endif C2 if condition C2 then operation C True False C Testcase3: Execute operation C condition C2 = True. White Box Testing: Code coverage Example False True C1 A B if condition C1 then operation A else operation B endif C2 if condition C2 then operation C True False C Test cases = 3 Testcase C1 C2 1 True X 2 False X 3 X True White Box Testing: Code coverage Example False True C1 A B if condition C1 then operation A else operation B endif C2 if condition C2 then operation C True False C Test cases = 2 Testcase C1 C2 1 True True 2 False True Case3 same as Case1, with C2 = True. White Box Testing: “Statement coverage” Example if condition C1 then operation A else operation B if condition C1 then operation A else operation B endif endif if condition C2 then operation C if condition C2 then operation C Testcase C1 C2 Testcase C1 C2 1 True True 2 False True White Box Testing: Code coverage Example False True C1 A B if condition C1 then operation A else operation B endif C2 Branch not covered if condition C2 then operation C True False C Test cases = 3 Testcase C1 C2 1 True True 2 False True C2 = False. (Condition not covered) White Box Testing: “Branch coverage” Example False True C1 A B if condition C1 then operation A else operation B endif C2 Branch covered if condition C2 then operation C True False C Test cases = 3 Testcase C1 C2 1 True True 2 False True 3 False False White Box Testing: “Branch coverage” Example True False C1 C1 A B C2 False C1 A B True C2 A B True C2 False C C C White Box Testing: “Path coverage” Example True C1 A B Test cases = 4 C2 False C Testcase C1 C2 1 True True 2 False True 3 False False 4 True False Missing Path covered. White Box Testing • Complexity The complexity or the number of factors involved depends upon the application being tested. • Whitebox testing does not necessarily show if the program does work along the functional requirement or not, but it does show what the developer wanted. • Here comes in the Blackbox testing. • It is based on Requirement specifications, also known as Behavioral Testing, is a software testing method in which the internal structure/ design/ implementation of the item being tested is not known to the tester.