
上QQ阅读APP看书,第一时间看更新
Global variables
Global variables are generally static in nature, can be initialized at the start of a test, and remain available throughout the entire test run. Variables for application defaults, timeouts, property file locations, paths, and so on can be stored in this class. To be clear, test data is not stored in this class. Test data will be encapsulated in a different file format, and will be discussed in later chapters. Here is an example of some default global variables:
/**
* Global Variable Class
*
* @author Author
*
*/
public class Global_VARS {
// target app defaults
public static final String BROWSER = "firefox";
public static final String PLATFORM = "Windows 10";
public static final String ENVIRONMENT = "local";
public static String DEF_BROWSER = null;
public static String DEF_PLATFORM = null;
public static String DEF_ENVIRONMENT = null;
public static String PROPS_PATH = null;
// driver class defaults
public static String propFile = "../myPath/selenium.props";
public static final String SE_PROPS =
new File(propFile).getAbsolutePath();
// test output path defaults
public static final String TEST_OUTPUT_PATH = "testOutput/";
public static final String LOGFILE_PATH = TEST_OUTPUT_PATH +
"Logs/";
public static final String REPORT_PATH = TEST_OUTPUT_PATH +
"Reports/";
public static final String BITMAP_PATH = TEST_OUTPUT_PATH +
"Bitmaps/";
// timeout defaults
public static final int TIMEOUT_MINUTE = 60;
public static final int TIMEOUT_SECOND = 1;
public static final int TIMEOUT_ZERO = 0;
}