This is a migrated thread and some comments may be shown as answers.

Saving dynamic content to a local datasource?

3 Answers 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Aron
Top achievements
Rank 2
Aron asked on 25 May 2011, 03:58 PM
Hello,

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: https://sub.domain.org/Requisition/RequisitionView/2813

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
    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/data-driven-testing/local-data-driven-test.aspx


Thanks!

3 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 25 May 2011, 09:15 PM
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);


Regards,
Anthony
the Telerik team

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

0
Naveen
Top achievements
Rank 1
answered on 01 Nov 2012, 06:34 PM
Could you please forward me the link for this

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

0
Byron
Telerik team
answered on 06 Nov 2012, 07:35 PM
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.

Regards,
Byron
the Telerik team
Are you enjoying Test Studio? We’d appreciate your vote in the ATI automation awards.
Vote now
Tags
General Discussions
Asked by
Aron
Top achievements
Rank 2
Answers by
Anthony
Telerik team
Naveen
Top achievements
Rank 1
Byron
Telerik team
Share this question
or