@Factory combined with @DataProvider BUG , please help

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

@Factory combined with @DataProvider BUG , please help

Ben Mark
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Vimal Raj
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <[hidden email]> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Ben Mark
I can't I have a BaseClass dataprovider in my real problem where I have to have the ability to tell every testMethod how many iterations to run from an external dataSet
therefore I must have @Test connected to the dataprovider, since the dataprovider has the ITestNGMethod object that tells me via reflection which method called it.


On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="UfOHCvgIAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bm73...@...> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="UfOHCvgIAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="UfOHCvgIAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Ben Mark
In reply to this post by Vimal Raj
I also have multiple test methods in multiple classes

On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="UfOHCvgIAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bm73...@...> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="UfOHCvgIAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="UfOHCvgIAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Cédric Beust ♔-2
The data provider on your constructor creates two instances of the test class, and then the data provider on the method will call that test method twice, hence four invocations.


-- 
Cédric


On Tue, Jan 31, 2017 at 3:30 AM, Ben Mark <[hidden email]> wrote:
I also have multiple test methods in multiple classes

On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <[hidden email]> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

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

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Ben Mark
True but I'm running all test-iterations in parallel, hence I need every test iteration to instantiate the class fields separately..
Do you have an elegant solution for such case?


On Tuesday, 31 January 2017 20:56:57 UTC+2, Cédric Beust ♔ wrote:
The data provider on your constructor creates two instances of the test class, and then the data provider on the method will call that test method twice, hence four invocations.


-- 
Cédric


On Tue, Jan 31, 2017 at 3:30 AM, Ben Mark <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="79HQ0qIhAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bm73...@...> wrote:
I also have multiple test methods in multiple classes

On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <[hidden email]> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/testng-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="79HQ0qIhAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="79HQ0qIhAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Cédric Beust ♔-2
I guess I still don't understand your scenario. What's the point of using the same data provider for a class and then for a method inside that class?

Your method doesn't need to take any parameters: these parameters are the fields in the class.


-- 
Cédric


On Tue, Jan 31, 2017 at 11:05 AM, Ben Mark <[hidden email]> wrote:
True but I'm running all test-iterations in parallel, hence I need every test iteration to instantiate the class fields separately..
Do you have an elegant solution for such case?


On Tuesday, 31 January 2017 20:56:57 UTC+2, Cédric Beust ♔ wrote:
The data provider on your constructor creates two instances of the test class, and then the data provider on the method will call that test method twice, hence four invocations.


-- 
Cédric


On Tue, Jan 31, 2017 at 3:30 AM, Ben Mark <[hidden email]> wrote:
I also have multiple test methods in multiple classes

On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <[hidden email]> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

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

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

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Ben Mark
My classes contain various test methods because every class represents a feature, and in that feature I run the required tests..
Every class inherits from  a base class, where in that base class I need a before every test method that will run some data processing based on my test iteration params.

infra structure:
I got one dataProvider located in the base class that is providing test iterations for multiple test methods located in various test classes,
I'm controlling this data via a custom xml file, where I execute it all via a testng.xml file using alot of reflection to get what I need.

Works like a charm, the only setback is the before method, since I'm running in parallel, every thread must instantiate the base class fields, besides, every thread is a standalone test running in parallel...


So my bottom line is:
I need to give the exact values from every iteration that holds different number of parameters that is injected from the dataProvider into the tests, to also be injected into their before method..

Thanks in advance cedric,
~Ben




On Tuesday, 31 January 2017 21:07:47 UTC+2, Cédric Beust ♔ wrote:
I guess I still don't understand your scenario. What's the point of using the same data provider for a class and then for a method inside that class?

Your method doesn't need to take any parameters: these parameters are the fields in the class.


-- 
Cédric


On Tue, Jan 31, 2017 at 11:05 AM, Ben Mark <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="Ch2PNjoiAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bm73...@...> wrote:
True but I'm running all test-iterations in parallel, hence I need every test iteration to instantiate the class fields separately..
Do you have an elegant solution for such case?


On Tuesday, 31 January 2017 20:56:57 UTC+2, Cédric Beust ♔ wrote:
The data provider on your constructor creates two instances of the test class, and then the data provider on the method will call that test method twice, hence four invocations.


-- 
Cédric


On Tue, Jan 31, 2017 at 3:30 AM, Ben Mark <[hidden email]> wrote:
I also have multiple test methods in multiple classes

On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <[hidden email]> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/testng-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/testng-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Ch2PNjoiAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="Ch2PNjoiAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Krishnan Mahadevan
Ben,

Like every one else have mentioned before, Coupling a Factory driven data provider with a test class that also is driven by a data provider is NOT what you should be doing.

