Coded UI Test - Data Driven using an XML File

 I have done data driven with csv and excel  but this is the first time i am trying to do with xml and not able to achieve it.
I am using the below to access the xml file,
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\xmlfile.xml", "xmlfile#xml", DataAccessMethod.Sequential), DeploymentItem("C:\\xxxxx\\xxx\\DataLibrary\\xmlfile.xml"), TestMethod]
and the xmlfile.xml file looks like this,
<?xml version="1.0" encoding="utf-8"?>
<Data>
  <DataRow>
    <Num>123456</Num>
    <Name>action1</Name>    
  </DataRow>
  <DataRow>
    <Num>1412</Num>
    <Name>action2</Name>    
  </DataRow>    
</Data>
When I am trying to debug this is the error i am receiving,
Result Message:
The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library.
Error details: Object reference not set to an instance of an object.
BK

Hi BK,
There is anything wrong with your Datasource attribute.
The correct DataSource attribute is like:
[DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\data.xml", "Iterations", DataAccessMethod.Sequential), DeploymentItem("data.xml"), TestMethod]
Iterations is the name of the table in the xml file. On your side, it should be ‘DataRow’.
If your xml file is not in the project directory, then you need specify the absolute path of the file in DeploymentItem option.
Thanks,
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How to extract data from an arbitrary xml file and export in a nice csv file?

    Hallo,
    I'm facing big problems in the use of XML files. I have an
    application which generates XML files with clusters containing arrays
    and scalars like in the example pasted below. My task is to
    read it and export the data in a human-friendly CSV document.
    Since I don't know the actual content of the cluster, I need some kind
    of intelligent vi which goes through the XML file looking for arrays
    and other data structures in order to export them properly in the CSV
    format (columns with headers).
    Thank you
    <Cluster>
    <Name></Name>
    <NumElts>3</NumElts>
    <Array>
    <Name></Name>
    <Dimsize>6</Dimsize>
    <I32>
    <Name></Name>
    <Val>0</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>1</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>2</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>3</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>4</Val>
    </I32>
    <I32>
    <Name></Name>
    <Val>5</Val>
    </I32>
    </Array>
    <DBL>
    <Name></Name>
    <Val>3.14159265358979</Val>
    </DBL>
    <String>
    <Name></Name>
    <Val>ciao</Val>
    </String>
    </Cluster>
    Solved!
    Go to Solution.

    Thank you again,
    I'm forwarding my vi draft with many comments and an xml file sample.
    Data in cluster is stored according to the LabVIEW schema, infact it is generated by LabVIEW.
    What I'm trying to do is to access the element of the cluster and read their content using the Invoke node and Property node functions. Could you give it a look, there may be something wrong, I'm not able to access cluster children.
    Which funcions should I use? Could you give me an example? You may use the draft I enclosed...
    Then write these data in a csv file
    should be the easier part.
    BODY{font:x-small 'Verdana';margin-right:1.5em}
    .c{cursor:hand}
    .b{color:red;font-family:'Courier New';font-weight:bold;text-decoration:none}
    .e{margin-left:1em;text-indent:-1em;margin-right:1em}
    .k{margin-left:1em;text-indent:-1em;margin-right:1em}
    .t{color:#990000}
    .xt{color:#990099}
    .ns{color:red}
    .dt{color:green}
    .m{color:blue}
    .tx{font-weight:bold}
    .db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier}
    .di{font:small Courier}
    .d{color:blue}
    .pi{color:blue}
    .cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888}
    .ci{font:small Courier;color:#888888}
    PRE{margin:0px;display:inline}
      <?xml
    version="1.0" encoding="iso-8859-1" ?>
     <Contents type="Data"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="XMLSection.xsd">
     <section name="beta"
    date="7/31/2009" time="3:43:03 PM" version="1.0">
     <Cluster>
      <Name />
      <NumElts>1</NumElts>
     <Array>
      <Name />
      <Dimsize>4</Dimsize>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.93317638164326</Val>
      </DBL>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.79233924020314</Val>
      </DBL>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.39199947274518</Val>
      </DBL>
     <DBL>
      <Name>number: 0 to 1</Name>
      <Val>0.74817197429441</Val>
      </DBL>
      </Array>
      </Cluster>
      </section>
      </Contents>
    Attachments:
    read_array.vi ‏12 KB

  • How to create a data connection with dynamic XML file?

    Thanks for all reply first!
    I have formatted the submitted data into an XML file on the server side,this file can be import to PDF form correctly.
    I try to send this XML file to the user to let him can review what he has submitted.
    I guess that I should create a data connection to the XML file so that it can be reviewed by the user.
    But the question is that the XML file is dynamic generated.
    How can i do?
    give me some clus or examples,please.
    thanks,
    Jasper.

    Hi Jasper,
    To show user back the result, you can use PDF instead of XML. You can store the PDF template in server and you can merge XML data with PDF template by Livecycle Form Data Integration service.
    We, as KGC, can generate huge number of Adobe Livecycle forms in small periods. Also we give consultancy on Adobe Livecycle ES products and Adobe Livecyle Designer. In case of any need, do not hesitate to contact us.
    Asiye Günaydın
    Project Consultant
    KGC Consulting Co.
    www.kgc.com.tr

  • Issue with Date Conversion when loading XML File into Oracle 10g Database

    Hello all,
    I have the interface shown in the screenshot below. In it, amongst other actions, I'm mapping an XML file element representing a date to an Oracle table column defined as DATE. The source and target columns are highlighted in the screenshot.
    !http://img223.imageshack.us/img223/1565/odiscr275.jpg!
    When I execute the interface, I get the following error message:
    java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:103)
    I'm assuming this refers to the date conversion!
    I've already tried replacing SRC_TRADES.DEAL_DATE with TO_DATE( SRC_TRADES.DEAL_DATE, 'DD/MM/YYYY' ) in the Implementation tab. This function was not recognised when I executed the interface, so it didn't work! The date value in the XML file is in DD/MM/YYYY format.
    I'm guessing that Oracle SQL Date functions don't work in the Implementation tab. Please could somebody let me know:
    1. Which Date Conversion function I could use instead?
    2. Where I can find a reference for the methods/functions I can use in the Implementation tab (if such a reference exists)?
    Cheers.
    James

    Hi.
    Try to change the execution area to staging area. After You change it, write in the mapping box just SRC_TRADERS.DEAL_DATE. When You use TO_DATE, the source field typu should be varchar2, not date (as it is in your source datastore)

  • How can I affix Data to a existing XML file?

    Hallo.
    I have to write Data to an XML file. This I have to in a stacked Sequence within a while loop. How can I write my Data to my existing XML file without overwriting my existing Data from the loop before?
    Thanks

    I made the erroneous assumption that you were using your own XML creation code.  The LabVIEW write to XML file VI overwrites the file every time.  You can get around this behavior in  a couple of ways.
    Create your own write to XML VIs using the LabVIEW one as your base.  The LabVIEW one write a header, writes your data, then writes the end tag.  Split this up so that you open the file and write the header before your loop.  During the loop, write your data.  Write the end tag and close the file when you exit the loop.  Don't overwrite the LabVIEW vi.lib function, or you will probably regret it.  Copy it to a different location before you start your modifications.
    Use the LabVIEW write to XML file for the first write of the loop.  This will give you a file with a header and your first set of data.  Still in the first loop iteration, reopen the file and position the file pointer on the start of the end tag (</LVData>).  In subsequent loop operations, flatten your data to XML and write to the file directly using the file write primitive.  When you exit your loop, write an end-of-line character and the end tag "</LVData>" and close the file.
    If you need more detailed help on either of the above methods, let me know.
    Out of curiosity, why are you saving your data as XML?  There may be a better way to do it, depending on your application.
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • ScanNGo - Using localbackup.xml file

    Hi All, Wondering if someone would be able to help us out, we have hundards of CN51's and CN50's through AUS and NZ and have been looking into this ScanNGo barcode system. AUS have successuflly used the .XML file from the localbackup via SOTI Mobicontrol deployment system, but am trying to make it as easy as possible as with SOTI we still need to setup an APN connection before being able to connect to the device, so hence why am looking at the ScanNGo to atleast setup the APN. Searching the forums and I see people have had success in using the ScanNGo creator by using the localback.xml from the SmartSystems folder. Unfortunately this does not seem to work for me, it will scan all 9/9 barcodes from the ScanNGo system but then returns an error "Error reading scanned data into xml" Attached is the localback.xml file from which I can apparently use this file with the ScanNGo barcode creator ? Could someone please correct me if i'm wrong on this. Thanks, Much appreciated.

    Hello AdamD
    first, it is no good idea to apply a full backup xml to a device. You should only change the settings different from factory default. See other posts here about how to create a configuration xml with only changed settings.
    secondly, a backup xml does not contain security data like passwords. So the backup xml does not have the WWAN password(s):
    <Subsystem Name="WWAN Radio">
    <Field Name="ARD Enabled">
    0</Field>
    <Field Name="RadioType">
    2</Field>
    <Field Name="Restore Connection Entry Defaults">
    0</Field>
    <Field Name="Radio Power State">
    1</Field>
    <Field Name="Carrier">
    Worldwide UMTS</Field>
    <Field Name="Carrier Settings Auto Config">
    Enabled</Field>
    <Group Name="Carrier Settings">
    <Field Name="Restore Connection Entry Defaults">
    0</Field>
    <Group Name="Connection Info" Instance="Verizon">
    <Field Name="Connection Name">
    Verizon</Field>
    <Field Name="Phone">
    #777</Field>
    <Field Name="APN"/>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    <Group Name="Connection Info" Instance="ATT">
    <Field Name="Connection Name">
    ATT</Field>
    <Field Name="Phone"/>
    <Field Name="APN">
    wap.cingular</Field>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    <Group Name="Connection Info" Instance="Sprint">
    <Field Name="Connection Name">
    Sprint</Field>
    <Field Name="Phone">
    #777</Field>
    <Field Name="APN"/>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    <Group Name="Connection Info" Instance="Worldwide UMTS">
    <Field Name="Connection Name">
    Worldwide UMTS</Field>
    <Field Name="Phone"/>
    <Field Name="APN">
    Spark</Field>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    1</Field>
    </Group>
    </Group>
    <Group Name="WWAN Information">
    <Field Name="Phone Number">
    Not Available</Field>
    <Field Name="Firmware Revision">
    REVISION 03.001</Field>
    <Field Name="ESN">
    990004190136592</Field>
    <Field Name="IMEI">
    990004190136592</Field>
    <Field Name="IMSI">
    505013475281816</Field>
    <Field Name="Network">
    Telstra Mobile</Field>
    <Field Name="Model">
    PXS8</Field>
    <Field Name="Manufacturer">
    Cinterion</Field>
    </Group>
    </Subsystem>
    As you can see, the "WWAN Information" is nothing to be used for a configiration xml. And you see that there are no passwords.
    AFAIS the only WWAN settings you need to setup the connection is:
    <Group Name="Connection Info" Instance="ATT">
    <Field Name="Connection Name">ATT</Field>
    <Field Name="Phone"/>
    <Field Name="APN">wap.cingular</Field>
    <Field Name="Username"/>
    <Field Name="Password"/>
    <Field Name="AlwaysOn">
    0</Field>
    </Group>
    But keep in mind that you have to maintain the xml structure around this.
    ~josef

  • Can I Use a XML file as Managed Resource?

    Hi,
    I have a XML file which has all employee details.
    Can I use that XML file as a Resource in IDM?
    If so please let me know the steps to do.
    Please help me in this regard.
    Thanks
    RMS

    No.
    Since the XML file you have has custom tags, there is not a way for IDM to understand it's contents.
    IDM does offer a "Simulated" resource, which is an XML based resource, but it has a defined structure. You might be able to alter your XML to match what the Simulated Resource expects, or better yet, get it into a database and use the database table adapter.

  • Can you use an XML file to make Subclips for you?

    Hi everyone,
    I know this is a bit of a long-shot, but I am wondering if I can use an XML file(made after logging a few tapes, but before capture) to make subclips for me?
    Basically I have a painful project with 2 tapes i had to capture separately as 1 long individual clip each due to time-code breaks, but as i did first Log & Capture as usual (only to later find it wouldn't batch capture) i didn't want my hard work to go to waste!
    Hope I explained that clearly enough,
    Adam
    Message was edited by: Chocboy

    I'm assuming you captured using the non-controllable device setting and have the clip including TC breaks and blank areas etc.
    Try this:
    Load the clip into the Viewer and play it. Press M to set markers wherever you want them.
    If you want to give the marker a more decriptive name, press M a second time whilst the playhead is positioned on the marker. A dialog will open with text input fields. Or, click the marker in the Browser, then click the marker’s name to select it. You can now change the name.
    Drag in the Browser to select all the markers or click the first one, then shift click the last one.
    Choose Modify > Make Subclip. This will make all the subclips in one go and if you gave your markers new names, your subclips will use them.
    The subclips appear in addition to the original clip with the markers. You can rename the subclips, if you want. You can review the subclips, deleting any clips you might not need. If you do remove unused clips, you can use the Media Manager to remove your unused footage from disk, leaving the media for your remaining subclips alone.

  • Can we make a data connection using a WADL file?

    Can we make a data connection using a WADL file for REST web services?

    Can we make a data connection using a WADL file for REST web services?

  • I have to print two labels using single XML file.Error:Only one top level e

    Hi,
    I have to print two labels using single XML file. But its giving error:
    [Error] Error -1072896683 - Line: 38 Pos: 2 Error: Only one top level element is allowed in an XML document.
    Below is my XMl file:
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE labels SYSTEM "label.dtd">
    <labels FORMAT="lib://FRD/PurchasedDoor.btw"  PRINTERNAME="IBM 6700-R80 (300 dpi)" _QUANTITY="1">
    <label>
    <variable name= "Color">AUTUMN</variable>
    <variable name= "Special_Message_Attribute">MSG*</variable>
    <variable name= "Special_Message">This is special Message Label</variable>
    <variable name= "Model"></variable>
    <variable name= "Build_Date">09-APR-12</variable>
    <variable name= "Assy_Cart"></variable>
    <variable name= "Assy_Slot"></variable>
    <variable name= "Finish_Cart"></variable>
    <variable name= "Finish_Slot"></variable>
    <variable name= "Serial_Number">1945.1.1.2-1</variable>
    <variable name= "Serial_Number_Barcode">1945.1.1.2-1</variable>
    <variable name= "Specie">BIRCH</variable>
    <variable name= "Truck_Group"></variable>
    <variable name= "Label_Sequence_No">1</variable>
    <variable name= "WIP_Cart"></variable>
    <variable name= "WIP_Slot"></variable>
    <variable name= "Cabinet_Sequence_No">110</variable>
    <variable name= "JC"></variable>
    <variable name= "Thickness"> </variable>
    <variable name= "Width"> </variable>
    <variable name= "Length"> </variable>
    <variable name= "Overlay"></variable>
    <variable name= "Options">B30</variable>
    <variable name= "Profile_No"></variable>
    <variable name= "Door_Style">NEWBERRY</variable>
    <variable name= "Glaze"></variable>
    <variable name= "Shape"></variable>
    <variable name= "Glass"></variable>
    <variable name= "Hinge_Side"></variable>
    <variable name= "Hinge_Type"></variable>
    <variable name= "EGE"></variable>
    </label>
    <labels FORMAT="lib://FRD/SpecialMessage.btw"  PRINTERNAME="IBM 6700-R80 (300 dpi)" _QUANTITY="1">
    <label>
    <variable name= "Serial_Number">1945.1.1.2-1</variable>
    <variable name= "Special_Message">This is special Message Label</variable>
    <variable name= "Cabinet_Sequence_No">110</variable>
    </label>
    </labels>
    Please suggest.

    >
    XML can only have one root element per file.
    >
    from XML Document: The Root Element

  • Using an XML file for server URL instead of hard coding

    I can't find a good example.
    Could someone give me an example of using a local XML file to set a server url variable so i don't have to hard code url's?
    This works and i can trace the xml file but how do i access the individual xml data nodes?
    protected function initApp():void
         var loader:URLLoader = new URLLoader(new URLRequest("config.xml"));
         loader.addEventListener(Event.COMPLETE,configLoadComplete);
    private function configLoadComplete(event:Event):void
         trace(event.target.data);

    Hi,
    <a href="foobar.xml">right click and select save as from the context menu</a>
    or
    write your xml data or a copy of it with a different extension (text) so that it is not parsed as application/xml-xhtml
    or
    Use AJAX to retrieve the xml file and display it as the textContent of a <textarea>
    window.open wraps the xml markup in html tags for display purposes.
    Rob^_^

  • Using Spry.Data.XMLDataSet. Can xml file name be set to change on calendar date?

    I have a website that uses Spry Data XML DataSet to list common pests for the current month. http://www.shspestcontrol.com/
    Each month's list of pests is in a separate xml file (e.g. pests-august.xml)
    Rather than manually updating the file name each month, can it be setup to automatically change the name
    For instance on January 1st, file name changes to pests-january.xml, Feb 1st changes to pests-february.xml. etc.
    <script type="text/javascript">
    <!--
    var dsPests1 = new Spry.Data.XMLDataSet("xml_files/pests-august.xml", "gallery/pests/pest");
    //-->
    </script>
    Any advice if this can be done and if so how to go about doing it would be much appreciated
    Thanks, Toni

    <script>
    var dsPests1 = new Spry.Data.XMLDataSet("pests-september.xml", "gallery/pests/pest");
    function setPestsFile(){
        var months = new Array(13);
            months[0]  = "january";
            months[1]  = "february";
            months[2]  = "march";
            months[3]  = "april";
            months[4]  = "may";
            months[5]  = "june";
            months[6]  = "july";
            months[7]  = "august";
            months[8]  = "september";
            months[9]  = "october";
            months[10] = "november";
            months[11] = "december";
        var now = new Date();
        var monthnumber = now.getMonth();
        var monthname = months[monthnumber];
        dsPests1.setURL("pests-"+monthname+".xml");
        dsPests1.loadData();
    window.onload = setPestsFile();
    </script>

  • Data Template using Multiple XML's

    I have a requirement to create a data template with data from multiple XML files and this is dynamic based on user selection.
    Here is an example
    Data Hirerachy
    |-PO Header (POHeader.xml)
    |-----PO Line (POLine.xml)
    |-----PO Receipts (POreciepts.xml)
    Now use can choose to print all children or selectively one child . I can do it by creating 3 data templates and then using the appropriate one based on user selection. I am exploring the possibility to use one single dynamic data template created on the fly and passed to the publisher.
    Appreciate any pointer to achieve this
    Message was edited by:
    skarimis

    Hey
    I think I answered this on the internal forum
    Tim

  • Using an XML file as a data source for XI in NW CE 7.1 DS

    I am trying to set up a simple demonstration of XI capabilities by grabbing an XML file from one location and putting the data into WEI in and ISA 95 format.  I have set up my XML file (and schema) as an XML Data Source under ODA Data Sources.  However, I cannot seem to find how to access the data in my JEE application.  I was going to build a JPA file, but cannot seem to map the field data.
    I want to create a component in either WebDynPro or CAF perspectives that will utilize the XML file as input. I cannot find any examples either in SAP Support or by Google.  Any ideas?
    Thanks,
    TB

    OK - I got this working but in order to do this I followed some info from another post and changed the structure of the XML.
    Previously, it was structured as:
    <params>
    <param>
    <name>Test1</name>
    <value>Some Value</value>
    </param>
    <param>
    <name>Test2</name>
    <value>Some Value2</value>
    </param>
    </params>
    Now I have changed it to:
    <params>
    <param name="Test1" value="Some Value" />
    <param name="Test2" value="Some Value2" />
    </params>
    I also added the dod=true value into the JDCB url.
    Now, one of these circumstances fixed my issue (of which I am very glad) but I don't know which one :-) .... and I currently don't have the time to find out.
    I may investigate this further in the future (and post accordingly).
    Thanks,
    G

  • Using session.xml file from WorkB in  a Session Facade based on another xml

    Hi
    I have the follwing scenario.
    Need to read data from a set of tables and convert them into an XML file based on an XSD.
    I am planning to use Toplink POJO in JDeveloper to create a SessionFacade to read the values.
    I tested the SessionFacade using a client and I was able to read the values correctly.
    Based on my xsd, I created a project in Workbench and mapped the classes created earlier, I was able to test this mapping using a test xml data file.
    I was able to read the file, Unmarshall it, manipulate it and generate an XML.
    Now the question is how do I call this Marshalling from my SessionFacade ?
    Since two session.xml files are in different format, I could not copy the content from one file into another.
    How do I create a JAXBContext based on a different session.xml?
    Thanks
    Sambath
    Oracle Consulting

    Hi Doug,
    Thanks for the response. I did the same and I was able to make it work, soon after I posted. I should have updated it :-)
    I used two sessions file.
    The OXM expected the name of the file to sessions.xml and I have to keep it that way. I created a ormsession.xml using JDeveloper and referred the ORM Project created in the Workbench to use it for ORM . In fact I created a dummy ormsession.xml file in JDeveloper wiht a session named "default". I started by creating an entry manually by copying the contents of the session definition and renamed to "MySession"
    Once again thanks for following up
    Thanks
    Sambath

Maybe you are looking for

  • New to Macs, huge setup, and questions if it will work

    I have been wanting to do this very ambitious cross-platform home networking/home entertainment setup ever since bootcamp. Here goes: -Macbook with Vista Home Premium/Ultimate (w/ media center) -New Airport Extreme Base Station for wireless w/connect

  • OPEN PO CAPTURE REPORT.

    hello experts, I have to design a report to capture the open po's based on the assumption that if any one changes the netprice manually compared to contract pricing if anyone gimme some sample code or some directions to design... that would be really

  • Error while posting in payroll

    Dear All I have assigned wage type to symbolic account and these symbolic accounts are assigned to GL account's. After that when I am running posting through Eassy Access I am getting error like "Posting could not be promoted" Please guide me the nec

  • Illegal use of LONG datatype

    While I was insert a rows into the same table I am getting an error. I am having one long column in table list. I am getting following error while I was inserting a row. ORA-00997: illegal use of LONG datatype Please let me know how do I insert long

  • Can't drag and drop in Lilghtroom

    I'm using XP Pro. Duel core. 4 GB ram. Drag and drop works in every other program but not in Lightroom. I know at least one other person with the same problem. Adobe tech support didn't have any idea what to do. Any thoughts? Thanks