What determines the order in which dataProvider values are read?
18 views
Skip to first unread message
Eric Liu
unread,
Oct 28, 2019, 5:09:35 PM10/28/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to testng-dev
In this simple example, the dataProvider is populated in this order: {"a", 1},{"b", 2},{"c", 3}
but is run in this order: 2,1,3.
I would like to run the values through in the order in which they are added, so it would run with set 1,2,3. Thanks
Eric
unread,
Oct 29, 2019, 5:01:25 PM10/29/19
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to testng-dev
You have no control over the order of the runs. It is not even guaranteed to run in the same order every time. Sometimes it could be 3,2,1 and next time it could be 1,2,3.
You only have limited control over the order of the methods. If your tests are dependent on the order of the runs you need to separate them into different dataProviders and methods/classes. I suppose you could try to write an overly complicated and fragile listener to manipulate the order of execution by removing things from the test suite/run and adding them back one at a time after the last one has been executed.