Would the following example give you so lead into how you may want to approach your problem ? 


public class DemoTest {

    @BeforeMethod
    public void beforeMethod(Method method, Object[] params) {
        //I am simulating my beforeMethod massaging my test data so that it can be
        //consumed by my data driven tests.
        for (int i = 0; i < params.length; i++) {
            params[i] = ((String) params[i]).toUpperCase();
        }
    }

    @Test (dataProvider = "dp")
    public void testMethod(String a, String b) {
        Reporter.log("a = [" + a + "], b = [" + b + "]", true);
        Assert.assertTrue(a.toUpperCase().equals(a));
        Assert.assertTrue(b.toUpperCase().equals(b));
    }

    @DataProvider (name = "dp")
    public Object[][] getData() {
        return new Object[][] {
            {"india", "cricket"},
            {"srilanka", "cricket"}
        };
    }
}

You will have to get rid of the Factory annotation and its coupling with the data provider, because the Factory annotation is to be used ONLY when you want TestNG to create Test Class instances by invoking its Non default constructor, pass it some values and then have all the test methods in the Test Class use the parameters for their tests. 
A good example for this would be : Lets say you have a test class that has tests for Login, Compose Email, Check Sent Folder and all these tests have to run for every set of username/password combos, thats when you would go for a Factory + Data Provider combo.

Unfortunately I am still not able to comprehend what is the use case that you are trying to solve. Maybe you could help share some mock test code that can explain your use case in a better fashion ?


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Wed, Feb 1, 2017 at 12:51 AM, Ben Mark <[hidden email]> wrote:
My classes contain various test methods because every class represents a feature, and in that feature I run the required tests..
Every class inherits from  a base class, where in that base class I need a before every test method that will run some data processing based on my test iteration params.

infra structure:
I got one dataProvider located in the base class that is providing test iterations for multiple test methods located in various test classes,
I'm controlling this data via a custom xml file, where I execute it all via a testng.xml file using alot of reflection to get what I need.

Works like a charm, the only setback is the before method, since I'm running in parallel, every thread must instantiate the base class fields, besides, every thread is a standalone test running in parallel...


So my bottom line is:
I need to give the exact values from every iteration that holds different number of parameters that is injected from the dataProvider into the tests, to also be injected into their before method..

Thanks in advance cedric,
~Ben




On Tuesday, 31 January 2017 21:07:47 UTC+2, Cédric Beust ♔ wrote:
I guess I still don't understand your scenario. What's the point of using the same data provider for a class and then for a method inside that class?

Your method doesn't need to take any parameters: these parameters are the fields in the class.


-- 
Cédric


On Tue, Jan 31, 2017 at 11:05 AM, Ben Mark <[hidden email]> wrote:
True but I'm running all test-iterations in parallel, hence I need every test iteration to instantiate the class fields separately..
Do you have an elegant solution for such case?


On Tuesday, 31 January 2017 20:56:57 UTC+2, Cédric Beust ♔ wrote:
The data provider on your constructor creates two instances of the test class, and then the data provider on the method will call that test method twice, hence four invocations.


-- 
Cédric


On Tue, Jan 31, 2017 at 3:30 AM, Ben Mark <[hidden email]> wrote:
I also have multiple test methods in multiple classes

On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <[hidden email]> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

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

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

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

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: @Factory combined with @DataProvider BUG , please help

Ben Mark
Krishnan, you made my day, thanks dude.
Didn't know beforeMethod has an option to get Object [] params as an argument and is also being injected from the dataProvider

cheers mate,
~Ben


On Wednesday, 1 February 2017 06:22:04 UTC+2, Krishnan wrote:
Ben,

Like every one else have mentioned before, Coupling a Factory driven data provider with a test class that also is driven by a data provider is NOT what you should be doing.

Would the following example give you so lead into how you may want to approach your problem ? 


public class DemoTest {

    @BeforeMethod
    public void beforeMethod(Method method, Object[] params) {
        //I am simulating my beforeMethod massaging my test data so that it can be
        //consumed by my data driven tests.
        for (int i = 0; i < params.length; i++) {
            params[i] = ((String) params[i]).toUpperCase();
        }
    }

    @Test (dataProvider = "dp")
    public void testMethod(String a, String b) {
        Reporter.log("a = [" + a + "], b = [" + b + "]", true);
        Assert.assertTrue(a.toUpperCase().equals(a));
        Assert.assertTrue(b.toUpperCase().equals(b));
    }

    @DataProvider (name = "dp")
    public Object[][] getData() {
        return new Object[][] {
            {"india", "cricket"},
            {"srilanka", "cricket"}
        };
    }
}

