I have been using Visual Studio 2010 linked with Microsoft Test Manager using Team Foundation Server to run MTM data driven Selenium WebDriver tests. This has been working fine and I’m very happy with it. My problem is that I also sometimes want a separate set of data to run on a ‘per test’ basis in order to support the data in MTM (Eg. MTM will have login user/password data and this XML file will have import data for valid users).
Now by per test I mean either to access a line of XML (or CSV if that is easier) for every datarow in MTM. Alternatively, is there a place were one can initialise a TestMethod opposed to the initialise that is called in Visual Studio before each datarow iteration of a TestMethod. Or finally, is it possible to find out which iteration of the test is being performed (eg. which datarow is currently being used).
I know this is written in a fairly confusing way, but am struggling to make it more understandable! Let me know if there are any confusions or ambiguities and I will endeavour to clear them up.
I have found my own solution (albeit a little hacky) by using a global int in each test file that is initiated to 0. Then at the end of each test I increment it (pretty obvious really). I opted to implement a standard XMLreader and utilise this global int, though it gets a little tricky when changing between TestMethods in the one file. I may do this by having a “if number of XML elements == current XML element index; then i = reinitialised”.
Hope this helps someone at some point!