White Box Testing Project
December 3, 2022 | Author: Anonymous | Category: N/A
Short Description
Download White Box Testing Project...
Description
Develop test cases for white box testing
White box testing uses the internal mechanism of a system to create test cases, which uses calculated paths to discover unidentified bugs within the system. This type of testing is trying to enforce the quality of the software system however “white box testing” is a cost effective method and is compared very closely to “Blac box testing”. The main !obs of these two functions have the same purpose however it is ma!orly debated which one is more efficient and effective. Blac box testing concentrates mainly on the outputs of the system to identify bugs however this function waits till a malfunctioning error has occurred. "s explained above White box testing is used to ensure that the code is complete and to the correct standard of the software mechanism. #tatistics haves proven that by using a complete and precise systematic test design, will ensure that the ma!ority of bugs within the system will be identified. When looing at white box testing in more detail it involves checing and ensuring that every program statement is error free. White box testing allows$ %ata &rocessing 'alculation correctness tests #oftware (ualification tests )aintainability tests
*eusability tests
Data Processing and Calculation Correctness tests Within the main two concepts of 'alculation 'orrectness tests and %ata processing, when a test case has been created +path it is then proceeded to be tested and verified which will ensure the correctness of the software program. This procedure is done in sequence for every test case created, this gives the user the opportunity to test whether the code - program has been implemented correctly to the requirements specification. Software Qualification tests When going through the software qualification tests it loos directly to the software code itself. This tests wors with the “coding standards” and wor instructions set by
the client or developer. Maintainability tests The maintainability tests installs special features to detect failures, module structures that support software development, extensions and improvements of the software system. The reusability tests is part of an example of this, as explained below$ Reusability tests *eusability tests are performed on the pacage which examines all of the reused software that had been implemented into the software pacage. "ddition to this function it also adapts to the program allowing the present code to be reusable for future preferences.
When looing at the White box testing in more detail and analysing its procedures it becomes aware that when testing each test case - path maybe become unrealistic and unfeasible. We have to tae into account on the amount of coverage of all the possible
paths and the amount of code that is produced. There are two possible solutions for this situation$
Line Coverage / this is to test and cover over all of the program code and the coverage is calculated by the percentage of lines covered. Path Coverage / this is to test and cover all the available paths in the system and the coverage is calculated by the percentage of paths covered. Correctness tests and Path coverage &ath testing0s main goal is to go through the system covering all possible paths, this is tested with all condition such as 12T34546#4 and %7 W3164 statements. To tae white box into account it is very impractical due to the amount of resources needed for this type of testing. &ath testing is used from the start of a method to when it finishes, each path shows the flow of execution. By looing at white box complete path coverage will show how extreme this type of testing is$ Example: There is a software pacage that contains five conditional statements which will only for this example allow two procedures eg 12T34546#4, %7 W3164. When following this type of code, it is expected that it will contain over 89: paths +:8 / 8; lines of code, therefore at least 89: test cases should be performed ensuring each path has been covered. raph 5otation
!
" flow diagram to show how car insurance can be calculated based on the users circumstances. This diagram involves$ " 'ar 1nsurance 'ompany and calculating the users annual car insurance will involve$ 1f the users car is less then ?9;,;;; or greater then, 1s the year of the car older then 8 years, 3ow old is the user, %oes the user have any previous driving experience, %oes the user have more then two years no claims bonus.
1 Car Insurance
>reater then ?9;,;;;
6ess then ?9;,;;; : 'ar price
@
C
Older then 5 Years
6ess Then 8 Dears 8 Dear of 'ar
=
Dounger then :8
7lder then or I :8 E 3ow old are youF
A
6ess then 9 Dear
9:
9;
)ore then 9 year 99 Dears 4xperien ce
9@
@
5one 17 Calculate Car Insurance
9C G:H no claims bonus
98
@
)ore then : years ncb 9=
@
2rom this diagram is possible to come out with another of different unique paths. 7verall to achieve complete path coverage an estimated :C test cases would have to be performed due to their being :C individual individual unique paths. 4xamples of unique paths have been displayed below.
'omplete 2ull &ath 'overage 9 I 9:@8=EA999:9 9:@8=EA999:9 : I 9:@8=EA9@9C989 @ I 9:@8=EA999@9C9= 9:@8=EA999@9C9= C I 9:@8=E9;999 9:@8=E9;999 J 9@ I 9:C8=EA999:9 9:C8=EA999:9 9C I 9:C8=EA9@9C989 J :@ I 9:C8E9;999@9C989 9:C8E9;999@9C989 :C I 9:C8E9;999@9C9=9 9:C8E9;999@9C9=9
By looing at this scenario, if the entities and modules increased the amount of testing to be performed on this would grow rapidly. The increase in modules would then lead to a more complex system. " scientist called )c'abe then come up with a theory to determine how complex a software system was and how easy it was to interoperate this type of software system. !
ndependent Pr Progra" Pa Paths
McCabes Cyclomatic Complexity Metrics "s explained above )c'abes theory was to find out how complex a system was and how much testing would be sufficient in order to complete white box testing. )c'abe came up with a formula to distinguish the complexity c omplexity,, and this was done by measuring the number of independent paths needed to achieve full line coverage. This strategy would be based on taing the characteristics of the flow diagram and placing this information into the formula. "n example of this is sshown hown below$ )c'abes formulae$ K+> I * K +> I 4 /5 H : K+> I & H 9 * I The number of regions that is involved in the program flow graph. +"ny enclosed area including the outer layer of the flow diagram. 4 I The number of edges 5 I The number of nodes nodes & I The number of decisions 1 have now taen )c'abes theory and have applied it to our 'ar 1nsurance #cenario$
Applying McCabes McCabes theories.
*ed 'ircles indicate the regions within our car insurance example The amount of arrows subtracted by the number of nodes The diamond shapes are represented as & as they are decision entities.
7ur 4xample K+> I = K+> I :9 9 H : I = K+> I 8 H 9 I =
*esulting metrics calculations indicate that the maximum number of independent paths needed to achieve full line coverage is =. To To summarise summarise )ccabes ob!ective is that programs with cyclomatic complexities of less then 8 are simple and easy to understand, :;H independent paths needed results in the complexity is perceived as high and extreme testing would have to be performed. "lso any program containing 8; and above the software for practical purposes becomes nown unpractical maybe even impossible. ! ! #!
Prep Prepar aree test test case casess that that will will forc forcee execu executio tion n of each each path path in the the basis basis set! Condition Testing
Condition testing is is a testcase design method that exercises the logical conditions contai con tained ned in a progra program m modul module. e. " simple simple condit condition ion is a Boolean Boolean variable variable or a relational relatio nal expression, expression, possibly preceded with one 57T +L operator. operator. " relational relational expression taes the form E 9 MrelationaloperatorG E MrelationaloperatorG E : where E where E 9 and and E : are arithmetic expressions and MrelationaloperatorG is one of the following$ M,G,N, O+nonequality, I, or P. " compound condition is composed of two or more more simple simple condit condition ions, s, Boolea Boolean n operato operators, rs, and parent parenthes heses. es. We assume assume that that
Boolean operators allowed in a compound condition include 7* , "5% +Q, and 57T +L. " condition without relational expressions is referred to as a Boolean expression. 1f a condition is incorrect, then at least one component of the condition is incorrect. Ther Th eref efor ore, e, type typess of er erro rors rs in a co cond ndit itio ion n in incl clud udee Bool Boolea ean n op oper erat ator or er erro rors rs incorr inc orrectect-mis missin sing-e g-extra xtra Boolean Boolean operato operators, rs, Boolean Boolean variab variable le errors, errors, Boolea Boolean n parenthesis errors, relational operator errors, and arithmetic expression errors. The condition condi tion testing method focuses on testing testing each condition condition in the program program to ensure that it does not contain errors
$dvantages of %hite &ox Testing 1ntrospection / this gives the user or tester the opportunity to test internally which allows a better perspective of ob!ects and modules within the software. This is effective when the >raphical user 1nterface is changing frequently. 1dentification / By going through each line the test is able to reveal what test cases have been applied to what ob!ect and lists the number of lines that have not yet been executed. 4ffectiveness / This type of testing gives the end user or the supplier the confidence that every path has been tested to a certain extent, which should limit the amount of bugs within an application. White box testing is the most effective testing as it the most thorough when testing an individual application. Disadvantages of %hite &ox Testing " silled and trained tester will be needed to perform this type of testing. This type of testing requires a certain level of sill, ensuring that every path and test case has been examined at least once. This type of testing is time consuming and may be very cost effective. "lso it has been said that it is nearly impossible to loo into every bit of code within the infrastructure to find all possible errors.
View more...
Comments