Re: [boost] [Boost-users] Interest in a C++20 Unit Testing Framework?
Thanks for your valuable feedback. I added initial versions of tutorial and user-guide to README. It's not ideal yet but it's a start. * https://github.com/boost-experimental/ut#tutorial * https://github.com/boost-experimental/ut#user-guide I also updated benchmarks with Boost.Test-1.71.0 (static library). I didn't add Boost.LightweightTest though as it's just assertions (no tests/suites/etc...) so it makes it difficult to compare due to missing features. * https://github.com/boost-experimental/ut#benchmarks I hope that helps a bit. Thanks again, Kris On Fri, Nov 22, 2019 at 1:17 AM Richard Hodges via Boost-users < boost-users@lists.boost.org> wrote:
It looks very interesting. The idea of not using macros is very appealing to me.
From looking at the examples, I get the feeling of "I could probably use this".
However, as the other commenters have mentioned, without a tutorial and full reference it's difficult to judge whether it's ready for use in production.
Are there plans to develop this?
On Thu, 21 Nov 2019 at 16:24, Krzysztof Jusiak via Boost-users < boost-users@lists.boost.org> wrote:
Hi,
I was wondering whether there is any interest in exploring a C++20 single header/single module, macro-free Unit Testing Framework with no dependencies?
Github: https://github.com/boost-experimental/ut
Additional links: - Try it online: https://godbolt.org/z/uVDxkW - Benchmarks: https://github.com/boost-experimental/ut#benchmarks - How it works?: https://github.com/boost-experimental/ut#how-it-works
Thanks, Kris _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Richard Hodges hodges.r@gmail.com office: +442032898513 home: +376841522 mobile: +376380212
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
(FYI, https://www.boost.org/community/policy.html says: Don't
Overquote, Don't Top-Post,...)
On Mon, 25 Nov 2019 at 19:10, Krzysztof Jusiak via Boost-users
I also updated benchmarks with Boost.Test-1.71.0 (static library). I didn't add Boost.LightweightTest though as it's just assertions (no tests/suites/etc...) so it makes it difficult to compare due to missing features. * https://github.com/boost-experimental/ut#benchmarks
Boost.LT does not offer formal vocabulary for cases and suites, but saying it's "just assertions" is not quite accurate, I think. According to some of TDD advocates, there shall be single assertion per unit test [1] (test case is an individual unit of testing, a unit test): int sqr(int x) { return x * x; } int main() { BOOST_TEST( sqr(2) == 4 ); // test case 1 BOOST_TEST_EQ( sqr(-3), 9 ); // test case 2 return boost::report_errors(); } For those who multiple assertions: void test_sqr(int input, int expect) { BOOST_TEST( sqr(input) == expect); BOOST_TEST( sqr(-input) == expect); } int main() { test_sqrt(2, 4); // test case 1 test_sqrt(-3, 9); // test case 1 return boost::report_errors(); } Finally, the single runnable test program is a test suite. So, I will argue that Boost.LT does support test cases and test suites. [1] https://osherove.com/blog/2006/10/3/avoid-multiple-asserts-in-a-single-unit-... Best regards, -- Mateusz Loskot, http://mateusz.loskot.net
I see your point and I'm not going to argue it. I think it's a valid one, however, I see it a bit differently because test/suites registration is not automatic in case of Boost.LT and or C++, which IMHO, is one of the main functionalities of a testing framework (it allows not to write the boilerplate code, filter, print run tests, report them, etc. which is not provided by Boost.LT out of the box). In principle, the baseline for benchmarks could be raw functions and asserts or to compare apples to apples one could take expect from ut, BOOST_TEST from Boost.Test, CHECK from Catch2, etc. and do the manual registration as you presented, which would be fine, but not ideal, IMHO. Hence, I took the other approach and only compare frameworks that provide at least assertions/tests and suites in an automated way. All in all, I just didn't see much value in comparing Boost.LT (not an official boost library) because, in my view, it doesn't provide the same functionality as other tested frameworks but I also see your point, is just not what I wanted to focus on in the provided benchmarks. On Mon, Nov 25, 2019 at 12:12 PM Mateusz Loskot via Boost-users < boost-users@lists.boost.org> wrote:
(FYI, https://www.boost.org/community/policy.html says: Don't Overquote, Don't Top-Post,...)
On Mon, 25 Nov 2019 at 19:10, Krzysztof Jusiak via Boost-users
wrote: I also updated benchmarks with Boost.Test-1.71.0 (static library). I didn't add Boost.LightweightTest though as it's just assertions (no
tests/suites/etc...) so it makes it difficult to compare due to missing features.
Boost.LT does not offer formal vocabulary for cases and suites, but saying it's "just assertions" is not quite accurate, I think.
According to some of TDD advocates, there shall be single assertion per unit test [1] (test case is an individual unit of testing, a unit test):
int sqr(int x) { return x * x; } int main() { BOOST_TEST( sqr(2) == 4 ); // test case 1 BOOST_TEST_EQ( sqr(-3), 9 ); // test case 2 return boost::report_errors(); }
For those who multiple assertions:
void test_sqr(int input, int expect) { BOOST_TEST( sqr(input) == expect); BOOST_TEST( sqr(-input) == expect); } int main() { test_sqrt(2, 4); // test case 1 test_sqrt(-3, 9); // test case 1 return boost::report_errors(); }
Finally, the single runnable test program is a test suite.
So, I will argue that Boost.LT does support test cases and test suites.
[1] https://osherove.com/blog/2006/10/3/avoid-multiple-asserts-in-a-single-unit-...
Best regards, -- Mateusz Loskot, http://mateusz.loskot.net _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org https://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Krzysztof Jusiak
-
Mateusz Loskot