Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for templated test cases - parameterized by type #38

Closed
akrzemi1 opened this issue Sep 23, 2016 · 6 comments
Closed

Add support for templated test cases - parameterized by type #38

akrzemi1 opened this issue Sep 23, 2016 · 6 comments

Comments

@akrzemi1
Copy link
Contributor

I cannot figure out if this framework supports or plans to support parametric test cases, where I define a test parametrized by some value, and then instantiate a number of sibling tests with different values; or I define a test parametrized by a type (like a template) and then instantiate a number of sibling test cases using a different type.

Frameworks like Gtest or Boost.Test support them. For reference see:

  1. http://www.boost.org/doc/libs/1_61_0/libs/test/doc/html/boost_test/tests_organization/test_cases/test_case_generation.html
  2. http://www.boost.org/doc/libs/1_61_0/libs/test/doc/html/boost_test/tests_organization/test_cases/test_organization_templates.html#ref_BOOST_TEST_CASE_TEMPLATE
  3. https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#value-parameterized-tests
  4. https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#typed-tests

Can we expect a similar functionality in this library?

@onqtam
Copy link
Member

onqtam commented Sep 23, 2016

It is in the roadmap (search generators) so yes, most probably - but no date can be promised :)

@onqtam onqtam added the for 2.0 label Sep 23, 2016
@h-2
Copy link

h-2 commented Feb 13, 2017

Typed tests are really important and would also be a big plus over Catch which only supports value parametrization and not typed. Without typed tests people still have to use Boost.Test and Gtest althouth they are really "old".

@onqtam
Copy link
Member

onqtam commented Feb 13, 2017

I'll give this a higher priority.

@onqtam onqtam removed the for 2.0 label Mar 15, 2017
onqtam added a commit that referenced this issue Apr 2, 2017
onqtam added a commit that referenced this issue Apr 4, 2017
@onqtam
Copy link
Member

onqtam commented Apr 4, 2017

I just implemented templated test cases in the dev branch - checkout the docs here and try the feature! Any feedback is welcome.

Value parameterization is a different story... Typed tests were easy (not really... C++98, etc.) because I could just copy the interface of other libraries. However I feel that value parameterization is potentially a much broader topic - I'm not sure what they should look like - and I haven't done my research yet...

I need feedback on this:

  • what do you think value-parameterized tests should look like?
  • how is data driven testing supported by Catch - is it done with SECTION() and logging with INFO()? If that is the case doctest can do the same - my support for INFO() is in the dev branch and has far superior runtime performance - read about it here
  • has anyone tried the generators feature of Catch? I cant find documentation on it... Is it postponed for Catch 2? Is that what you meant by saying that it supports value parametrization?
  • what about property based testing - does doctest need to implement value-parameterization at all or can it just interop with such a library?

@onqtam
Copy link
Member

onqtam commented May 10, 2017

I'm renaming this issue so it's only for templated test cases and I'm closing it so it ends up in the generated changelog when I release version 1.2 in a few days.

I'll make a new issue in the future about value-parameterized tests and will link to it here.

@onqtam onqtam closed this as completed May 10, 2017
@onqtam onqtam changed the title Parametric test cases? Add support for templated test cases - parameterized by type May 10, 2017
onqtam added a commit that referenced this issue May 15, 2017
onqtam added a commit that referenced this issue May 15, 2017
onqtam added a commit that referenced this issue Aug 16, 2017
@onqtam
Copy link
Member

onqtam commented Aug 16, 2017

I just pushed an update to the docs in the dev branch on how to emulate value parameterization easily - check it out - search for DOCTEST_VALUE_PARAMETERIZED_DATA

onqtam added a commit that referenced this issue Sep 5, 2017
onqtam added a commit that referenced this issue May 30, 2018
…137 and #38

this also means less compilers will be usable for doctest 2.0
onqtam added a commit that referenced this issue Aug 23, 2018
…137 and #38

this also means less compilers will be usable for doctest 2.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants