Home CPSC 240

Lab 18: Unit Testing Exercise



To get experience using junit to create and run unit tests.



For this assignment, you will be adding JUnit unit tests to this Student class. This way, the methods of the class can be tested automatically.



Make sure that you run the tests. As the class is, all of your tests should all pass. Verify that introducing a bug into the Student class causes your tests to fail. For example, if you comment out the line in addCourse which computes the GPA, or otherwise change the code such that its answers are not right, your tests should begin to fail.



For this lab, you should submit the StudentTest.java file with your unit testing for the Student class.

Copyright © 2023 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.