I have XML spreadsheet files created from Excel that I need to use as the input for my data driven test. I can’t use the DataSource attribute on my test method because of inconsistencies parsing the files with an Oledb provider. I was wondering if there is a way to have nested test results like the way the DataSource attribute does it?
I’d prefer for MSTest to show the breakdown of each row that was iterated as opposed to me catching a failed assertion exception and keep a collection of the failures. I of course want the test to run against every row and not quit executing upon the first failed assertion.
I’m not looking for answers that insist on loading the data via the DataSource attribute. Thanks
Use the DeploymentItem on each of your
TestMethodsto deploy the XML spreadsheet file that each Test needs. It will be deployed in the Assembly’s location.In the
TestInitilizemethod use the path of the Assemby to parse your file to your customDataSource(maybe a list of objects of your input data).Put your
TestMethod‘s code catch in a try/catch block. If an exception is thrown report the error using theTestContext.WriteLinemethod or append it in your custom results file (something like this).Use a class level counter and at the end of each
TestMethodcheck if the counter equals to your custom datasource lenght. If not, increase it by one and rerun the test.