Last updated January 21, 2011 12:24, by Jørgen Austvik
Feedicon  

How to give Settings Values

JET, JAG and JETBatch are highly configurable with bindings. The name binding comes from formal definitions of functional programming, where a binding is where a name/variable is given a value in a given context, see http://en.wikipedia.org/wiki/Name_binding. These bindings are often also referred to as settings or properties. Both the infrastructure and the tests will adjust their behavior based on these settings.

This page explain how to give these settings values.

Places to give the settings values

There are many places to give settings values. This list is arranged so that elements further down the list overwrite setting values higer up in the list.

jetdefault.properties

jetdefaults.properties is a java properties file that lives inside the JET repository. Here default values for a lot of settings is stored.

testsuite_jetdefaults.properties

testsuite_jetdefaults.properties is the testsuite version of jetdefaults_properties. It contains settings that are only needed in a single test suite, or new values for the settings from jetdefaults.properties.

JETBatch property files

JETBatch take a list of -propfile command line parameter. This is a convenient place to set values for the given batch, user running the test or the tests to be run.

JET property files

JET take the -b command line parameter to specify a property file with setting it will use.

generated.properties

When JETBatch start JET, it will create a generated.properties which contains settings it will give to JET, which it will send to JET using the -b command line parameter.

System properties

The Java runtine can take the -D command line parameter. Use this if you want to just overwrite a single setting from the command line when you start JAG, JET or JETBatch, e.g. for experimenting.

Batch property file

In the bach property file, you can change settings for a individual test. Here is an example:

 batch.test.<test_name>.<property>=<value>

See WriteBatch for more information about writing batch files.

Test XML file

In the test XML file, you can use %lt;Binding%gt; elements to give values for test setups, test suites and test cases. If you set a value at test setup or test suite level, all the test cases, suites and setups nested below this level in the hierarchy will get the setting.

See WriteTest for more information about writing test XML files.

Where to set the settings

While every setting can be adjusted all the places, not every setting will take effect everywhere. For example if there is a setting that JETBatch uses, like batch.test.*, and you set it in the test XML file, then it will not have any effect.

Create new settings

If you want to create new settings for your test suite, you should place them with default values in the testsuite_jetdefaults.properties. If you do not want to give the setting a default value, you can give it the special null value, which is different from "empty string".

For settings where you do not know all the settings names in advance, you can write a Validator. Read more about validators in WriteTestSuite If you try to access (get/set) properties that does not exist neither in jetdefaults.properties, nor testsuite_jetdefaults.properties, the test framework will throw an exception warning about the unknown exception unless you have a Validator. This was added because we had problems with small spelling mistakes in bindings.

  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close