[testng-dev] TestNg's group-by-instances not working as expected

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[testng-dev] TestNg's group-by-instances not working as expected

Sudha Kannan

Hi Cedric,

I am using TestNg 6.8.8, and have been trying to get tests to execute per instance, with little luck. Could you please help me understand where I am going wrong. The following is my code.


<suite name="ExtendFactory" order-by-instances="true">
    <test name="Factory"  order-by-instances="true" preserve-order="false">
        <classes>
            <class name="com.test.SampleTest">

            </class>
        </classes>
    </test>
</suite>

public class Sample {

    @DataProvider(name = "test1")
    public static Object[][] createData1() {
        return new Object[][] {
                { "Google" },
                { "Microsoft"},
        };
    }

    @DataProvider(name = "test2")
    public static Object[][] createData2() {
        return new Object[][] {
                { "Apple"},
                { "Yahoo"},
        };
    }
}

public class SampleTest {
    @Test(dataProvider = "test1",dataProviderClass = Sample.class)
    public void verifyData1(String n1) {
        System.out.println(n1);
    }

    @Test(dataProvider = "test2", dependsOnMethods="verifyData1",dataProviderClass = Sample.class)
    public void verifyData2(String n1) {
        System.out.println(n1);
    }


I want the result to be in this order : Google, Apple, Microsoft,Yahoo OR Apple,Yahoo,Google,Microsoft, but I get Google,Microsoft,Apple,Yahoo.


--
You received this message because you are subscribed to the Google Groups "testng-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-dev.
For more options, visit https://groups.google.com/d/optout.