Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
4

How to do unit test for OpenStudio in Ubuntu

asked 2015-06-30 08:45:34 -0600

building_performance's avatar

updated 2015-07-26 18:09:45 -0600

I download the OpenStudio source code and am studying it for my research. I run the software in Ubuntu. Two questions are bothering me: (1)How to do the unit test?(2) Where is the main function()? I only found a bunch of functions for objects: fans, pump, coil, etc...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2015-07-01 10:46:50 -0600

updated 2015-07-01 11:25:00 -0600

OpenStudio C++ development is deep water, but step one is following these directions for setting up your build environment.

You need to make sure you configure with testing enabled.

image description

Once you have a functioning build you can run all of the unit tests with ctest.

cd <openstudio-build-directory>/OSCore-prefix/src/OSCore-build/
ctest

OpenStudio unit tests are implemented using the gtest framework. GTest provides a main function that serves as the test runner. There are several different test runners (test executables) corresponding to different areas of the code. CTest on the other hand is like a meta test runner that wraps a single interface around the entire collection of tests. Using ctest the way I described above is the easiest way to run ALL of the tests, but you can also access the gtest runners directly with something like this for the Model API tests.

./<openstudio-build-directory>/OSCore-prefix/src/OSCore-build/Products/openstudio_model_tests

Here is an example of some of the Model tests.

The ctest and gtest interfaces both take a range of arguments to select specific tests and choose runner options. Use the --help option to see a list of their respective options.

 ctest --help
./<openstudio-build-directory>/OSCore-prefix/src/OSCore-build/Products/openstudio_model_tests --help
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2015-06-30 08:45:34 -0600

Seen: 156 times

Last updated: Jul 01 '15