This project is read-only.

how to read the input data sequentially?

Jul 10, 2012 at 10:36 PM

I have set of rows where each row has some input data that gets passed to my test. I want my test to iterate for all rows. I wanted to pass through xml file.   How the xml file should look like ?

I created below xml file, however it is only reading the first row. But not iterating through all rows.

Hashtable htEmailIds = CUITe_DataManager.GetDataRow(Type.GetType("Portal.Test.Int.SubmitServiceOrderTests"), "TestData.EmailAddressData.xml", "ValidEmailAddress");

  <data>
  <datarow id="ValidEmailAddress">
    <emailid>email@domain.com</emailid>   
  </datarow>
  <datarow id="ValidEmailAddress">
    <emailid>firstname.lastname@domain.com</emailid>
  </datarow>
  <datarow id="ValidEmailAddress">
    <emailid>email@subdomain.domain.com</emailid>
  </datarow>
  <datarow id="ValidEmailAddress">
    <emailid>email@domain.com</emailid>
  </datarow>

Appreciate your help ?

Thanks,

Sailaja


 

Jul 11, 2012 at 9:32 PM

Hi Sailaja,

You will notice in the CUITe Data Manager documentation here: http://cuite.codeplex.com/wikipage?title=CUITe Data Manager there is a unique id for each <datarow /> element.

Please try again after making those changes to your xml file.

Thank you.

Jul 13, 2012 at 7:39 PM

Thank you for your response.

I tried with Unique id for each datarow. However the test is not executing for all the datarows iteratively. here is my code snippet. What could be the reason? Appreciate your help.

 [TestMethod]
        public void ValidateEmailAddressFormat()
        {
            //TODO:Incomplete
            Hashtable htEmailIds = CUITe_DataManager.GetDataRow(Type.GetType("Portal.Test.Int.SubmitServiceOrderTests"), "TestData.EmailAddressData.xml", "tc8");

            Library.SignInGeneric(TestContext, htLoginData, htLoginData["aauserid"].ToString(), htLoginData["aapassword"].ToString());
            ClickSubmitServiceOrder();
            SubmitServiceOrder pgSubmitServiceOrder = CUITe_BrowserWindow.GetBrowserWindow<SubmitServiceOrder>();
            pgSubmitServiceOrder.txtcompanyName.SetText(htEmailIds["companyname"].ToString());
            pgSubmitServiceOrder.txtprimaryContactFirstName.SetText(htEmailIds["primarycontactfirstname"].ToString());
            pgSubmitServiceOrder.txtprimaryContactLastName.SetText(htEmailIds["primarycontactlastname"].ToString());

            pgSubmitServiceOrder.txtprimaryContactEMailAddress.SetText(htEmailIds["emailid"].ToString());
            pgSubmitServiceOrder.btnNext1.Click();

            //Library.SignOut();         
        }

<data>
  <datarow id="tc0">    
  <companyName>Tyrell Corp.</companyName>
  <primaryContactFirstName>Jonathan</primaryContactFirstName>
  <primaryContactLastName>Doe</primaryContactLastName>
   <emailid>email@domain.com</emailid>    
  </datarow>
  <datarow id="tc1"  inherits="tc0">
    <emailid>firstname.lastname@domain.com</emailid>
  </datarow>
  <datarow id="tc2"  inherits="tc1">
    <emailid>email@subdomain.domain.com</emailid>
  </datarow>
  <datarow id="tc3"  inherits="tc2">
    <emailid>firstname+lastname@domain.com</emailid>
  </datarow>
  <datarow id="tc4"  inherits="tc3">
    <emailid>email@123.123.123.123</emailid>
  </datarow>
  <datarow id="tc5"  inherits="tc4">
    <emailid>"email"@domain.com</emailid>
  </datarow>
  <datarow id="tc6"  inherits="tc5">
    <emailid>email@domain.co.jp</emailid>
  </datarow>
  <datarow id="tc7"  inherits="tc6">
    <emailid>firstname-lastname@domain.com</emailid>
  </datarow>
  <datarow id="tc8"  inherits="tc7">
    <emailid>email@domain-one.com</emailid>
  </datarow>
</data>

 

 

 

Jul 14, 2012 at 4:19 AM

You will have to manually iterate over the rows in the xml data file.

for (int i = 0; i < 9; i++)
{
    Hashtable htEmailIds = CUITe_DataManager.GetDataRow(Type.GetType("Portal.Test.Int.SubmitServiceOrderTests"), "TestData.EmailAddressData.xml", "tc" + i);

    ...
}