ISTQB - White Box Testing Techniques in Software Testing - Get Software Service (2024)

  • By Sita Sreeraman
  • ISTQB, Software Testing (QA)

Structure Based or White Box techniques

White-box test design techniques (also called structural or structure-based techniques) are used to derive test cases from an analysis of the program(code). This article is devoted to understanding how to derive test cases from a program and also derive coverage metrics for tests undertake.

Deriving test case after analysis or understanding programs is white box testing. (In contrast to black box testing where test cases are designed from specification).

Test cases involve assigning values to the variables and measuring what lines of code get executed. In the exam, questions will be asked on how many test cases will be needed to ensure every line of code/decisions are executed or given some values, what % of lines/decisions are executed.

Test cases from code are similar to black box test cases but think test data here – like what values you will provide to run through the code. The emphasis here is what lines will be executed with the data you provide. And the minimum number of test cases to achieve this.

During Black Box testing, depending on the tester’s experience, after a full round of System testing, the lines of code covered varies between 30% and 70%. So that leaves a lot of lines of code untested. Coverage metrics help understand what lines are not covered and help us design test cases to increase the coverage. There are certain tools available to measure the lines of code covered when tests are run.

The techniques to derive test cases:(ISTQB Foundation syllabus)

  • Statements testing /coverage
  • Decision Testing/coverage

Others includeCondition coverage, Modified Decision coverage, Branch Condition Combination Coverage & LCSAJ, Path coverage etc which are beyond the cope of this article.

Statement coverage:If the test case executes every line of code in the program, it is called 100% statement coverage.

Decision coverage: Ifthetest cases execute both the decisions, it is called 100% decision coverage.

Statement Coverage = Number of executable statements executed x 100 Total number of executable statements
Decision Coverage = Number of decisions exercised x 100 Total number of decisions

Coding Structures:

A program code can be sequential where statements execute one after another. Execution of code can also be based on a condition being true or false.

Sequential or Linear statements:

Example of a sequential code, where the program is executed line after line.

1 READ A2 READ B3 Sum = A+ B

Test cases for Sequential statements are simple,assign values to A & B.

For eg, test case /data : A=1, B=2, will run through statements 1,2,3 or all the lines of this program. In this case, one test case is needed for 100% Statement coverage.

Selection or Decisions:

In this case the computer has to decide if a condition is true or false. If it is true the computer takes one route, and if it is false the computer takes a different route.

IF (condition is true) Do thisELSE (condition is False) Do something elseEND IF

Eg:

1 IF Age > 162 Process License application3 ELSE4 Decline the License application process5 END IF

Test cases:Age =18 testslines 1,2,5 and Age =14 testslines 1,3,4,5.

So, 2 test cases are needed to execute every line of code. And 2 test cases to execute the True and False conditions. So 2 test cases are needed for 100% Statement and Decision coverage.

There may not always be an ELSE part, as below:

 1 IF Age >16 2 THEN 3 "Process License Application" 4ENDIF

Test cases for the above, assigning Age =18 testslines 1,2,3,4, so only one test case is needed to execute every line of code.

But 2 test cases are needed to test the decisions: 1 to execute the True (Age > 16) and False(Age < 16). Why?

Because for Age<16,we need to ensure the program does not do anything, it needs to go to the ENDIF.Hence Decision coverage is stronger than Statement coverage.

100% Decision coverage ensures 100% Statement coverage. The vice versa is not true.

Consider the following:

1 IF (Age > 16) and (Gender = Female)2 Process License application3 ELSE4 Decline the License application process5 END IF
1 IF (Age > 16) or (Gender = Female)2 Process License application3 ELSE4 Decline the License application process5 END IF

Assign(Age =18 and Gender=Female) to test lines 1,2,5 and (Age=14,Gender = Male)to test lines 1,3,4,5. So, 2 test cases are needed to execute every line of code(100% Statement coverage).And 2 test cases to test both thedecisions – true and false (100% Decision Coverage).

In the above examples, we see why Decision coverage is inadequate, all conditions are not fully tested:

Age >16 & Female, Age > 16 & Male, Age <16 and Female and Age <16 & Male will cover all the combinations.Hence the need for other stronger metrics.

Nested Ifs or multiple IFs within an IF:

1 IF ( Age > 17)2 IF Age <503 Print Age is between 17 and 504 ELSE IF ( Age > 50)5 Print Age is greater than 506 END IF7 ELSE8 Print Age is less than 17.9 END IF

