Using dataprovider on the suite level.

171 views
Skip to first unread message

christoffer

unread,
Jul 1, 2011, 9:27:43 AM7/1/11
to testng-users

Hi i have a situation where the tests in a suite are dependent on
having the same data.

I have data1,data2,data3...dataN
and test1,test2...... testN

Now i need the testsuit to run this order

test1 with data 1
test 2 with data1
.......
testN with data1

and then
test1 with data 2
test 2 with data 2
.....
testN with data 2

and so on untill i hit dataN

If i put the @dataprovider on the test level i cannot be garanteed
that this hapens.
is there a way to get the dataprovider to the suite level so the data
is only read onse for each iteration of the suite and passed to each
test in the suite ?

best regards
/Christoffer



Alexander Poulikakos

unread,
May 23, 2013, 2:32:10 PM5/23/13
to testng...@googlegroups.com

I would be interested in the same thing. I have a DataProvider (returning a Iterator<Object[]>), with some heavy computation per iteration. To avoid repeating the computation, I would like to feed each iteration of the data-provider to multiple @Test method. With the option of feeding @Test method sequential/parallel.

 

Is it possible with current version of TestNG?

 

/Alex

 

From: testng...@googlegroups.com [mailto:testng...@googlegroups.com] On Behalf Of Chabongo
Sent: den 23 maj 2013 17:09
To: testng...@googlegroups.com
Subject: [testng-users] Re: Using dataprovider on the suite level.

 

Did you ever figure this out? I'm coming across the same problem right now and trying to come up with a workaround. I'll let you know if I get anything.

--
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 testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reinier Post

unread,
May 23, 2013, 3:11:15 PM5/23/13
to testng...@googlegroups.com
On Thu May 23 18:32:10 2013, alexander....@ericsson.com
(Alexander Poulikakos) wrote:
> I would be interested in the same thing. I have a DataProvider
> (returning a Iterator<Object[]>), with some heavy computation per
> iteration. To avoid repeating the computation, I would like to feed
> each iteration of the data-provider to multiple @Test method. With
> the option of feeding @Test method sequential/parallel.

Why don't you use memoization?
Introduce a data structure to store the results of the computation;
make the data provider run the computation and store the results
only if no results are yet available.

--
Reinier Post

Alexander Poulikakos

unread,
May 23, 2013, 3:59:44 PM5/23/13
to testng...@googlegroups.com
I guess computation is probably the wrong word to use, as each iteration of the DataProvider also sets up external test equipment. Can't use memoization for that.

/Alex
Reply all
Reply to author
Forward
0 new messages