public class TestPropertiesDefinition extends Object
Class that defines (and allows manipulating) test properties. Test properties
are loaded from a .properties file. Two files should exist on
the project's base directory (or somewhere in the classpath): a file named
testdata-project.properties and a file named
testdata-local.properties. The former contains all properties
that are general in the project (common for all users) and the latter
overrides some properties that are specific for each user. This class
contains a method to load these properties as system properties. It also
provides utility methods to access those properties.
This class is not usually accessed directly but through the
AbstractTestHelper class by using any test helpers. However, test
classes that do not use helpers may use this class directly. Before being
used, the class must be initialized through the
load_global_properties() method. This method is automatically
invoked by the DefaultTCase class during test fixture preparation.
The testdata-local.propertiers file is optional (and, if it
exists, should not be added to source control) but the
testdata-project.properties is mandatory.
| Modifier and Type | Method and Description |
|---|---|
static double |
getDouble(String key)
Obtains a property which must exist and be a double number.
|
static int |
getInt(String key)
Obtains a property which must exist and be an integer number.
|
static String |
getMString(String key)
Obtains a property as a string.
|
static void |
load_global_properties()
Loads the test properties (if not already done).
|
public static void load_global_properties()
throws Exception
Exception - failed to load propertiespublic static String getMString(String key)
key - the property namepublic static int getInt(String key)
key - the property namepublic static double getDouble(String key)
key - the property nameCopyright © 2015. All rights reserved.