Skip to main content
blog title image

3 minute read - tools

Triangle Problem Testing

Jul 15, 2023

The Triangle Problem is a ‘classic’ from Software Testing, described in many books and training courses. This post describes the problem, links to some applications you can use to practice on and describes some nuances around the testing.

What is The Triangle Problem?

The application context surrounding the Triangle Problem is usually:

Given an application which takes three inputs, each representing the length of one side of a triangle, the application will respond with a message identifying if the inputs are: invalid, or represent a triangle, if they represent a triangle then the application will respond with the type of triangle (equilateral, isosceles, scalene).

The ‘problem’ is usually presented as a test design problem:

  • How would you test this?
  • What inputs would you use to test this?
  • etc.

Implementations of the Triangle Application

I have written an implementation of the Triangle Application as part of my Test Pages application.

During my research I found an implementation by the Triangle Calculator below:

Triangle Problem Exercises


  • In advance of testing, create a set of inputs with expected results, try them in the application, review coverage
  • Work with others, repeat exercise above, compare inputs and coverage
  • Create a ‘minimum’ input set for your testing.

Using either of the implementations:

  • The input design ignores the GUI implementation, what else do you need to do to test the GUI?
  • Test the drawing functionality, does that require different test input?
  • Can you spot any hidden functionality? If so, test it.


  • When would creating a ‘minimum’ input set be helpful?

Tool Support working with Test Pages Implementation:

  • Are there any lightweight adhoc tools or approaches for automating that could help you as you perform exploratory testing?

Automating Test Pages implementation:

  • Review the implementation from the perspective of “Is this automatable?”
  • How many different ways could you automate this?
  • Would any changes to the implementation make automating easier?
  • Try automating the implementation.

Code Review:

  • Review the code for the Test Pages Implementation, does that help or hinder your testing?

Using the Test Pages implementations:

  • Unit test the underlying JavaScript implementation, compare with your GUI approach and original test design.
  • Automate the Unit Testing from the console.

Make up your own exercises to push your approach to testing this simple example as far as you can.

Books and Research Resources

The Triangle Problem is described and referenced in the resources and books that follow.


  • The Art of Software Testing - Glenford Myers
  • Software Testing a Craftsman’s Approach - Paul C. Jorgensen
  • Testing Object-oriented Systems - Robert Binder
  • Test Driven Development By Example - Kent Beck

Additional Resources:

Expanded content on The Triangle Problem was released to Patreon Supporters back in 2022