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
The Best Pairs to Trade with Small Account | MarketBulls
How to Install SSL Certificate on Microsoft Azure
Katie Nickolaou Leaving
Skyward Sinton
Dte Outage Map Woodhaven
Craigslist In Fredericksburg
10000 Divided By 5
Self-guided tour (for students) – Teaching & Learning Support
MADRID BALANZA, MªJ., y VIZCAÍNO SÁNCHEZ, J., 2008, "Collares de época bizantina procedentes de la necrópolis oriental de Carthago Spartaria", Verdolay, nº10, p.173-196.
Derpixon Kemono
litter - tłumaczenie słowa – słownik angielsko-polski Ling.pl
Craigslist Chautauqua Ny
Es.cvs.com/Otchs/Devoted
Robert Malone é o inventor da vacina mRNA e está certo sobre vacinação de crianças #boato
U/Apprenhensive_You8924
Craigslist Farm And Garden Tallahassee Florida
Hellraiser III [1996] [R] - 5.8.6 | Parents' Guide & Review | Kids-In-Mind.com
Best Uf Sororities
Shasta County Most Wanted 2022
Pretend Newlyweds Nikubou Maranoshin
Leccion 4 Lesson Test
Sussur Bloom locations and uses in Baldur's Gate 3
Melendez Imports Menu
Form F-1 - Registration statement for certain foreign private issuers
Bellin Patient Portal
Kirsten Hatfield Crime Junkie
Pawn Shop Moline Il
Dr. Nicole Arcy Dvm Married To Husband
27 Modern Dining Room Ideas You'll Want to Try ASAP
Ticket To Paradise Showtimes Near Cinemark Mall Del Norte
Royalfh Obituaries Home
031515 828
Lawrence Ks Police Scanner
Vip Lounge Odu
Basil Martusevich
Pitco Foods San Leandro
Muma Eric Rice San Mateo
Shih Tzu dogs for sale in Ireland
Laff Tv Passport
Duff Tuff
Mckinley rugzak - Mode accessoires kopen? Ruime keuze
Indio Mall Eye Doctor
Keir Starmer looks to Italy on how to stop migrant boats
Nina Flowers
Cocaine Bear Showtimes Near Cinemark Hollywood Movies 20
Gonzalo Lira Net Worth
Bonecrusher Upgrade Rs3
Paradise leaked: An analysis of offshore data leaks
Compete My Workforce
David Turner Evangelist Net Worth
Access One Ummc
Comenity/Banter
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.