Black box & white-box testing technique

Click here to load reader

download Black box & white-box testing technique

of 41

  • date post

    25-Dec-2014
  • Category

    Education

  • view

    649
  • download

    11

Embed Size (px)

description

 

Transcript of Black box & white-box testing technique

  • White Box & Black Box Testing TechniquesManish Roopa S

    Testing Competency

  • What does Test mean The word TEST is derived from the Latin word Testum meaning a pottery vessel used to measure or assess

    Testing Competency

  • Software Testing Testing of software means assessing or Measuring the software to determine its QUALITY

    Area of testing is one of the key process areas of project life cycle in ensuring the QUALITY of the software

    Testing Competency

  • QUALITY

    What is Quality product ?

    A quality product is one which is fit for use.

    A quality product is one which is produced as per pre-defined specifications.

    Testing Competency

  • Various Testing Techniques

    Structural & FunctionalVerification & Validation (V&V)Static & DynamicWhite-Box & Black-Box

    Testing Competency

  • Levels of Testing

    Testing Competency

  • Test Design Methods

    Black-Box and White-Box are Test Design Methods

    Testing Competency

  • Black-Box TestingBlack Box Testing is testing technique having no knowledge of the internal functionality/structure of the systemSynonyms for Black-Box are Behavioral, Functional, Opaque-Box, Closed-Box etc.

    Testing Competency

  • contdBlack-box Testing focuses on testing the function of the program or application against its specificationDetermines whether combinations of inputs and operations produce expected resultsWhen black box testing is applied to software engineering, the tester would only know the "legal" inputs and what the expected outputs should be, but not how the program actually arrives at those outputs

    Testing Competency

  • Focus of Black-Box Testing In this technique, we do not use the code to determine a test suite; rather, knowing the problem that we're trying to solve, we come up with four types of test data: Easy-to-compute data Typical data Boundary / extreme data Bogus data

    Testing Competency

  • Black-Box Testing Techniques

    Equivalence PartitioningBoundary Value AnalysisError GuessingCause-Effect Graphing

    Testing Competency

  • Equivalence Partitioning

    An equivalence class is a subset of data that is representative of a larger classEquivalence partitioning is a technique for testing equivalence classes rather than undertaking exhaustive testing of each value of the larger class

    Testing Competency

  • Example - EPFor example, a program which edits credit limits within a given range ($10,000 - $15,000) would have three equivalence classes< $10,000 (invalid)Between $10,000 and $15,000 (valid)> $15,000 (invalid)

    Testing Competency

  • Boundary Analysis

    This technique consists of developing test cases and data that focus on the input and output boundaries of a given function

    Testing Competency

  • Example Boundary AnalysisIn the same credit limit example, boundary analysis would test.

    Low boundary -/+ one ($9,999 and $10,001)On the boundary ($10,000 and $15,000)Upper boundary -/+ one ($14,999 and $15,001)

    Testing Competency

  • Error GuessingTest cases can be developed based upon the intuition and experience of the tester

    For example, where one of the inputs is the date, a tester may try February 29, 2001

    Testing Competency

  • Cause-Effect GraphingCause-effect graphing is a technique for developing test cases for programs from the high-level specifications (A high-level specification states desired characteristics of the system)These characteristics can be used to derive test data

    Testing Competency

  • Example Cause EffectFor example, a program that has specified responses to eight characteristic stimuli (called causes) given some input has 256 "types" of input (i.e., those with characteristics 1 & 3; 5, 7 & 8 etc.)A poor approach is to generate 256 test casesA more methodical approach is to use the program specifications to analyze the program's effect on the various types of inputs

    Testing Competency

  • contdThe program's output domain can be partitioned into various classes called effectsFor example, inputs with characteristic 2 might be subsumed by those with characteristics 3 & 4. Hence, it would not be necessary to test inputs with characteristic 2 and characteristics 3 & 4, for they cause the same effectThis analysis results in a partitioning of the causes according to their corresponding effects

    Testing Competency

  • contdA limited entry decision table is then constructed from the directed graph reflecting these dependencies (i.e., causes 2 & 3 result in effect 4; causes 2, 3 & 5 result in effect 6 etc.)The decision table is then reduced and test cases chosen to exercise each column of the tableSince many aspects of the cause-effect graphing can be automated, it is an attractive tool for aiding in the generation of Functional Test cases

    Testing Competency

  • Advantages of Black-Box TestingMore effective on larger units of code than glass box testing

    Tester needs no knowledge of implementation, including specific programming languages

    Tester and programmer are independent of each other

    Testing Competency

  • Advantages of Black-Box Testing Contd

    Tests are done from a user's point of view Will help to expose any ambiguities or inconsistencies in the specifications

    Test cases can be designed as soon as the specifications are complete

    Testing Competency

  • Disadvantages of Black-Box TestingOnly a small number of possible inputs can actually be tested, to test every possible input stream would take nearly forever

    Without clear and concise specifications, test cases are hard to design

    There may be unnecessary repetition of test inputs if the tester is not informed of test cases the programmer has already tried

    Testing Competency

  • Disadvantages of Black-Box Testing ContdMay leave many program paths untested

    Cannot be directed toward specific segments of code which may be very complex (and therefore more error prone)

    Testing Competency

  • White-Box Testing

    White-box test design allows one to peek inside the "box

    Synonyms for White-box are Structural, Glass-box and Clear-box

    Testing Competency

  • contWhite-box Testing assumes that the path of logic in a unit or program is knownWhite-box Testing consists of testing paths, branch by branch, to produce predictable resultsFocuses specifically on using internal knowledge of the software to guide the selection of test data

    Testing Competency

  • White-Box Testing TechniquesStatement Coverageexecute all statements at least onceDecision Coverageexecute each decision direction at least onceCondition Coverageexecute each decision with all possible outcomes at least once

    Testing Competency

  • contDecision/Condition Coverageexecute all possible combinations of condition outcomes in each decisionMultiple Condition Coverageinvoke each point of entry at least onceChoose the combinations of techniques appropriate for the application

    Testing Competency

  • Statement CoverageNecessary but not sufficient, doesnt address all outcomes of decisionsFor example.Begin()If (function1())OpenFile1()ElseShutdown();Here if the first IF statement is true then Shutdown will never occur

    Testing Competency

  • Decision CoverageValidates the Branch Statements in softwareOvercomes the drawbacks of statement coverageEach decision is tested for a True & False valueEach branch direction must be traversed at least onceBranches like ifelse, while, for do...while are to be evaluated for both true and falseTest cases will be arrived with the help of a Decision table

    Testing Competency

  • ContDecision Table

    Table which helps to derive the test cases

    Steps

    Identify the variables which are responsible for decisionIdentify the total number of decisions (Give numbers to them like IF1, IF2 While1, While2 etc)Put the variables as rows and decisions as verticalsStart to map the values for each variables corresponding to each decisions

    Testing Competency

  • An Example

    Procedure liability (age, sex, married, premium); beginpremium=500;If ((age45) and (age

  • Decision Table

    Testing Competency

  • Condition CoverageValidates logical relations and conditionsAll the conditions should be executed at least once for the both false and trueConditions using relational and logical operators should be checked for all possible outcomesCondition coverage checks for true and false outcome of each Boolean sub expressionTest cases will be arrived from using same Decision table by putting conditions in place of decisions

    Testing Competency

  • Test conditions

    Testing Competency

  • Condition/Decision CoverageWe may not always get result either in decision coverage or condition coverage. In such cases, go in for decision & condition coverageTest cases will be arrived form both decision as well as condition coverage

    Testing Competency

  • Condition/Decision Test case

    Testing Competency

  • Multiple Condition CoverageChecks whether every possible combination of Boolean sub expression occurs at least once (2n), where n is the number of variables in a given branchTest cases required for this method can be arrived at by using truth table of the conditionsLarge number of test cases may be required for full multiple condition coverage

    Testing Competency

  • Multiple Conditions Coverage Test cases

    Testing Competency

  • Gray-Box