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

Merge ParameterizedTest with Test #168

Open
Snaipe opened this issue Oct 6, 2016 · 4 comments
Open

Merge ParameterizedTest with Test #168

Snaipe opened this issue Oct 6, 2016 · 4 comments

Comments

@Snaipe
Copy link
Owner

Snaipe commented Oct 6, 2016

In hindsight I think that ParameterizedTest was kind of a mistake. I think that the concept should be merged with Test directly, with more options wrt parameter generation:

  • criterion would define void *const cr_param, and the symbol would be populated with the user parameter at runtime.
  • the Test macro would accept an additional .param parameter, with the following sub-fields:
    • .array would accept a global/static NULL-terminated array.
    • .generator would accept a user-defined generator that would be called continuously until it returns NULL.
@Snaipe Snaipe added this to the v3.0.0 milestone Oct 6, 2016
@kugel-
Copy link

kugel- commented Jan 5, 2017

I support this change. There is one more gripe I have with ParameterizedTest which sounds to be fixed by this also: There is a fork for each parameter. I do fully understand that each Test is forked, but for ParameterizedTest criterion forks for each param, not once for the test. This is not ideal, we usually have tight tests for lots of parameters so running ParameterizedTest in one process (and sequentially) is preferred.

@kugel-
Copy link

kugel- commented Oct 24, 2018

@Snaipe what do you think about my remark?

@Snaipe
Copy link
Owner Author

Snaipe commented Oct 24, 2018

I'm a bit divided on that. Having each test running in its own address space makes testing a lot easier, at the cost of speed.

I'm not completely sure what a good compromise would be. I think it will depend on which implementation we go with for #204, but I think it might go like this:

  • A test is always run in its own process.
  • Users may run sub-tests within a test, and those sub-tests are run in the same process of its parent test.
  • Parameterized tests are just a form of sub-test.

This would simplify the API a lot (there is only one kind of top-level Test) but I think this might introduce some unnecessary boilerplate.

@kugel-
Copy link

kugel- commented Oct 24, 2018

Sounds good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants