Saving dynamic content to a local datasource?

4 posts, 0 answers
  1. Aron
    Aron avatar
    80 posts
    Member since:
    Dec 2005

    Posted 25 May 2011 Link to this post


    I have created my first test today! In my app I save a draft Requisition. After saving it I'm presented it's new ID in two pays.

    In the url:

    And also on the page I have this html element:
    <span class="requisitionTitleText">Requisition # 2813:<span class="requisitionDetails"> tt 574 6</span></span>

    In the both cases I need to do some "trimming" as it has extra text, for example:
    string newReq = "Requisition # 2813:"
    newReq = newReq.Replace("Requisition # ","");
    newReq = newReq.Replace(":","");

    So.. I need to have this ID, in either a text file or in memory, because I have 10+ other tests that will rely on this.

    I'm assuming that I need to:
    1. save the id to a local datasource
      How do I do this?
    2. in later tests, reference it like in this article

  2. Anthony
    Anthony avatar
    19 posts

    Posted 25 May 2011 Link to this post

    Hello Aron,

    Thanks for evaluating Test Studio and congratulations on your first test.

    You can easily extract a value from an element and reuse it later in the same test. Please follow the walk-through in our Data Bind an Extraction Step article.

    It is a bit trickier to save the data to an external data source and call it in other tests. Please see the forum posts located here and here to get started. This process can be accomplished without using our built-in data binding. Programatically you extract values, store them in a file, and recall them in other tests.

    Using the code below, you can trim a previously extracted value and store it again for later test steps to use within the same test (or child tests called via Test-as-step.

    string newReq = (string)GetExtractedValue("varname");
    newReq = newReq.Replace("Requisition # ", "");
    newReq = newReq.Replace(":", "");
    SetExtractedValue("varname", newReq);

    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

  3. Naveen
    Naveen avatar
    4 posts
    Member since:
    Jun 2012

    Posted 01 Nov 2012 Link to this post

    Could you please forward me the link for this

    Please follow the walk-through in our Data Bind an Extraction Step article.

  4. Byron
    Byron avatar
    184 posts

    Posted 06 Nov 2012 Link to this post

    Hello Naveen,

    Our features and documentation have changed since we last updated this ticket. I recommend reviewing our Create an Extraction Step article. As of our 2012 R2 release (2012.2.920), you can bind extracted variables to columns through the user interface with a drop-down menu. Please let us know if we can help you further.

    the Telerik team
    Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
    Vote now
Back to Top