Tellurium use a configuration file TelluriumConfig.groovy to configure
the framework. Do not be panic to see that it is a groovy file. Yes,
it is a groovy file, but it is parsed by the framework as a text file.
For you, just treat it as a text file with some rules such as using
"{" and "}" for a block. Look at a snippet of configuration
tellurium{
//embedded selenium server configuration
embeddedserver {
//port number
port = "4444"
//whether to use multiple windows
useMultiWindows = false
//whether to run the embedded selenium server. If false, you
need to manually set up a selenium server
runInternally = true
}
//event handler
eventhandler{
//whether we should check if the UI element is presented
checkElement = true
//wether we add additional events like "mouse over"
extraEvent = true
}
...
}
Obviously, "//" is used for comments.
You may wonder how Tellurium parses the configuration file. Take a
look at the class org.tellurium.config.TelluriumConfigParser and you
will see Tellurium actually uses Groovy ConfigSlurper class to achieve
this. Groovy site says "ConfigSlurper is a utility class within
Groovy for writing properties file like scripts for performing
configuration. Unlike regular Java properties files ConfigSlurper
scripts support native Java types and are structured like a tree".
Here is the link for more details:
http://groovy.codehaus.org/ConfigSlurper
The good thing is that you can group settings and put them inside
blocks using "{" and "}" like the "embeddedserver " and "eventhandler"
in the above snippet.
The nested settings will be turned into a ConfigObject type object,
which is basically a nested map so that
if you look the the following properties, you will get back the values
for them,
conf.tellurium.embeddedserver.port
conf.tellurium.embeddedserver.useMultiWindows
conf.tellurium.embeddedserver.runInternally
That is to say, inside Tellurium the value for the given property will
be reached by directly referring to
"conf.tellurium.embeddedserver.port".
For instance,
ConfigObject conf = new ConfigSlurper().parse(new
File(fileName).toURL())
protected void configEmbeededServer(EmbeddedSeleniumServer server) {
server.setProperty("port",
Integer.parseInt(conf.tellurium.embeddedserver.port))
server.setProperty("useMultiWindows",
conf.tellurium.embeddedserver.useMultiWindows)
server.setProperty("runSeleniumServerInternally",
conf.tellurium.embeddedserver.runInternally)
}