You will have to get rid of the Factory annotation and its coupling with the data provider, because the Factory annotation is to be used ONLY when you want TestNG to create Test Class instances by invoking its Non default constructor, pass it some values and then have all the test methods in the Test Class use the parameters for their tests. 
A good example for this would be : Lets say you have a test class that has tests for Login, Compose Email, Check Sent Folder and all these tests have to run for every set of username/password combos, thats when you would go for a Factory + Data Provider combo.

Unfortunately I am still not able to comprehend what is the use case that you are trying to solve. Maybe you could help share some mock test code that can explain your use case in a better fashion ?


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Wed, Feb 1, 2017 at 12:51 AM, Ben Mark <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="nqecU3lAAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">bm73...@...> wrote:
My classes contain various test methods because every class represents a feature, and in that feature I run the required tests..
Every class inherits from  a base class, where in that base class I need a before every test method that will run some data processing based on my test iteration params.

infra structure:
I got one dataProvider located in the base class that is providing test iterations for multiple test methods located in various test classes,
I'm controlling this data via a custom xml file, where I execute it all via a testng.xml file using alot of reflection to get what I need.

Works like a charm, the only setback is the before method, since I'm running in parallel, every thread must instantiate the base class fields, besides, every thread is a standalone test running in parallel...


So my bottom line is:
I need to give the exact values from every iteration that holds different number of parameters that is injected from the dataProvider into the tests, to also be injected into their before method..

Thanks in advance cedric,
~Ben




On Tuesday, 31 January 2017 21:07:47 UTC+2, Cédric Beust ♔ wrote:
I guess I still don't understand your scenario. What's the point of using the same data provider for a class and then for a method inside that class?

Your method doesn't need to take any parameters: these parameters are the fields in the class.


-- 
Cédric


On Tue, Jan 31, 2017 at 11:05 AM, Ben Mark <[hidden email]> wrote:
True but I'm running all test-iterations in parallel, hence I need every test iteration to instantiate the class fields separately..
Do you have an elegant solution for such case?


On Tuesday, 31 January 2017 20:56:57 UTC+2, Cédric Beust ♔ wrote:
The data provider on your constructor creates two instances of the test class, and then the data provider on the method will call that test method twice, hence four invocations.


-- 
Cédric


On Tue, Jan 31, 2017 at 3:30 AM, Ben Mark <[hidden email]> wrote:
I also have multiple test methods in multiple classes

On Tuesday, 31 January 2017 13:24:55 UTC+2, Vimal Raj wrote:
Remove the dataProvider from your @Test and remove the parameters from TestMethod1. That should help you.

On 31 January 2017 at 16:36, Ben Mark <[hidden email]> wrote:
Please look at the following code:

TestNG.version 6.10

import java.lang.reflect.Method;
import org.testng.ITestContext;
import org.testng.ITestNGMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;

public class ChildTestClass1 {
String a;
String b;
String c;
public ChildTestClass1(){}
@Factory(dataProvider = "dp")
public ChildTestClass1(String a1, String a2, String a3) {
a=a1;
b=a2;
c=a3;
}
@DataProvider(name = "dp", parallel = true)
public static Object[][] simpledataProvider(ITestContext context, ITestNGMethod method) throws Exception {

Object[][] data = new Object[][] { 
{ "DataA1", "DataA2", "DataA3" },
{ "DataB1", "DataB2", "DataB3" } };
return data;
}
@BeforeMethod()
public synchronized void init(Method m) throws Exception {
Thread.sleep(150);
System.out.println("before method:"+ m.getName());
System.out.println("Current thread id = " + Thread.currentThread().getId());
System.out.println("param a = " + this.a);
System.out.println("param b = " + this.b);
System.out.println("param c = " + this.c);
System.out.println("end Before method\n\n");
}
@Test(dataProvider = "dp")
public void TestMethod1(String a, String b, String c) throws InterruptedException {
synchronized (this) {
Thread.sleep(100);
System.out.println("Start test Method: TestMethod1");
System.out.println("param a = " + a);
System.out.println("param b = " + b);
System.out.println("param c = " + c);
System.out.println("Thread id = " + Thread.currentThread().getId());
System.out.println("end Test method: TestMethod1 \n\n\n");
}
}
}

When this code is executed, instead of getting TestMethod1 with 2 iterations, I'm getting 4.
Seems like it is executed twice from the @Factory, and then twice from the @Dataprovider

All I need is to initialize the class fields so that the @BeforeMethod will be able to process stuff




Thanks in advance,
~Ben

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/testng-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/testng-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="https://groups.google.com/group/testng-users" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="nqecU3lAAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="nqecU3lAAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" 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 https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.