Forum Discussion

nakshatra's avatar
nakshatra
Contributor
6 years ago

how to change DB connection string dynamically

Hi all,

 

I automated nearly 100 test cases by using test complete. Used 20 variables to read the data from external data sources.

In this 11 variables are used for fetching data from Sql Data Base. We have three different environments(Test,UAT,Live)

If i want to run the test cases in UAT(or) Live need to change database connection string 11 times in 11 variables.

 

Is there any way to do in effeicient way or is there any process in one place if i change the connection string it should get reflect in 11 variables.

 

Thanks in advance.

 

Regards,

Nakshatra.

  • You shouldn't need to store your connection string in several different places.  If the connection string is common, then you can store that in a single variable and consume that in all the places you need.

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    You shouldn't need to store your connection string in several different places.  If the connection string is common, then you can store that in a single variable and consume that in all the places you need.

    • nakshatra's avatar
      nakshatra
      Contributor

      Thanks for the reply.

       

      here I am using 11 variables and 11 different queries and same connection string.

       

      Could  you please expalin me how to use single variable in all places. It will be helpfull.

       

      Regards,

      Nakshatra.

       

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        I'm not sure I understand the question.  You set up a global variable and store your connection string in there and utilize that in your tests.

         

        It might be helpful to know a bit more about how you're setting things up.  Are these Keyword tests that you're doing a DB connection for a data driven loop?  Please give us an example of one of these 11 situations and we can, perhaps, answer your question in grated detail.