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 feature to allow combining data providers #1171

Closed
kotovdv opened this issue Sep 27, 2016 · 4 comments
Closed

Add feature to allow combining data providers #1171

kotovdv opened this issue Sep 27, 2016 · 4 comments

Comments

@kotovdv
Copy link

kotovdv commented Sep 27, 2016

Combining data providers

It would be very nice to have a feature, that will allow us to combine multiple data providers into single DP. The result of such combination could be a cartesian product or concatenation, depending on options specified.

Simple example

Lets say we have two dataProviders first and second. We are already using these two somewhere in our tests and we need the third one, which is going to be cartesian product of these two.

    @Test(dataProvider = "combination")
    public void combinedDpTest(int firstDpArgument, int secondDpArgument) {
        //test method body
    }


    @CombinedDataProvider(mode = CARTESIAN_PRODUCT)
    public String[] combination() {
        return new String[]{"first", "second"};
    }


    @DataProvider
    public Object[][] first() {
        return new Object[][]{
                {1},
                {2},
                {3}
        };
    }

    @DataProvider
    public Object[][] second() {
        return new Object[][]{
                {4},
                {5},
                {6}
        };
    }
@cbeust
Copy link
Collaborator

cbeust commented Sep 27, 2016

This has come up a few times and I've never really been convinced it's worth adding such an implementation to TestNG when there are so many ways data providers can be combined.

@cbeust
Copy link
Collaborator

cbeust commented Sep 27, 2016

This has come up a few times and I've never really been convinced it's worth adding such an implementation to TestNG when there are so many ways data providers can be combined and it's pretty trivial to write your own.

@kotovdv
Copy link
Author

kotovdv commented Sep 27, 2016

Yeah, i'm aware of the fact that these combinations are easy to implement on your own, but it would be handy to have such thing "out of the box" anyway imo.

@kotovdv kotovdv closed this as completed Sep 27, 2016
@juherr
Copy link
Member

juherr commented Sep 27, 2016

Duplicate of #865

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