Sunteți pe pagina 1din 8

Project Report

on

White Box Testing


in

Computer Science & Engineering Sub code: CO-3 !


Submitted b": Abhishek Agrawal, 10CO04 Submitted to: Dr. Annappa Department of Computer science and Engineering

#ep$rtment o% Computer Science & Engineering &$tion$' (nstitute o% Techno'og" )$rn$t$*$+ Sur$th*$' Srini,$sn$g$r+ (ndi$ - . /0 1e$r: 0/!2

Contents
Contents.......................................................................................................................... !hite "o# $esting.......................................................................................................... %cCabes C&clomatic Comple#it& %etrics....................................................................'

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 have 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 loo ing at white box testing in more detail it involves chec ing 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 loo s directly to the software code itself. This test wor s 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 pac age which examines all of the reused software that had been implemented into the software pac age. "ddition to this function it also adapts to the program allowing the present code to be re.usable for future preferences. When loo ing 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 ta e 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 Co erage / this is to test and cover over all of the program code and the coverage is calculated by the percentage of lines covered. Path Co erage / 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 co erage


&ath testing0s main goal is to go through the system covering all possible paths, this is tested with all condition such as 12.T345.46#4 and %7 W3164 statements. To ta e 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 loo ing at white box complete path coverage will show how extreme this type of testing is$ Example: There is a software pac age that contains five conditional statements which will only for this example allow two procedures eg 12.T345.46#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. <ust by loo ing at this on example gives a good representation of the type of testing performed. 1n addition to this we can see that by having 8; modules a calculation can be made which will result in proximally =9,;;; test cases needed in order to carry out this procedure. This is very disproportionate testing however can be very beneficial as this type of testing should outline a great proportion of errors and defects within the software system. This complete path coverage will be tested on systems such as hospital related machines, emergency services system and mostly to do with high ris software systems. This will substitute the price of costing for the price of the ris of this system failing, therefore allowing for this long procedure to be carried out.

Correctness Tests and Line Co erage

The line coverage requires a different process to path coverage as explained above. There are different types of line coverage depending on the users requirements and specification of the software system. 7ne function will be to run a full complete line coverage process which will consist of each line of code being compiled and executed at least once. This will be shown as a percentage of the lines compiled during the testing process. 6ine coverage may also perform a less efficient method test which consists of testing fewer test cases which will ma e the system more vulnerable to bugs and system errors. When tal ing about correctness tests, flow chart and a flow graph can be used to enforce the understanding of line coverage within the correctness tests. " diamond will represent$ the options covered by a conditional statement " rectangle will represent$ software sections connecting the diamonds. The arrows - edges will represent$ The flow of direction. " 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 than >9;,;;; or greater then, 1s the year of the car older than 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.
9 'ar 1nsurance

3ess than 410,000 Car price


7lder than 8 @ears

5reater than 410,000

4 3ess $han ' +ears

/ +ounger than ' ) 3ess than 1 +ear

' +ear of Car * Older than or 6 ' , -ow old are &ou. %ore than 1 &ear 140 1 2 no claims bonus
10

4 7one 11 +ears E#perien 1' ce

9? 'alculate 'ar 1 1nsurance

1(

%ore than &ears ncb


1/

2rom this diagram is possible to come out with another of different unique paths. 7verall to achieve complete path coverage an estimated :A test cases would have to be performed due to their being :A individual unique paths. 4xamples of unique paths have been displayed below. 'omplete 2ull &ath 'overage 9 B 9.:.C.8.=.D.E.99.9:.9? : B 9.:.C.8.=.D.E.9C.9A.98.9? C B 9.:.C.8.=.D.E.99.9C.9A.9= A B 9.:.C.8.=.D.9;.99.9? F 9C B 9.:.A.8.=.D.E.99.9:.9? 9A B 9.:.A.8.=.D.E.9C.9A.98.9? F :C B 9.:.A.8.?.D.9;.99.9C.9A.98.9? :A B 9.:.A.8.?.D.9;.99.9C.9A.9=.9?

By loo ing 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.

McCabes Cyclo!atic Co!"lexity 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, and this was done by measuring the number of independent paths needed to achieve full line coverage. This strategy would be based on ta ing the characteristics of the flow diagram and placing this information into the formula. "n example of this is shown below$ )c'abes formulae$ G+H, B * G +H, B 4 /5 I : G+H, B & I 9

'

* B The number of regions that is involved in the program flow graph. +"ny enclosed area including the outer layer of the flow diagram., 4 B The number of edges 5 B The number of nodes & B The number of decisions 1 have now ta en )c'abes theory and have applied it to our 'ar 1nsurance #cenario$

Applying 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 G+H, B = G+H, B :9 .9? I : B = G+H, B 8 I 9 B =

*esulting metrics calculations indicate that the maximum number of independent paths needed to achieve full line coverage is =. To summarise )ccabes ob!ective is that programs with cyclomatic complexities of less then 8 are simple and easy to understand, :;I 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.

Software Qualification Testing


#oftware qualification is !ust as important as maintenance testing, its main ob!ective is to chec whether the software being developed is to its correct structure and meets the appropriate standards. This type of testing chec s whether the coding and documentation has been carried out to the correct procedures and wor ing instructions. By enforcing this type of tests it gives the organisation a much more efficient and well structured piece of software. 7ne of the main procedures is to chec and validate whether the software has responded to procedures such as$ %oes the coding style comply with the correct style procedures, %oes the coding comply with coding structures 1s the %ocumentation to the correct standard. Today it is possible to buy different applications and software pac ages that allow a company or organisation to manage coding standards. This type of code auditors enables the user to ta e full control of the code and give an automatic review on the current pro!ect or development. The main coding auditor that is used in many organisations and programming pro!ects is ##W 'ode "uditor.

Re#usability Testing
When loo ing at this method we first have to loo at what is re.usabilityJ This can be defined as a section of code that can be re.used to add new functionalities with very little or no modification. 5ot only is this time consuming, it is expected that this type of code has been through a number of testing procedure, eliminating any errors or bugs. This clean section of code can then be simply integrated into a new wor ing pro!ect with the nowledge that this code is successfully wor ing and follows all the correct standards and wor ing instructions. #o when loo ing at re.usable code, the re.usability testing ob!ective is to chec and determines whether this section of code is efficient and bug free. This type of testing also involves the documentation side, as user manuals and help wiKards have a great number of similarities.

$d antages of White Box 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 Hraphical 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.

Disad antages of White Box Testing


" s illed and trained tester will be needed to perform this type of testing. This type of testing requires a certain level of s ill, 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.

8eferences9 !hite:bo# testing http9;;en.wikipedia.org;wiki;!hite:bo#<testing : last modified on ' 7o=ember 00) !hite:"o# $esting report http9;;agile.csc.ncsu.edu;>E%aterials;!hite"o#.pdf : last modified on ?anuar& 14 00/ !hite "o# $esting https9;;buildsecurit&in.us:cert.go=;dais&;bsi;articles;best:practices;white:bo#; '): ">@.html : last updated 00):0*: * >oftware $esting : !hite "o# $esting >trateg& http9;;www.buAAle.com;editorials;4:10: 00':/,('0.asp : last updated 17 Nov 2009
07:51:54 GMT

5alin, D. B 0040, Software Quality Assurance From theory to implementation, Cearson Addison !esle&.

S-ar putea să vă placă și