简体   繁体   中英

Common settings file for multiple projects in a solution

Visual Studio project structure - https://www.box.com/s/np59x20f939n3z1g5dvc

I have multiple projects A, B, etc. that have load tests (which in turn call respective web tests) and a settings file separately for each one of them. I am using these settings files to store the info about web servers.

[Settings.xml]

<?xml version="1.0" encoding="utf-8" ?>
<AppSettings>
  <WebServer>www.abc.com</WebServer>
  <Proxy></Proxy>
</AppSettings>

I am adding this xml file as a data source in the web test as shown here https://www.box.com/s/53vy0ryvye53m76abuun

Project C has a load test that calls upon web tests from other projects (I am only referring to the projects A, B, etc. here). The setting file for project C looks like this.

<?xml version="1.0" encoding="utf-8" ?>
<AppSettings>
  <WebServer>www.SomeOtherWebsite.com</WebServer>
  <Proxy></Proxy>
</AppSettings>

I want this settings file to be used for running the Loadtest-C ie this settings file has to override the individual settings file from each project.

I want to run LoadTest-C sometimes and LoadTest-A or LoadTest-B sometimes. So, I don't want to change the individual settings files everytime.

Is there a way I can achieve this?

I found using xml files to be the simpler way. But, please do suggest me if there is a better way.

I have searched online and the only thing I found relevant was this - common Settings.settings file for entire solution . I have a lot of projects similar to A, B, etc. and I don't want to change the links in each and every project as suggested in the answer there.

[I have never tried coded web tests. So I am not sure if that approach works.] [and i am relatively new to performance testing]

I have found a solution for this. Instead of using the Settings.xml file, I am adding the entries in that xml file as context parameters to the load test and eliminating the use of data source in individual web tests. So when I run the web test, the parameter it has for web server name is being supplied by the context parameter in the load test.

This might not be the best solution, but this seems to work for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM