XML schema requirements for data-binding

8 posts, 0 answers
  1. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 17 Jun 2011 Link to this post

    Hello,

    I have a couple of questions on databinding via an XML file:

    a) Does the xml file used for data binding have any specific schema requirements?  
    b) Can I create a data-bound step that references the NavigateUrl node in the example below?  If so, how?

     

    <NewDataSet>  

        <WebAiiBuiltinData>

                  <Server1>

                      <NavigateUrl>http:www.google.com</NavigateUrl>

                 </Server1>

         </WebAiiBuiltinData>

    </NewDataSet>

      

    c) Can I create a databound step that references one or the other NavigateUrl values (based on some criteria) in the example below ?  If so, what would the reference to each NavigateUrl look like in the data-bound step? 

    <NewDataSet>  

        <WebAiiBuiltinData>

                  <Server1

                      <NavigateUrl>http:www.google.com</NavigateUrl

                  </Server1>

                  <Server2>

                         <NavigateUrl>http:www.telerik.com</NavigateUrl>

                  </Server2>

        </WebAiiBuiltinData>

    </NewDataSet>

     

    Thanks for your help,
    Shashi

     

     

     

     

     

     

     

     

     

     

     

     

  2. tony
    tony avatar
    1 posts
    Member since:
    Jun 2011

    Posted 20 Jun 2011 Link to this post

    this xml schema tutorial might help you, good luck
  3. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 20 Jun 2011 Link to this post

    Hi Tony,

    Thanks for the link to the tutorial.  However, my questions were not general XML questions (which, I think the tutorial is for) - but in the specific context of WebUI data-binding.  I would like to add data-bound steps that read data from XML data nodes that are at various levels in the hierarchy.  Further, I know how to accomplish this in code and so I know that I can go to coded steps if necessary - but I am hoping that I don't have to do that as I am trying to minimize coded steps in my tests as much as possible (given who will maintain them).

    I apologize for not clarifying that in my original posting. 

    Shashi
  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 23 Jun 2011 Link to this post

    Hello Shashi,

    Thanks for the question. We have updated our external data source article with an XML example. Please see here under the "Add an XML file" heading.

    Best wishes,
    Anthony
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  5. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 29 Jun 2011 Link to this post

    Hi Anthony,

    Sorry for the delay in responding - I was busy with other tasks and am just now getting back to this.

    Your article helped answer the first of my questions - sounds like there are no schema requirements imposed by WebUI as long as the correct table is selected in the Setup Binding step.  I also found out that the test can access the NavigateUrl node in the first of my examples below provided I select the Server1 table in the Setup Data Binding dialog.  It can also access one or the other NavigateUrl node in my second example if I select the correct table (Server1 or Server2).

    So my next question is:  Is there a way for me to programmatically select the Table for a test so that the rest of the test gets its data from the correct table?  In other words, can I do the following:

    Set table (in coded step)
    NavigateToUrl (coded or non-coded step)
    Execute databound steps that take data from selected table (non-coded)

    If there is a way to set the table programmatically, what is the API that I need to call?

    Thanks,
    Shashi

  6. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 29 Jun 2011 Link to this post

    Hi Shashi,

    Natively Test Studio only supports binding a test to a single table within an XML file. Please see our KB article on Dynamic Data Binding for a good work-around, though.

    For advanced data binding we recommend using the OnInitializeDataSource test extension as documented here. Using this test extension, you can write code that creates a data table from any source that you can program. Test Studio will then use the data table you created as the data source for tests.


    All the best,
    Anthony
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
  7. Shashi
    Shashi avatar
    25 posts
    Member since:
    Feb 2011

    Posted 29 Jun 2011 Link to this post

    Anthony,

    I am not trying to bind to multiple tables - the test would still bind to a single table.  However, the XML file will have several tables ("Server1", "Server2" in the second example below) - all with the same set of columns but with different values in those columns.  I want to specify which table the test should bind to at runtime - in other words, replicate (in code) the action of selecting an option on the Table dropdown on the Setup Binding dialog.  The Dynamic Data binding article gets me halfway there - it tells me how to bind with an xml file at runtime; I want to go one step further and bind to a table within that file at runtime.

    To give you further information, the test in question will be called by multiple tests - which have added the child test as a step.  I want to convert that Add Test As Step step to a coded step. In the code-behind, I would like to set the Table field in the child test before I invoke it.  Each parent test may specify a different table for the child test to use (however, all tables will have the same set of columns).

    Is there a way to accomplish the above?

    Thanks,
    Shashi
  8. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 29 Jun 2011 Link to this post

    Hello Shashi,

    I understand your scenario, however it is not possible as you've presented it.

    We can still accomplish your end goal, albeit in a more roundabout fashion. We thought of an additional way to handle it. Please see the attached picture for a visualization.

    Regards,
    Anthony
    the Telerik team
    Register today for a live 'What's New in Test Studio R1 2011 SP2' event on Tuesday, July 19 at 2pm EST!

    Have you looked at the new Online User Guide for Telerik Test Studio?
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!