Here is something from a book that I am writing on Selenium.
It is sometimes desirable to use a different base URL for different
circumstances. For example,
you could have several different instances of your application under
test installed on the web
server, and have different clients test each of these different
instances.
Let's say that our web server is
test_server.com, and each of the
instances are installed at
instance1, instance2, and so on. Unfortunately, the Test Runner HTA
ignores the baseURL
parameter that is passed to it. To get around this, I have something
like the following .bat
script start a test run.
rem Somehow decide how the different clients will be distinguished
from each
rem other. Based on that, define a variable called baseURL.
Alternatively set
this
rem variable by hand for each client. Don't forget the trailing slash.
set baseURL=
http://test_server.com/instance1/
rem Next, write the variable to a file, that has JavaScript syntax.
echo baseURL = "%baseURL%"; > baseURL.js
rem Lastly start the tests, as disucssed in previous chapter.
set SELENIUM_HOME=%USERPROFILE%\Selenium
set ARGUMENTS=test=file:///%SELENIUM_HOME
%\tests\GoogleTestSuite.html^&auto=true
"%SELENIUM_HOME%\seleniumcore1.0.1\
core\TestRunner.hta" "%ARGUMENTS%"
You will have to make sure that each of your tests contains the
following code. This will have to
be added by hand; Selenium has no automatic way of adding something
like this.
<HEAD>
<SCRIPT LANGUAGE="javascript" SRC="baseURL.js"></SCRIPT>
</HEAD>
After this, inside the tests, you can open this location by going:
<tr>
<td>store</td>
<td><SCRIPT
LANGUAGE="javascript">document.writeln(baseURL);</SCRIPT></td>
<td>baseURL</td>
</tr>
<tr>
<td>open</td>
<td>${baseURL}Login</td>
<td></td>
</tr>
Using this technique, it is possible to pass information into each of
the tests from the calling
environment.