I am not able to see Text under the Properties, I had bind the SearchData.xlsx file. I want to write the Coded Step for complete data binding.
Is this the only way to do the same
// You can reference the column by index
Pages.Google.QText.Text = (string)Data;
// Or by name
Pages.Google.QText.Text = (string)Data["Numbers"];or Is there any other way to acess the data from External source ?
17 Answers, 1 is accepted
You can't do data binding through UI when you are using coded step. In this case you have to do it in code, because when you are doing a coded step we don't know what is inside. That is the reason you don't see the "Text" property, because in your coded step you can use other property instead.
the Telerik team
Have you tried databinding before you convert to a coded step and adding other code? You should be able to do the databinding in the UI as long as the step is recordable and has bindable parameters.
I already bind the data using (Excel, CSV) using Recording method in Telerik TestStudio Standalone, which works fine for me.
but if I enter 3 rows for username in excel file , it executes 3 times in my test.
Now what I want is to access particular sinlge row using Coded Step or Recording mode. I think it is possible only via Coded Step?.
Could you please help how to acess one particular row from (Excel, CSV) and input into my application.
I understand your request, but Test Studio doesn't offer access any specific row at random. The only way to select, a particular single row is to use Coded Step. If you search on the internet you'll find many articles explaining how to open and read the contents of the excel files.
the Telerik team
Could you provide the appropriate link
I have searched on the internet and found some samples how to open Excel files. Two of the most popular ways are:
1. Using OleDB provider here.
2. Using Microsoft.Office.Interop.Excel namespace here.
You can check at Microsoft MSDN library too. link
If I were you, I would first open the Excel file in the main constructor and then I would assign the "DataSet" to property of type "DataTable" as you can see on the attached picture. After that, this property can be used in the Coded Step to implement the logic you want.
You can try different approach if you want, to see which one works for you. I hope this helps!
the Telerik team
This really helps :)
I would suggest to put these kind of things in online documentation of Telerik Test Studio.
How do you do it?
Thanks for the reply. I'm familiar with the data driven feature and its limitations. I'm looking for a way to change the data sheet being used based on a configuration variable.
I would like to have test cases for production environment and development environment. Since I have to maintain two sets of data, I'll like to run the test using a "Prod" sheet if i'm running live or a "Dev" sheet if not.
Hope that makes more sense.
Ah I see. This folds in with the other reply on your support ticket 722244 I just send a couple of minutes ago (with more detail). Let's continue this discussion there instead.
I have a similar requirement as posted by Clifton i.e. use different data sheets(excels) for different environments and instruct the test script to use the relevant sheet using code. You mentioned in your reply to Clifton that this discussion would be continued in the support ticket but looks like I do not have access to see that discussion. Can you please help me too with the solution.
Here is the answer in the ticket that you cannot see:
If a parent test is reading and creating its own Dataset object, the only way for a child test to get the data is if the parent test stores the data in some sort of a global variable/object that the child test can refer to, but it could only get at it from the coded steps of the child test. You won't be able to use the standard Test Studio data driven approach for non-coded steps.
I am thinking you'd be better off implementing your own Execution Extension DLL. This DLL "extends" the functionality of Test Studio tests. All hooks contained in this DLL will get called always, by every test in every project ever run on that machine.
The hook you're after is this one:
public System.Data.DataTable OnInitializeDataSource(ExecutionContext executionContext)
Here you create your own DataTable object and Test Studio will use it as the data source for all data driven tests. In the ExecutionContext is the name of the test. You can optionally filter by the name of the test and adjust what you do. Returning NULL tells Test Studio to revert to its default behavior. The key advantage of taking this approach is that your child tests can use the InheritParentDataSource test property and consume the data in the standard Test Studio fashion.
Hope that helps.
Telerik by Progress