question about dataprovider and runtime use

51 views
Skip to first unread message

Federico Consiglio

unread,
Jul 27, 2015, 9:44:02 AM7/27/15
to testng-users

I use dataprovider in oder to create test from a file..and all is ok.. for example my Object[][] is

new Object {1, createnode}

new Object {2, generate}

new Object {3, delete}

 

Now I have the following problem:

 

While the execution is going I have an instruction of my grammar for testing that is capable of generate  items. The problem is that in testng you can not change runtime the dataprovider  fuction in order to reload tests

For example:

 

new Object {1, createnode}

new Object {2, generate}

new Object {3, delete}

new Object {4, create}

new Object {5, create}

 

How is it possible to reload dataprovider or what can I use instead of?

Todd Bradley

unread,
Jul 27, 2015, 10:55:12 AM7/27/15
to testng...@googlegroups.com
One approach is to just build your own separate data provider method that generates the input to your test method and calls it repeatedly. You won't get the nice built-in reporting for each separate execution of the method, but it works. 

public void testMyScenarios() {

for (int i = 0...whatever...) {
testTheThing(myDataProvider(i));
}

Sorry for the bad formatting. I'm typing this on my phone on the bus. 





---
Sent from Boxer | http://getboxer.com

--
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.
For more options, visit https://groups.google.com/d/optout.

Federico Consiglio

unread,
Jul 28, 2015, 2:05:05 AM7/28/15
to testng-users, tod...@gmail.com
i prefer to have also a good report . if i  use @dataprovider ,without istruction that generate tests  , all is ok.. but if  you call it inside the test in ordr to load new test . obvoiusly you concurrent modification. and it fails
Reply all
Reply to author
Forward
0 new messages