page_type | languages | products | urlFragment | |||
---|---|---|---|---|---|---|
sample |
|
|
developer-loadtesting-samples |
This document explains samples and how to use them.
Following section document various examples.
- HelloWorld.java - Contains samples for following scenarios:
- Authenticate client
- Create Load Test
- Upload Test File
- Create and start Test Run, and get metrics
- ListOperations.java and ListOperationsAsync.java - Contains samples for following scenarios:
- List Load Tests
- List Test Runs
- List Load Test files
- LongRunningOperations.java and LongRunningOperationsAsync.java - Contains samples for following scenarios:
- Upload and validate Load Test file
- Start and monitor Test Run
Load Testing clients raise exceptions. For example, if you try to get a load test or test run resource after it is deleted a 404
error is returned, indicating resource not found. In the following snippet, the error is handled gracefully by catching the exception and displaying additional information about the error.
try {
testRunClient.getTestRunWithResponse("FAKE_TEST_RUN_ID", null);
} catch (ResourceNotFoundException e) {
System.out.println(e.getMessage());
}