DEPARTMENT OF COMPUTING

Resources: How to Run Unit Tests (CS 3005-style)

Steps:

Install Google Test

Instructions on installing Google Test are given in this document.

Clone the unit test repository

You should have been invited to the GitHub team that has access to the repository. If you missed the invitation, ask your instructor to resend the invitation. When you clone the repository, it should be a sibling directory to the source code repository. For example, you may have a directory whose contents are CS3005-202440-fractal13 and ut-cs3005-unit-tests-2024-40-02. It is important that there are no other contents in this directory, and that these two directories are not renamed from the default name of the repositories. The actual repository names will depend on the semester, and your github username.

From time to time, the unit tests are updated. It should never hurt to do a git pull within the unit test repository. You should NEVER commit or push in the unit test repository.

Run tests for a specific assignment

In the terminal, cd into the unit test repository. Then, run the unit-test.bash script, telling it which assignment to test. For example, ./unit-test.bash 4 will test assignment 4.

The testing process will create (if necessary) a directory in the unit-test directory named the same as your source code repository. In the example above, this is CS3005-202440-fractal13. Inside that directory, there will be a directory named the same as the assignment number. In the example, that would be 04. Inside of the numbered directory, there will be .o files for all of the compiled code, and a file named unit-test, if the unit test program built correctly. The ./unit-test.bash script will then run the unit test program. If you want to run it again without rebuilding, you can do so by running the unit-test program. This is useful for debugging.

Interpret results (repeatedly)

Instructions on interpreting results are given in this document.

Last Updated 10/08/2024