Home CPSC 240

Lab 18: Unit Testing Exercise

 

Objective

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


 

Task

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.


 

Details

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.


 

Submitting

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

Copyright © 2024 Ian Finlayson | Licensed under a Creative Commons BY-NC-SA 4.0 License.