public class TestableSelenium
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CHROME_BINARY_PATH |
static java.lang.String |
FIREFOX_BINARY_PATH |
static java.lang.String |
GLOBAL_CLIENT_INDEX |
static java.lang.String |
ITERATION |
static java.lang.String |
OUTPUT_DIR |
static java.lang.String |
PROFILE_DIR |
static java.lang.String |
PROXY_AUTOCONFIG_URL |
static java.lang.String |
REGION_NAME |
static java.lang.String |
RESULT_FILE |
static int |
SELENIUM_PORT |
| Constructor and Description |
|---|
TestableSelenium() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.Map<java.lang.String,java.lang.Object> |
collectPerformanceMetrics(org.openqa.selenium.WebDriver driver)
Collect some useful browser performance metrics by executing some Javascript in the browser.
|
static void |
log(TestableLog.Level level,
java.lang.String msg)
Log a message into the test results at the chosen level.
|
static void |
log(TestableLog.Level level,
java.lang.Throwable cause)
Log an exception into the test results at the chosen level.
|
static org.openqa.selenium.WebDriver |
newWebDriver(org.openqa.selenium.Capabilities capabilities)
Create a
RemoteWebDriver instance that is compatible with Testable. |
static TestableCSVReader |
readCsv(java.lang.String path)
Read data from a CSV uploaded to your scenario.
|
static void |
reportMetric(TestableMetric metric)
Report a custom metric into the test results.
|
static TestableTest |
startTest(java.lang.String name)
Start a new set of test steps that you want to record and view in the Assertions widget within the Testable
test results.
|
static java.nio.file.Path |
takeScreenshot(org.openqa.selenium.WebDriver driver,
java.lang.String name)
Takes a screenshot of the current browser and copies it to the appropriate output directory to be picked up
by the test runner (found at the OUTPUT_DIR system property).
|
public static final int SELENIUM_PORT
public static final java.lang.String OUTPUT_DIR
public static final java.lang.String REGION_NAME
public static final java.lang.String GLOBAL_CLIENT_INDEX
public static final java.lang.String ITERATION
public static final java.lang.String PROXY_AUTOCONFIG_URL
public static final java.lang.String CHROME_BINARY_PATH
public static final java.lang.String FIREFOX_BINARY_PATH
public static final java.lang.String PROFILE_DIR
public static final java.lang.String RESULT_FILE
public static org.openqa.selenium.WebDriver newWebDriver(org.openqa.selenium.Capabilities capabilities)
RemoteWebDriver instance that is compatible with Testable. All this means is that the URL
will be http://localhost:[port]/wd/hub where [port] is passed from Testable to the Selenium process as
the SELENIUM_PORT system property. When run locally outside Testable, the default Selenium port (4444) is used.capabilities - Capabilities to utilizepublic static java.nio.file.Path takeScreenshot(org.openqa.selenium.WebDriver driver,
java.lang.String name)
driver - The WebDriver instancename - Name of the file to use. Actual file name when run on Testable will be
[region_name]-[virtual_user]-[test_iteration]-[name] so you have context on which region,
virtual user, and iteration of the test this image is associated with.public static void reportMetric(TestableMetric metric)
TestableSelenium.reportMetric(TestableMetric.newCounterBuilder()
.withName("My Request Counter")
.withVal(1)
.withUnits("requests")
.build());
metric - public static void log(TestableLog.Level level, java.lang.String msg)
level - The logging levelmsg - The message to log.public static void log(TestableLog.Level level, java.lang.Throwable cause)
level - The logging levelcause - The exception to logpublic static java.util.Map<java.lang.String,java.lang.Object> collectPerformanceMetrics(org.openqa.selenium.WebDriver driver)
driver - The WebDriver instancepublic static TestableCSVReader readCsv(java.lang.String path) throws java.io.IOException
TestableCSVReader for more details of the available API.
When run locally, the CSV will be loaded from the local classpath.path - Path to your CSV file. Relative to the classpath or working directory.TestableCSVReader instance to access the contents of the CSV in various ways.java.io.IOExceptionpublic static TestableTest startTest(java.lang.String name)
name - The name of the test.