visual studio .net enterprise tools:
I'm using Visual Studio 2005 Team Edition for Testers. I create a web test
script (webtest1.webtest) and record several http steps. Then I add a data
source directly in the web test (not the project/solution) which uses the Jet
4.0 OLE DB Provider. The data source includes an absolute path to a local
MSAccess mdb file, such as
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\projectpath\XML.mdb;Persist
Security Info=False
When the web test runs, it connects to the mdb, gets the first record from a
table, uses that data for certain http parameters, repeat for next record(s)
until done. It all works fine on my PC, so I save the files to Source
Control.
But when I retrieve the files from Source Control to another PC which has a
different project path (C:\otherpath\projectpath), the web test cannot run
because it can't find the mdb file. In the Visual Studio IDE the connection
string property in the .webtest script is read-only so I can't modify it. I
tried using a text editor to modify that property in the script, but the
actual connection string seems to be stored encrypted.
I also tried creating a new data source with a relative path in the
connection string such as Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=XML.mdb;Persist Security Info=False. That works for test creation but
not execution; VS apparently uses a different working directory for test
execution results, and the mdb file is not found there.
So far I have only found 2 workarounds, and both are messy:
1. Require all the local project files (including mdb) to exist at the same
absolute path on all computers.
2. On each computer, remove the data source and all field bindings in each
web test, then remake the data source and reconnect all the bindings (not
practical).
I would like to know if there is a way to specify a dynamic (non-literal)
path in the connection string that points to the project directory, such as:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source={ProjectDir}XML.mdb;Persist
Security Info=False