locked
Passing SQL query to a web request? RRS feed

  • Question

  • Dear all,

     

    I want to attach a SQL query to web request so-that query results are passed to a data field and these data will be used to run the test for no of iterations ,instead of passing data from CSV,XML,Data sources.

    Would like to know is it possible if so advice me the way to follow for this?

     

    Thanks in advance.

    Swaroop

    Wednesday, January 28, 2009 8:44 AM

Answers

  • Hi Swaroop 

    Could you describe the scenario in more detail? To extend web request, you can use custom web test request plug-in.

     

    I don't think passing a SQL query via HTTP to let the server execute is a good approach. Other people may pass the dangerous SQL commands too. Usually, we expose web services encapsulating business logic in the server and let clients to invoke.


    Please mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by kasireddy Tuesday, February 3, 2009 12:44 PM
    Friday, January 30, 2009 3:10 AM
  • You can create a datasource that binds to a either a sql table or view, but you can pass parameters.  So if binding to a view is good enough, that would work.  If you need to pass parameters to the select, then you would need to create a custom data binding plugin.  I have a blog post with an example: http://blogs.msdn.com/slumley/pages/custom-data-binding-in-web-tests.aspx
    Blog - http://blogs.msdn.com/slumley/default.aspx
    Friday, January 30, 2009 4:03 PM
    Moderator

All replies

  • Hi Swaroop 

    Could you describe the scenario in more detail? To extend web request, you can use custom web test request plug-in.

     

    I don't think passing a SQL query via HTTP to let the server execute is a good approach. Other people may pass the dangerous SQL commands too. Usually, we expose web services encapsulating business logic in the server and let clients to invoke.


    Please mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by kasireddy Tuesday, February 3, 2009 12:44 PM
    Friday, January 30, 2009 3:10 AM
  • Hi Bill,

     

    Thanks for your reply.

    Usvally we pass data using CSV files.but we have scenarios where input to csv files is more dynamic which changes in between test runs.

    we thought if we fire sql query and can resultant data to be passed to data field and scripts to be executed.

    Wants to know if we can attach SQL query to webrequest data field value or not? if so how?

     

    Regards,

    Swaroop

    • Marked as answer by kasireddy Tuesday, February 3, 2009 12:44 PM
    • Unmarked as answer by kasireddy Tuesday, February 3, 2009 12:44 PM
    Friday, January 30, 2009 6:18 AM
  • You can create a datasource that binds to a either a sql table or view, but you can pass parameters.  So if binding to a view is good enough, that would work.  If you need to pass parameters to the select, then you would need to create a custom data binding plugin.  I have a blog post with an example: http://blogs.msdn.com/slumley/pages/custom-data-binding-in-web-tests.aspx
    Blog - http://blogs.msdn.com/slumley/default.aspx
    Friday, January 30, 2009 4:03 PM
    Moderator
  • Thanks for Bill and Slumley.
    • Proposed as answer by Qing_zhang Wednesday, November 21, 2012 6:38 AM
    Tuesday, February 3, 2009 12:44 PM