Reputation: 223
I'm moving some tests from mstest to nUnit. MsTest allows to specify a XML file as the input data for the test:
[TestMethod()]
[DeploymentItem("ProjectName\\TestData\\file.xml")]
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",
"|DataDirectory|\\TestData\\file.xml",
"Row",
DataAccessMethod.Sequential)]
public void Test() {}
How can I have a similar test setup in nUnit?
Upvotes: 1
Views: 1426
Reputation: 136593
NUnit doesn't have direct support to read a custom xml file. However it does provide support to specify a method (refer for examples to the docs for the TestCaseSource attribute) which will compute test case inputs for a parameterized test.
You can implement this method to read the inputs from an XML / CSV or whatever custom logic you choose.
Upvotes: 2