Test cases for the above, assigning Age =16, Age =51 and Age =29 (3 test cases) will test every line/statement and every decision..

CASE Structure:

The nested If can also be expressed as a CASE structure.

Case Age > 50:Report “Age is greater than 50”Case Grade > 17:Report “Age is between 17 and 50”Default:Report “Age is less than 17”End Case

Again, assigning Age =16, Age =51 and Age =29 (3 test cases) will test every line and every decision..

Iterations or loops:

When an action needs to repeated until the Condition becomes False, loops are used. There are 2 types of loops,While -Do and Repeat Until

DO WHILE condition sequenceENDWHILE

The loop is entered only if the condition is true. The “sequence” is performed for each iteration. At the conclusion of each iteration, the condition is evaluated and the loop continues as long as the condition is true.

Eg:

WHILE ( Shopping Trolley not empty)DO Add Cost of Item to Total. Print the item name and item costEND DOPrint TotalCost

Test cases for Do-While – the loop is entered if the condition is true, so one test case that has a true value is enough to test all the lines of code and the decision.

There is another variation of the loop structure known as a REPEAT UNTIL loop.

This loop is similar to the WHILE loop except that the test is performed at the bottom of the loop instead of at the top. Two keywords, REPEAT and UNTIL are used. The general form is:

REPEAT sequenceUNTIL condition

Again, only one test case is sufficient to test all lines of code for both Statement and Decision Coverage.

ISTQB - White Box Testing Techniques in Software Testing - Get Software Service (2024)
Top Articles
Overview of the food and beverage processing industry
How to go viral on TikTok overnight in 2024
Caesars Rewards Loyalty Program Review [Previously Total Rewards]
Yogabella Babysitter
What is international trade and explain its types?
Www.paystubportal.com/7-11 Login
Hmr Properties
How Much Is Tj Maxx Starting Pay
Meritas Health Patient Portal
Tracking Your Shipments with Maher Terminal
2016 Ford Fusion Belt Diagram
Katherine Croan Ewald
Classic | Cyclone RakeAmerica's #1 Lawn and Leaf Vacuum
Craigslist Southern Oregon Coast
Www Craigslist Com Bakersfield
How many days until 12 December - Calendarr
Cain Toyota Vehicles
Walgreens Bunce Rd
City Of Durham Recycling Schedule
Kimoriiii Fansly
Publix Near 12401 International Drive
Wonder Film Wiki
Skidware Project Mugetsu
Rural King Credit Card Minimum Credit Score
1964 Impala For Sale Craigslist
Rays Salary Cap
Isablove
Lawrence Ks Police Scanner
Vitals, jeden Tag besser | Vitals Nahrungsergänzungsmittel
Compress PDF - quick, online, free
No Hard Feelings Showtimes Near Tilton Square Theatre
Despacito Justin Bieber Lyrics
Ny Post Front Page Cover Today
Space Marine 2 Error Code 4: Connection Lost [Solved]
Finland’s Satanic Warmaster’s Werwolf Discusses His Projects
Bernie Platt, former Cherry Hill mayor and funeral home magnate, has died at 90
Cheetah Pitbull For Sale
Noaa Marine Weather Forecast By Zone
Appraisalport Com Dashboard Orders
Tsbarbiespanishxxl
Gasoline Prices At Sam's Club
Lucyave Boutique Reviews
Yourcuteelena
Pixel Gun 3D Unblocked Games
Lyons Hr Prism Login
How to Connect Jabra Earbuds to an iPhone | Decortweaks
Wzzm Weather Forecast
6463896344
How to Get a Check Stub From Money Network
Craigslist Monterrey Ca
Cataz.net Android Movies Apk
Latest Posts
Article information

Author: Nathanial Hackett

Last Updated:

Views: 6032

Rating: 4.1 / 5 (72 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Nathanial Hackett

Birthday: 1997-10-09

Address: Apt. 935 264 Abshire Canyon, South Nerissachester, NM 01800

Phone: +9752624861224

Job: Forward Technology Assistant

Hobby: Listening to music, Shopping, Vacation, Baton twirling, Flower arranging, Blacksmithing, Do it yourself

Introduction: My name is Nathanial Hackett, I am a lovely, curious, smiling, lively, thoughtful, courageous, lively person who loves writing and wants to share my knowledge and understanding with you.