CLion 2017.3 EAP: Boost.Test support
Hi,
Welcome our new CLion 2017.3 EAP, build 173.2696.23!
In late 2016 and early 2017 we polled over 5,000 developers to identify the State of Developer Ecosystem. This covered C and C++ development and showed many interesting results.
Among other questions we’ve asked about unit testing framework used by the respondents on a regular basis. For C language the top three unit test frameworks are: Google Test (37%), Boost.Test (8%), CppUnit (8%). For C++ – Google Test (45%), Boost.Test (26%), CppUnit (11%).
CLion already supports Google Test and Catch unit test frameworks. And now it comes with the Boost.Test support! The support includes:
- Special Boost.Test Run/Debug configurations
- Built-in test runner with the progress bar and a tree view of all the tests running
- Ability to re-run failed tests, export test results, open previously saved results
- Ability to navigate to the source code of a particular test
- Gutter icons to Run/Debug unit tests and show the status of the tests
Besides, we’ve eliminated false warning for MSVC specific pragmas (CPP-9549).
Full release notes are available by the link.
Your CLion Team
The Drive to Develop
Roman says:
September 27, 2017Any plans to support CTest soon? Or any other way to specify build / run configurations in a text file?
Anastasia Kazakova says:
September 27, 2017There is a request (https://youtrack.jetbrains.com/issue/CPP-905), but no exact plans or estimations on this
marco says:
September 27, 2017thanks! Now please consider CppUTest, which is the only one that can be used to mock also C functions or C++ free-standing functions. See https://youtrack.jetbrains.com/issue/CPP-2470 for details.
Anastasia Kazakova says:
September 28, 2017I guess we’ll be able to provide a public API for unit testing frameworks sometime in future soon. And community will be able to add any framework to CLion with ease.
Pwera says:
September 28, 2017Great!
Roman says:
September 29, 2017Well, I’ve experimented with using Google Test in Clion. Surprisingly it is not usable today:
1) Tests output is messed-up. Most likely because of https://youtrack.jetbrains.com/issue/IDEA-70016
2) Test results window shows some random icons: (for example some passing tests shown as failed)
3) Console output is gray instead of colored (I use colored output in some tests)
Running tests outside of Clion works fine
Anastasia Kazakova says:
September 29, 2017That’s interesting. For me here Google Tests are working fine. We’ll check
Roman says:
September 29, 2017Personally I think the root cause of everything is https://youtrack.jetbrains.com/issue/IDEA-70016
Are you parsing test results from console output? Since console output is messed up, this can be the reason why Test Runner GUI shows incorrect results.
Btw, this link is broken https://www.jetbrains.com/help/clion/Running_Tests.html (referenced here https://www.jetbrains.com/help/clion/google-test-support.html)
Anastasia Kazakova says:
September 29, 2017Could be, but I just surprised as I don’t see the issue here. Pinged the team.
Thanks, we’ll check the webhelp links.
Roman says:
September 29, 2017I’ve removed colored output from my tests. Now GUI correctly shows test results. However when I click on some particular test console output is still messed (because there are still stdout and stderr ).
Anastasia Kazakova says:
September 29, 2017Ok, we’ll double-check what’s going on there
Roman says:
September 29, 2017Ok, I’ve extracted some reproducers. Maybe there are more..
https://youtrack.jetbrains.com/issue/CPP-10822
https://youtrack.jetbrains.com/issue/CPP-10821
Roman says:
September 29, 2017One more:
https://youtrack.jetbrains.com/issue/CPP-10823
Unfortunately I have very complicated output from tests, so it’s hard to read it fast without colors
Anastasia Kazakova says:
October 1, 2017We finally realized that the issue is that we do not support output from GT. That breaks our output results parser, so CLion can’t process results in the built-in test runner correctly (https://youtrack.jetbrains.com/issue/CPP-4780, https://youtrack.jetbrains.com/issue/CPP-7916).
Anastasia Kazakova says:
October 1, 2017Have you btw tried using GT messages in the following way https://stackoverflow.com/questions/16491675/how-to-send-custom-message-in-google-c-testing-framework?
Roman says:
October 1, 2017No, unfortunately diagnostics is built-in into a classes I’m testing.
Daniel says:
October 17, 2017Two questions:
1) Will there be a “Memory View” in 2017.3? Or planned in a future version?
2) Which UnitTest-Framework do you recommend for plain old C?
Thx and cheers Daniel
Anastasia Kazakova says:
October 17, 2017Thanks for your questions:
1) Memory view is on top of the queue, but I’m not sure about 2017.3, this might not fit, as we still have some other tasks for debugger.
2) There are several options still. Good overview is here: https://stackoverflow.com/questions/65820/unit-testing-c-code
Daniel says:
October 18, 2017Thanks!
stan says:
November 30, 2017terrific article nice one for writing.
Sergey Panov says:
December 12, 2017My test suite is BOOST_FIXTURE_TEST_SUITE, not BOOST_AUTO_TEST_SUITE, and I am getting “Test framework quit unexpectedly” while the console output is:
Running 15 test cases…
*** No errors detected
Process finished with exit code 0
Anastasia Kazakova says:
December 12, 2017What’s your version of Boost?