I am using a dataProvider and set up 3 tests with priorities 1,2,3.
I want the tests to run 1,2,3 and then repeat them with different data each time but as of now, it runs the first test 3 times, then second 3 times, and so on. My code looks something like this.
@Test(priority=1, dataProvider provider)
public void test1(asdf){ .. }
@Test(priority=2, dataProvider provider)
public void test1(asdf){ .. }
@Test(priority=3, dataProvider provider)
public void test1(asdf){ .. }
Is this possible with TestNG? It seems like a trivial thing but I can't find anything concerning this. Thanks
--
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 testng-dev+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-dev/e3afef88-52c3-433e-b56b-781ccd26e144%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-dev/CANikZLkbe-N%3DtPq2-7%2BJEuQzn1zkPLjA0m%3DpD40ckGSzO5iPxg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-dev/CAK%3DR5kbOnj9pgmjAAmMbQtbD8pSNXY00c81yLf6M1b9bTC5D4A%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-dev/CANikZLmrvR8qKvpfB02hQRMTTXj_Vf%2BhuNVoyWchMJ01nM%2Byew%40mail.gmail.com.
import org.testng.annotations.Test;
public class WebTest {
private int m_numberOfTimes;
public WebTest(int numberOfTimes) {
m_numberOfTimes = numberOfTimes;
}
@Test
public void testServer() {
for (int i = 0; i < m_numberOfTimes; i++) {
// access the web page
}
}
}
import org.testng.annotations.Factory;
public class WebTestFactory {
@Factory
public Object[] createInstances() {
Object[] result = new Object[10];
for (int i = 0; i < 10; i++) {
result[i] = new WebTest(i * 10);
}
return result;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="My_Suite" group-by-instances="true" verbose="2">
<test name="My_Test">
<classes>
<class name="com.rationaleemotions.googleforums.factories.WebTestFactory"/>
</classes>
</test>
</suite>
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-dev/CAK%3DR5kYOp6moVXRT5GoQ7UKm%3Dm5aEidFrmzn%3DAM%2B2h8Vm%2B6s6Q%40mail.gmail.com.