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

Pass parameter with script name

5 Answers 127 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Anshul
Top achievements
Rank 1
Anshul asked on 20 Dec 2010, 09:05 AM
Hi Telrik Team,

I want to make my script with dynamic databinding,for example my script will take dynamic ids passed in script test step of other script.

Example:
Pass parameters with telerik script name
e.g. Script1(Parameter Name).aii
call Script1 from Script2 in test step.

If you can suggest any other solution for dynamic databinding of IDs with script, then it will be the productive use of SQL databinding.
I am waiting for response.
Thanks in Advance.

Regards,
Anshul

5 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 22 Dec 2010, 04:51 AM
Hello Anshul,

Try following this KB article along with the sample test I have attached. See if this approach will work for you.

All the best,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Anshul
Top achievements
Rank 1
answered on 03 Jan 2011, 07:13 AM
Hi Cody..

Thanks for the reponse..and 'Happy New Year to Telerik Team'
i have tried same as the example which you have posted..but i have already mentioned that i want to 'SQL Databind'
i am still unable to do it...if you can suggest any solutions then it will be the great help..

Thanks in Advance.
Anshul.
0
Cody
Telerik team
answered on 03 Jan 2011, 08:32 PM
Hello Anshul,

My apologies. I missed the part about wanting to use SQL.

Let me see if I understand correctly... you want to change which SQL database/table is bound to a subtest based on which parent test is executing, is that correct?

It is not possible to change what database & table a subtest is actively bound to, but in the SQL world I can think of a couple of alternatives:

  1. Bind the subtest to some temp/scratch table. Make the parent test fill this table with the data you want the subtest to actually use. Then call the subtest. It will now use this new data you just put in the table it draws from.
  2. Use T-SQL in the subtest to pull the correct dataset. If needed you can have the parent test set some value somewhere in some table that the T-SQL can use so it can pull the right data from your database.

Best wishes,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
0
Anshul
Top achievements
Rank 1
answered on 12 Jan 2011, 11:13 AM
Hey Cody...
thanks for the reply..

i am using T-SQL only to pull the correct data in script.....but the limitation is every time i have to filter the records for scripts
i want to send PK(primary key) with one parent test which will be used by many subtest to pull data using T-SQL...

i understood your solutions but how to do it?? i dont have any clue...Please suggest any solution.

Thanks,
Anshul
0
Cody
Telerik team
answered on 13 Jan 2011, 04:33 AM
Hello Anshul,

We aren't SQL experts, but one approach that comes to my mind is to create one table in your database that contains all of the data. Have one column in this table (let's call it "testid") which identifies which test set it belongs to. Let's just say you put in it the values 1 - 10. Then you have another table with just a single row and also a testid column. The parent test writes the value 1 - 10 in this testid column. Then in your T-SQL you do a join between the two tables along with a where clause. The where clause says where table1.testid = table2.testid.

Taking this approach the parent test can very effectively control the T-SQL filtering that the subtest will do via your join and where clause. You can easily expand on this and use a two or more column join if your filtering needs to be more complex than a single value comparison. Does that make sense?

Kind regards,
Cody
the Telerik team
Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
Tags
General Discussions
Asked by
Anshul
Top achievements
Rank 1
Answers by
Cody
Telerik team
Anshul
Top achievements
Rank 1
Share this question
or