Software Testing

Testing Lab Exercises (DE Section)

Testing Lab Exercises (DE Section)

The CSC116 Software Testing materials can be found here. For the testing lab, you will be testing a program that classifies triangles based on sides and angles.

Learning Outcomes

  • Describe the purpose of testing.
  • Describe the testing process.
  • Describe how black box and white box testing differ and why each are necessary.
  • Describe the purpose of black box testing.
  • Write black box test cases in table form (Black Box Test Plan) based on program requirements.
  • Write black box test cases using equivalence classes and boundary value analysis.
  • Describe the purpose of white box testing.
  • Write white box test cases in the form of a test class.
  • Draw a control flow diagram for given code. Calculate the cyclomatic complexity of given code.
  • List valid path through given code using control flow diagram.
  • Write white box test cases using basis paths, equivalence classes, and boundary value analysis
  • Describe the purpose of debugging.
  • Apply debugging techniques.

Requirements

The TriangleClassification program can be used to determine the classification of triangles either based on their side lengths or angles. The program should first prompt the user about which classification type (sides or angles) they would like to use. Depending on the classification type, the user is either prompted for the three sides or angles of the triangle. If the user provides invalid measurements for a triangle, an error message is printed; otherwise, the type of triangle is printed. The program assumes that the user will only enter integer values.

Both classification types require valid triangles:

  • Invalid triangle for side lengths: if one side’s length is longer than (or equal to) the sum of the other two, or a side length is non-positive.
  • Invalid triangle for angles: if three angles do not add to 180 degrees, or angle is less than or equal to 0.

Triangle Classifications by Side Lengths

  • Equilateral: all three sides are same length
  • Isosceles: two sides are same length
  • Scalene: none of the sides are the same length

Triangle Classifications by Angles

  • Acute: all angles are less than 90 degrees
  • Right: one right angle (90 degrees)
  • Obtuse: one angle is greater than 90 degrees

Implementation

You will be testing the given TriangleClassification implementation.

Note that you should not make any changes to TriangleClassification.java until you are told to do so with the white box testing.

Lab Tasks

You are expected to complete the following tasks to complete this lab: