Tuesday, August 30, 2011

White Box Testing AND Black Box Testing

What is WHITE BOX TESTING

White box testing strategy deals with the internal logic and structure of the code. White box testing is also called as glass, structural, open box or clear box testing. The tests written based on the white box testing strategy incorporate coverage of the code written, branches, paths, statements and internal logic of the code etc.
In order to implement white box testing, the tester has to deal with the code and hence is needed to possess knowledge of coding and logic i.e. internal working of the code. White box test also needs the tester to look into the code and find out which unit/statement/chunk of the code is malfunctioning

Advantages of White box testing :

  • As the knowledge of internal coding structure is prerequisite, it becomes very easy to find out which type of input/data can help in testing the application effectively.
  • The other advantage of white box testing is that it helps in optimizing the code
  • It helps in removing the extra lines of code, which can bring in hidden defects.

Disadvantages of white box testing:

  • As knowledge of code and internal structure is a prerequisite, a skilled tester is needed to carry out this type of testing, which increases the cost.
  • It is nearly impossible to look into every bit of code to find out hidden errors, which may create problems, resulting in failure of the application.

What is Black Box Testing

Black Box Testing is testing without knowledge of the internal workings of the item being tested. For example, when 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.
It is because of this that black box testing can be considered testing with respect to the specifications, no other knowledge of the program is necessary. For this reason, the tester and the programmer can be independent of one another, avoiding programmer bias toward his own work. For this testing, test groups are often used, “Test groups are sometimes called professional idiots…people who are good at designing incorrect data.” 1 Also, do to the nature of black box testing, the test planning can begin as soon as the specifications are written. The opposite of this would be glass box testing, where test data are derived from direct examination of the code to be tested. For glass box testing, the test cases cannot be determined until the code has actually been written. Both of these testing techniques have advantages and disadvantages, but when combined, they help to ensure thorough testing of the product.
Synonyms for black-box include: behavioral, functional, opaque-box, and closed-box.

Advantages of Black Box Testing

  • more 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
  • 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

Disadvantages of Black Box Testing

  • only 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
  • may leave many program paths untested
  • cannot be directed toward specific segments of code which may be very complex (and therefore more error prone)
  • most testing related research has been directed toward glass box testing

Testing Strategies/Techniques

  • black box testing should make use of randomly generated inputs (only a test range should be specified by the tester), to eliminate any guess work by the tester as to the methods of the function
  • data outside of the specified input range should be tested to check the robustness of  the program
  • boundary cases should be tested (top and bottom of specified range) to make sure the highest and lowest allowable inputs produce proper output
  • the number zero should be tested when numerical data is to be input
  • stress testing should be performed (try to overload the program with inputs to see where it reaches its maximum capacity), especially with real time systems
  • crash testing should be performed to see what it takes to bring the system down
  • test monitoring tools should be used whenever possible to track which tests have already been performed and the outputs of these tests to avoid repetition and to aid in the software maintenance
  • other functional testing techniques include: transaction testing, syntax testing, domain testing, logic testing, and state testing.
  • finite state machine models can be used as a guide to design functional tests
  • According to Beizer 2 the following is a general order by which tests should be designed:
    1. Clean tests against requirements.
    2. Additional structural tests for branch coverage, as needed.
    3. Additional tests for data-flow coverage as needed.
    4. Domain tests not covered by the above.
    5. Special techniques as appropriate–syntax, loop, state, etc.
    6. Any dirty tests not covered by the above.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

 
Powered by Blogger