ArticleslgStudy

computer science

Boundary-value analysis

Boundary-value analysis is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Boundary-value analysis rather than just read about it. In short: Boundary-value analysis is a software testing technique in which tests are designed to include representatives of boundary values in a range. The idea comes from the boundary.

Boundary-value analysis — main illustration
Boundary-value analysis — illustration

Key takeaways

  • Boundary-value analysis belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Boundary-value analysis to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Boundary-value analysis from memory before moving on to harder problems.

Reference excerpt

Boundary-value analysis is a software testing technique in which tests are designed to include representatives of boundary values in a range. The idea comes from the boundary. Given that there is a set of test vectors to test the system, a topology can be defined on that set. Those inputs which belong to the same equivalence class as defined by the equivalence partitioning theory would constitute the basis. Given that the basis sets are neighbors, there would exist a boundary between them. The test vectors on either side of the boundary are called boundary values. In practice, this would require that the test vectors can be ordered, and that the individual parameters follows some kind of order (either partial order or total order).

Formal definition Formally, the boundary values can be defined as below:

Let the set of the test vectors be X1,..., Xn. Let's assume that there is an ordering relation defined over them, as ≤. Let C1, C2 be two equivalent classes. Assume that test vector X1 ∈ C1 and X2 ∈ C2. If X1≤X2 or X2≤X1 then the classes C1,C2 are in the same neighborhood and the values X1,X2 are boundary values. In plainer English, values on the minimum and maximum edges of an equivalence partition are tested. The values could be input or output ranges of a software component, can also be the internal implementation. Since these boundaries are common locations for errors that result in software faults they are frequently exercised in test cases.

Application The expected input and output values to the software component should be extracted from the component specification. The values are then grouped into sets with identifiable boundaries. Each set, or partition, contains values that are expected to be processed by the component in the same way. Partitioning of test data ranges is explained in the equivalence partitioning test case design technique. It is important to consider both valid and invalid partitions when designing test cases. The demonstration can be done using a function written in Java.

On the basis of the code, the input vectors of [a,b] are partitioned. The blocks we need to cover are the overflow statement and the underflow statement and neither of these 2. That gives rise to 3 equivalent classes, from the code review itself.

we note that there is a fixed size of integer hence:-

MIN_VALUE ≤ x + y ≤ MAX_VALUE We note that the input parameter a and b both are integers, hence total order exists on them. When we compute the equalities:-

x + y = MAX_VALUE MIN_VALUE = x + y we get back the values which are on the boundary, inclusive, that is these pairs of (a,b) are valid combinations, and no underflow or overflow would happen for them. On the other hand:-

x + y = MAX_VALUE + 1 gives pairs of (a,b) which are invalid combinations, Overflow would occur for them. In the same way:-

x + y = MIN_VALUE - 1 gives pairs of (a,b) which are invalid combinations, Underflow would occur for them. Boundary values (drawn only for the overflow case) are being shown as the orange line in the right hand side figure. For another example, if the input values were months of the year, expressed as integers, the input parameter 'month' might have the following partitions:

... -2 -1 0 1 .............. 12 13 14 15 ..... --------------|-------------------|------------------- invalid partition 1 valid partition invalid partition 2

The boundary between two partitions is the place where the behavior of the application changes and is not a real number itself. The boundary value is the minimum (or maximum) value that is at the boundary. The number 0 is the maximum number in the first partition, the number 1 is the minimum value in the second partition, both are boundary values. Test cases should be created to generate inputs or outputs that will fall on and to either side of each boundary, which results in two cases per boundary. The test cases on each side of a boundary should be in the smallest increment possible for the component under test, for an integer this is 1, but if the input was a decimal with 2 places then it would be .01. In the example above there are boundary values at 0,1 and 12,13 and each should be tested. Boundary value analysis does not require invalid partitions. Take an example where a heater is turned on if the temperature is 10 degrees or colder. There are two partitions (temperature≤10, temperature>10) and two boundary values to be tested (temperature=10, temperature=11). Where a boundary value falls within the invalid partition the test case is designed to ensure the software component handles the value in a controlled manner. Boundary value analysis can be used throughout the testing cycle and is equally applicable at all testing phases.

References

External links The Testing Standards Working Party website

Worked examples

Example 1 — a first encounter with Boundary-value analysis

Start with the simplest possible case. Write down what Boundary-value analysis claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Boundary-value analysis before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Boundary-value analysis ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Boundary-value analysis

In research
Boundary-value analysis appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Boundary-value analysis in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Boundary-value analysis is common in secondary-school and first-year university syllabi. It links to neighbouring topics Software testing, so understanding it makes those chapters shorter.
In everyday life
Look for Boundary-value analysis outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Boundary-value analysis” →

How to study Boundary-value analysis in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Boundary-value analysis means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Boundary-value analysis out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Boundary-value analysis in simple terms?

Boundary-value analysis is a software testing technique in which tests are designed to include representatives of boundary values in a range. The idea comes from the boundary.

Why does Boundary-value analysis matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Boundary-value analysis?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Boundary-value analysis.

Tags

  • Software testing

Keep exploring