You must verify your project is passing the functionality tests to earn the project tests grade, as well as before every code review, and to earn your project design grade. This guide walks through that testing process.

This guide assumes you have already followed the Project Setup guide in Eclipse.

TABLE OF CONTENTS


Running Tests Locally

It is important to work, test, and commit the projects iteratively, as well as attempt to pass the tests locally before considering running the tests remotely.

Running JUnit Tests

The primary way you should run, debug, and test your project code should be through the JUnit tests provided. The tests make sure the working directory is correct for the input and output files.

Choosing Tests

There are different tests you must run depending on the project milestone you are working on. The writeup for each of the Projects assignments will state the test file to use for that milestone.

You should work iteratively on those tests. Specifically:

  1. Start by running only the first test case in the order provided in the test file for the current milestone.

    For the first Project v1.0 Tests milestone, this is the testHello() test case in the FileTests group in the BuildCountTests.java test file provided in the https://github.com/usf-cs272n-fall2024/project-tests repository..

  2. Start running the test group in the order provided after you are passing the first test.

    For example, once testHello() is passing, run the entire FileTests group.

  3. Start running the entire test file only after you are passing multiple groups.

    For example, once FileTests and DirectoryTests are independently passing,

  4. Your code must still pass tests from previous project milestones as well. However, you only need to run past tests if they are reported failing by the GitHub Actions bot when testing remotely.

Any time you begin struggling with a test, switch back to running just one test at a time to help debug. The Homework Submission guide illustrates several ways to run a single test or a group of tests at a time.

<aside> <img src="/icons/info-alternate_gray.svg" alt="/icons/info-alternate_gray.svg" width="40px" /> Pay attention to the test order in the file provided. The “Package Explorer” view sorts alphabetically by default, which might not be the best order to run the tests. The “Outline” view can be configured to show the tests in the order provided or alphabetically.

</aside>

Failure Trace