Path Coverage Testing

Why Trust Techopedia

What Does Path Coverage Testing Mean?

Path coverage testing is a specific kind of methodical, sequential testing in which each individual line of code is assessed.


As a type of software testing, path coverage testing is in the category of technical test methods, rather than being part of an overarching strategy or "philosophy" of code. It is labor-intensive and is often reserved for specific vital sections of code.

Techopedia Explains Path Coverage Testing

The way that path coverage testing works is that the testers must look at each individual line of code that plays a role in a module and, for complete coverage, the testers must look at each possible scenario, so that all lines of code are covered.

In a very basic example, consider a code function that takes in a variable "x" and returns one of two results: if x is greater than 5, the program will return the result "A" and if x is less than or equal to 5, the program will return the result "B."

The code for the program would look something like this:

    input x
    if x > 5 then
    return A
    else return B

In order for path coverage testing to effectively "cover all paths," the two test cases must be run, with x greater than 5 and x less than or equal to 5.

Obviously, this method becomes much more complicated with more complex modules of code. Experts generally consider path coverage testing to be a type of white box testing, which actually inspects the internal code of a program, rather just relying on external inputs and strategies that are considered black box testing, which do not consider internal code.


Related Terms

Margaret Rouse

Margaret jest nagradzaną technical writerką, nauczycielką i wykładowczynią. Jest znana z tego, że potrafi w prostych słowach pzybliżyć złożone pojęcia techniczne słuchaczom ze świata biznesu. Od dwudziestu lat jej definicje pojęć z dziedziny IT są publikowane przez Que w encyklopedii terminów technologicznych, a także cytowane w artykułach ukazujących się w New York Times, w magazynie Time, USA Today, ZDNet, a także w magazynach PC i Discovery. Margaret dołączyła do zespołu Techopedii w roku 2011. Margaret lubi pomagać znaleźć wspólny język specjalistom ze świata biznesu i IT. W swojej pracy, jak sama mówi, buduje mosty między tymi dwiema domenami, w ten…