10 testing

100
Testing 1 Software Testing

Upload: gaurav-singh-rana

Post on 19-Aug-2015

219 views

Category:

Documents


2 download

DESCRIPTION

software testing

TRANSCRIPT

Testing 1Software TestingTesting 2BackgroundMain objectives of a project: High Quality High !roductivity "Q!#Quality has $any di$ensionsreliability% $aintainability% interoperability etc&'eliability is perhaps the $ost i$portant'eliability: The chances of software failingMore defects () $ore chances of failure () lesser reliabilityHence Q goal: Have as few defects as possible in the delivered softwareTesting 3*aults*ailure*ailure: + software failure occurs if the behavior of the s,w is di-erent fro$ e.pected,speci/ed&*ault: cause of software failure*ault ( bug ( defect*ailure i$plies presence of defects+ defect has the potential to cause failure&0e/nition of a defect is environ$ent% project speci/cTesting 4'ole of Testing'eviews are hu$an processes 1 can not catch all defectsHence there will be re2uire$ent defects% design defects and coding defects in codeThese defects have to be identi/ed by testingTherefore testing plays a critical role in ensuring 2uality&+ll defects re$aining fro$ before as well as new ones introduced have to be identi/ed by testing&Testing 50etecting defects in Testing0uring testing%a progra$ is e.ecuted with a set of test cases*ailure during testing () defects are present3o failure () con/dence grows% but can not say 4defects are absent50efects detected through failuresTo detect defects% $ust cause failures during testingTesting 6Test 6racleTo check if a failure has occurred when e.ecuted with a test case% we need to know the correct behavior7&e& need a test oracle% which is often a hu$anHu$an oracle $akes each test case e.pensive as so$eone has to check the correctness of its outputTesting 7'ole of Test cases7deally would like the following for test cases3o failure i$plies 4no defects5 or 4high 2uality57f defects present% then so$e test case causes a failure!sychology of testing is i$portantshould be to 8reveal9 defects"not to show that it works:#test cases $ust be 4destructive'ole oftest cases is clearly very critical6nly if test cases are 4good5% the con/dence increases after testingTesting 8Test case design0uring test planning% have to design a set of test cases that will detect defects presentSo$e criteria needed to guide test case selectionTwo approaches to design test casesfunctional or black bo.structural or white bo.Both are co$pli$entary; we discuss a few approaches,criteria for bothTesting 9Black Bo. testingSoftware tested to be treated as a block bo.Speci/cation for the black bo. is givenThe e.pected behavior of the syste$ is used to design test casesi&e test cases are deter$ined solely fro$ speci/cation&7nternal structure of code not used for test case designTesting 10Black bo. Testing

input ) $a. is an invalid classBhenever that entire range $ay not be treated unifor$ly 1 split into classesTesting 15=2uivalent class partitioning&&Should consider e2& classes in outputs also and then give test cases for di-erent classes=&g&: >o$pute rate of interest given loan a$ount% $onthly install$ent% and nu$ber of $onths=2uivalent classes in output: C rate%rate ( @ %1ve rateHave test cases to get these outputsTesting 16=2uivalence classonsider a progra$ that takes D inputs E a string s and an integer n!rogra$ deter$ines n $ost fre2uent charactersTester believes that progra$$er $ay deal with di- types of chars separately+ set of valid and invalid e2uivalence classes is givenTesting 18=.a$ple&&7nput Falid =2 >lass 7nvalid =2 classS 1: >ontains nu$bersD: Gower case lettersH: upper case lettersI: special charsJ: str len between @13"$a.#1: non1ascii charD: str len ) 33 K: 7nt in valid range H: 7nt out of rangeTesting 19=.a$pleause e-ect graphing helps in selecting co$binations asinput conditionsTesting 25>=1graphing7dentify causes and e-ects in the syste$>ause: distinct input condition which can be true or false=-ect: distinct output condition "T,*#7dentify which causes can produce which e-ects; can co$bine causes>auses,e-ects are nodes in the graph and arcs are drawn to capture dependency; and,or are allowedTesting 26>=1graphing*ro$ the >= graph% can $ake a decision tableGists co$bination of conditions that set di-erent e-ectsTogether they check for various e-ects0ecision table can be used for for$ing the test casesTesting 27>= graphing: =.a$ple+ bank database which allows two co$$ands>redit accM a$t0ebit accM a$t'e2uire$ents7f credit and accM valid% then credit7f debit and accM valid and a$t less than balance% then debit7nvalid co$$and 1 $essageTesting 28=.a$pleauses>1: co$$and is credit>D: co$$and is debit>H: accM is valid>I: a$t is valid=-ects!rint 47nvalid co$$and5!rint 47nvalid acctM5!rint 40ebit a$t not valid50ebit account>redit accountTesting [email protected].>H. @1 11>I. .@ 1 1=1 1=D 1=H 1=I 1=J 1Testing 31!air1wise testing6ften $any par$eters deter$ine the behavior of a software syste$The para$eters $ay be inputs or settings% and take di- values "or di- value ranges#Many defects involve one condition "single1$ode fault#% eg& sw not being able to print on so$e type of printerSingle $ode faults can be detected by testing for di-erent values of di- par$s7f n par$s and each can take $ values% we can test for one di- value for each par$ in each test caseTotal test cases: $Testing 32!air1wise testing1use: co$putational use of a var!1use: var used in a predicate for control transferTesting 590ata Sow basedo$puter ti$e also is an indicator of how testing is proceedingTesting 850efect logging and tracking+ large software $ay have thousands of defects% found by $any di-erent people6ften person who /.es "usually the coder# is di-erent fro$ who /nds0ue to large scope% reporting and /.ing of defects cannot be done infor$ally0efects found are usually logged in a defect tracking syste$ and then tracked to closure0efect logging and tracking is one of the best practices in industryTesting 860efect logging activity ( V of present defects detected by that Q> activityHigh 0'= of a 2uality control activity $eans $ost defects present at the ti$e will be re$ovedTesting 940efect re$oval ePciency activity can be co$putedTesting 950efect 'e$oval =Pciency