Predicate Logic

Predicate Logic In Software Testing

Yesterday, I wrote about using Propositional Logic in Software Testing. Propositional Logic is limited to obtained or declared truth values, which are helpful in situations like test orchestration, automation checks selection, etc. In today’s blog, let us look at usage of Predicate Logic in Software Testing, which deals with a domain or a space of values that are possible for a variable and how to tackle covering that space as part of test coverage.

Predicate logic (in its most simple form, represented as first order logic, also known as first order predicate logic) deals with objects (variables) that are accompanied by predicates which can assume values based on the function operating on it. Here are some predicate logic examples:

  • f(x) = x > 12
  • f(y) = y/2 < 6


In these examples, the variables are x and y, and the predicates are “> 12” and “< 6”. When we assign a value for x and y, it becomes a preposition and assumes a truth value. For example, when x is assigned 3, since 3 < 12, the truth value of the preposition ‘3 > 12’ is False. The values that the variable can take is called the domain of the predicate.

Let’s look at a couple of areas, which are actually well-known in software testing circles, where the logic is useful:

  • Boundary value analysis: when identifying the boundary values that a variable can take and defining the domain (space), which is helpful in test coverage
  • Equivalence Class Partitioning: when dividing the values that a variable can take into sets such that a value in a set is representative of all the values in that set, restricting the tests to only that value instead of all the values in the set, thus improving test efficiency

Hope that gives you an idea about what Predicate Logic is, how it is related to Propositional Logic, and how it can be used in Software Testing. For devising a test strategy for your product in your organisation using techniques like using Predicate Logic, feel free to contact me.

Leave a Comment

Your email address will not be published. Required fields are marked *