Pass parameter with script name

6 posts, 0 answers
  1. Anshul
    Anshul avatar
    16 posts
    Member since:
    Sep 2010

    Posted 20 Dec 2010 Link to this post

    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
  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 21 Dec 2010 Link to this post

    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
  3. Anshul
    Anshul avatar
    16 posts
    Member since:
    Sep 2010

    Posted 03 Jan 2011 Link to this post

    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.
  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 03 Jan 2011 Link to this post

    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
  5. Anshul
    Anshul avatar
    16 posts
    Member since:
    Sep 2010

    Posted 12 Jan 2011 Link to this post

    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
  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 12 Jan 2011 Link to this post

    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
Back to Top