Instructions for running unit tests - openrocket/openrocket GitHub Wiki

OpenRocket uses JUnit unit testing to verify the correct behavior of some of the most important functionalities. Those unit tests are part of OpenRocket's GitHub YAML actions workflow. If you open a pull request, the unit tests are automatically run to check that everything is nominal.

But: it's good practice to run the unit tests before you push the changes to a pull request. To do this, you can run the following ant command from openrocket/build.xml:

cd openrocket
ant unittest

This will run the unit tests of both the core and swing module. If you want to run only the core module unit tests (contains mostly tests for verifying calculations), run:

(cd openrocket) if you weren't there already
ant unittest-core

For only swing unit tests (tests for the GUI interface):

(cd openrocket) if you weren't there already
ant unittest-swing

Failed unit tests

If a test failed, you will get an error message in the console that you ran the ant command in. It will not show exactly where the tests failed, but redirect you to an index.html file, which is a JUnit report that gives detailed information on the unit tests status. For example if the unit tests fail, you can get an error message along the lines of "Unit tests failed, for more information see openrocket/core/tmp/test-reports/index.html". Locate that index.html file and open it in a webbrowser (e.g. Google Chrome).

The index.html page gives a summary of how many tests passed and failed. Click on the hyperlink text beneath the "Failures" or "Errors" column to see which tests failed.

If you want to show unit tests errors in the console output stream instead of the index.html JUnit report, you can run:

ant unittest-no-junit-report