To parameterize test suites, an autostart argument can be passed when
- Molybdenum is integrated in your CI environment or
- Molybdenum comes up after user has clicked a link to a testsuite or
- Molybdenum is already running and user enters an URL into the autostart argument textbox seen in the GUI
The value of this argument can be accessed like a normal selenium variable using the ${...} notation. The name of the variable is autostartArgument, means you have to use ${autostartArgument}.
Sometimes it is not enough to have one parameter. Than you can use XML property files. XML property files are loaded by executing the command loadVars. The URL of the property file is passed as argument. Using URLs gives the possibility to load your variables from a centrally accessible web server as well as from local file system.
If the path to the variable file is not fixed, you can use the autostartArgument here. If you combine those two concepts, it looks like this:
- Start Molybdenum by passing the url of your variable file as autostart argument:
firefox --no-remote -P mytestprofile -mo mytestsuite.xml -autostartarg file:///home/johndo/variables.xml
resp.
firefox --no-remote -P mytestprofile -mo mytestsuite.xml -autostartarg http://my.url/variables.xml
- load the variable file once at the beginning of your test suite:
loadVars ${autostartArgument}
You can easily write your own variable files:
<molybdenum-variables> <var1>value1</var1> <var2>value2</var2> <molybdenum-variables>
In fact, the name of the root element doesn't matter. Inside the root element, a list of elements is following. each element is one variable: The element name is the variable name and the content of the element is the variable value.
the variables can be accessed following the ${...} notation.
Note: For convenience reason, Molybdenum stores the autostartArguments being used in your user profile. When using different XML property files for different environments or branches via the autostartArgument hook, you can easily switch between different variable sets in the GUI when executing the testcase.
