Is there a better way of achieving such functionality from testng.xml? The issue here is *usability*. It is unthinkable to create such a design where for every testcase iteration I'll need to create 6 xml nodes just to gain another testcase iteration: 1) <test> 2) <classes> 3) <class> 4) <methods> 5) <include> 6) <parameter>
Re: How to pass parameters to dataProvider from TestNG.xml
On Monday, 23 January 2017 17:29:25 UTC+2, Jon Nelson wrote:
The 'better way' would be to NOT pass this data from testng.xml, but rather specify data inline (in the data provider) or read it from data files... why do you need it in testng.xml?
The TestNG.xml gives me the ability to declare a test playlist*, what tests are going to be executed and with the example above also state how many iterations and which parameters It looks to me like a very straight forward usable execution way. What you're offering to me is to have 2 files that must be changed whenever I need to change: - which tests will run - how many times (how many test cases injected into the DataProvider) - parameters
I'd like to have these configurations in 1 xml file, call it however you like, as far as Ive read, it all belongs to testng.xml
Perhaps my needs are simpler than yours, but this technique (using testng.xml) seems like a strange & unusual way to specify test data. Generally, the data provider (or data' file) specifies both the parameters and # of iterations (data objects), and the @DataProvider annotation identifies which tests use that data (which generally doesn't change) - so you should only need to commit 1 file to update your test data. Parameters passed from testng.xml are generally 'metadata' (e.g. browser, platform) rather than actual test data.
@Yanan, I'm not sure what you mean by 'handle the test case name'; I generally use <test> to specify one or more test classes to execute/report together, not to specify individual testcases within a class.