OpenWaterAnalytics / EPANET

The Water Distribution System Hydraulic and Water Quality Analysis Toolkit
MIT License
273 stars 203 forks source link

Update BUILDING.md to include instructions to run tests #714

Closed lbutler closed 1 year ago

lbutler commented 1 year ago

While submitting a recent PR, I wanted to add and run tests however it was not clear from the documentation the correct way to do this.

In the end, I could see appveyor.yml contained the required commands but it was not apparent for a new contributor.

I did also notice USEPA/epanet-solver has a section on their wiki that explains in detail their testing methodology: https://github.com/USEPA/epanet-solver/wiki/Testing-System

lbutler commented 1 year ago

I've made some suggested additions to the BUILDING.md file to include an additional segment on testing, we could expand this further to mention the regression testing as well.

You can view my suggested change on my branch here: https://github.com/lbutler/EPANET/blob/update-building.md/BUILDING.md

👇 I've copied the new section below for visibility too. If you have any suggestions for changes, please let me know, if there are no objections, I'll push a PR

Testing

Unit tests have been written using the Boost Unit Testing Framework and other Boost libraries. The tests are compiled into individual executables that automatically perform checks on the EPANET toolkit and output libraries.

The CMake build system has been configured with a build option for building tests. When enabled (-DBUILD_TESTS=ON) the test executables are built and registered with the CTest test runner, the default value for the test build option is off. The location of Boost can also be defined with -DBOOST_ROOT="%BOOST_ROOT%" if required.

To build the test executables for the EPANET library, first open a console window and navigate to the project's root directory. Then enter the following commands:


mkdir build
cd build
cmake -DBUILD_TESTS=ON ..
cmake --build . --config Release
cd tests
ctest -C Release --output-on-failure
lbutler commented 1 year ago

While writing this I did also come across this tutorial by @michaeltryby, alternatively, we could do a minimal change to BUILDING.md to reference the testing flag and link to the tutorial for more details. https://github.com/OpenWaterAnalytics/EPANET/blob/dev/tools/BuildAndTest.md