How can we send from local database (for testing data) a value to our bind t-sql param?
sample:
If this is my local db: (column name is TempMachineName)
Machine1
Machine2
select Id from [ActiveMachines] where Name = '$(TempMachineName)'
and then to use the scalar value for some locator on DOM element
Thanks,
Yohai
5 Answers, 1 is accepted
Your use case is not 100% crystal clear to me, but I must tell you there are a couple of limitations in Test Studio you may be running into:
1) Test Studio does not have a built-in feature to pass in parameters to any data binding definition, including T-SQL. What you can do however is to create your own Test Extension DLL where you have total control over the data source. You will need to implement the OnInitializeDataSource method. Whatever this method returns (other than null) will override any data binding that the test has.
2) Test Studio does not have built-in Data Driven find expressions. This can be done with a little bit of code however. http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/data-driven-find-expressions.aspx
Cody
the Telerik team
Test Studio Trainings
I will try to make things more clear.
I have elements on the DOM that the id attribute is generated by guid from the database.
1. I create a new item from my UI.
2. I want to get the generated id from the database.
3. Store it in local parameter.
4. Use it as a parameter to T-SQL and element selector .
From your response i understand that i can't do it from your UI, only from code. am i right?
Thanks,
Yohai
Correct, code is the only way to accomplish your goals. Going through your numbered list here's what I think it would take:
1) I am pretty sure this can be done using our standard record & playback i.e. our standard non-coded steps.
2) Using this code sample as a reference, pull the ID out of the database.
3) As part of step 2 above simply store it in a global variable in code.
4) Using this code sample as a reference, use the ID stored in the variable in code to find the UI element you're after.
I hope that gives you some idea how to implement a test that will achieve your goal.
Cody
the Telerik team
Test Studio Trainings
Glad to hear it! Thank you for the update.
Greetings,Cody
the Telerik team
Test Studio Trainings