mercredi 1 juin 2016

Using MSTest - How to get the value for a parameterized test (Row Data)

I am using MSTest to run test and the data source to run the test is an XML. Below is how the XML looks like

<flows>
<flow>
<step>
  <Action></Action>
  <NBR>1</NBR>
  <PageName>SSS</PageName>
  <Identifier>DDD</Identifier>
  <NextQuestion>2</NextQuestion>
  <PreferredValue>1234567899</PreferredValue>
  <Question>Organisation</Question>
  <CheckPoints></CheckPoints>
  <SubGroup>Recommend</SubGroup>
  <Tags>START</Tags>
</step>  
<step>
  <Action></Action>
  <NBR>2</NBR>
  <PageName>SSS</PageName>
  <Identifier>DDD</Identifier>
  <NextQuestion>2</NextQuestion>
  <PreferredValue>1234567899</PreferredValue>
  <Question>Organisation</Question>
  <CheckPoints></CheckPoints>
  <SubGroup>Recommend</SubGroup>
  <Tags>START</Tags>
</step>  
</flow>
</flows>

What I need to do here is to get the full node between and and create a queue of Steps.

I a stuck with this as how I need to do this. I saw in the whole net and there were simple examples to get a String or a number.

But I am stuck as how to get the whole node between flow and /flow

Below is the code I am using

 [TestMethod]     
 [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\aboutThem.xml","flow",DataAccessMethod.Sequential)]
    public void AboutThemTest()
    {
        string xyz = TestContext.DataRow["step"].ToString();
    }

But the above code does not work. Can anybody please share me your thoughts on whats the missing link here...Thanks for all your help.

Aucun commentaire:

Enregistrer un commentaire