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

RFE: add capability to add tests to multiple suites #210

Open
jswaro opened this issue Jun 14, 2017 · 1 comment
Open

RFE: add capability to add tests to multiple suites #210

jswaro opened this issue Jun 14, 2017 · 1 comment

Comments

@jswaro
Copy link

jswaro commented Jun 14, 2017

Use case:

As a test writer, I would like to test my code against various permutations of setup and teardown functions without having to write a parameterized test harness for boiler plate code.

// instead of 

TestSuite(suite_variant_x, .setup = x_setup, .teardown = teardown_common);
TestSuite(suite_variant_y, .setup = y_setup, .teardown = teardown_common);

void __setup(int variable)
{
    api_setup(variable)
}

void setup_x(void)
{
   __setup(variant_x)
}

void setup_y(void)
{
  __setup(variant_y)
}

static inline void __api_test_function()
{
    int rc;
    rc = api_function(args...);
    cr_assert_eq(rc == SUCCESS);
}

Test(suite_variant_x, simple_api_call)
{
    __api_test_function();
}

Test(suite_variant_y, simple_api_call)
{
    __api_test_function();
}

I'd love the ability to one of the the following:

TestSuite(suite_variant_x, .setup = setup_x, ...)
TestSuite(suite_variant_y, .setup = setup_y, ...)

MultiTest(suite_variant_x, suite_variant_y, simple_api_call)
{

}

or

params = ({x}, {y}) // or for more complex statements, ({x, z}, {y, z}, {x, z'})
ParameterizedTestSuite(suite, .setup = parameterized_setup, .teardown = common_teardown, .params);

Test(suite, simple_api_call)
{
...
}

@Snaipe

@Snaipe
Copy link
Owner

Snaipe commented Jun 14, 2017

This is something to consider for #204.

If we were to implement this, the simplest semantic way would be to simply provide a list of parents to the test.

I wonder though. If the contents are identical, maybe providing a way to create a test from an existing void (*)(void) function might be the easiest way to have something functional without breaking the test tree.

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