Execute a database script before or during test execution

3 posts, 1 answers
  1. David
    David avatar
    4 posts
    Member since:
    Mar 2013

    Posted 19 Apr 2013 Link to this post

    Hello again,

    I would like to be able to run a database script before a test executes or even during test execution would be great.
    I was wondering if it was possible.

    For example, In my website I need to log in as a certain user to access their roles and privileges, but this user might be logged into the system.  So, I would like to be able to run a database script that terminates their session and it would allow me to log in as that user before my test executes.

    Thanks for any help provided.
  2. Answer
    David
    David avatar
    4 posts
    Member since:
    Mar 2013

    Posted 19 Apr 2013 Link to this post

    I found a basic solution that I could use here for those who may have similar questions.

    http://www.telerik.com/automated-testing-tools/support/documentation/user-guide/code-samples/general/access-sql-database.aspx
  3. Byron
    Admin
    Byron avatar
    184 posts

    Posted 22 Apr 2013 Link to this post

    Hi David,

    This is the correct solution: in code, create a SqlCommand object containing the query to execute the database script and send the query to the database. Please let us know if we can help you further.

    All the best,
    Byron
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top