Path Coverage Testing

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 is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.