I have a Test Studio Standalone project with a database Data Source. I've written a coded step that inserts test data directly into the database, since this particular data cannot be created directly from the UI with a recorded step. Currently, the DB ConnectionString is hard-coded in this step's code, but I would like it to be dynamic by using the same ConnectionString as the existing Data Source. Is this possible?
I've tried binding the Data Source to the coded step then using Reflection to find the connection strings in the current configuration, but the ConnectionString from the Data Source was not in there. Probably because it only works from an explicit app.config file (in Visual Studio project), which I do not have.
Is there a way to programmatically retrieve the connection string, or do I need to take another approach?
Perhaps my best option is to have a utility class to store connection strings globally accessible to all coded steps? If I do this, is there a way to programmatically retrieve the BaseURL setting for it to determine which connection string is appropriate based on which machine/environment the tests are running in?
Thanks for any input and suggestions.