Class TestCasesClient (0.43.0)

GitHub RepositoryProduct ReferenceREST DocumentationRPC Documentation

Service Description: Service for managing Test Cases and Test Case Results.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   testCasesClient.batchDeleteTestCases(parent);
 }
 

Note: close() needs to be called on the TestCasesClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of TestCasesSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TestCasesSettings testCasesSettings =
     TestCasesSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 TestCasesClient testCasesClient = TestCasesClient.create(testCasesSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TestCasesSettings testCasesSettings =
     TestCasesSettings.newBuilder().setEndpoint(myEndpoint).build();
 TestCasesClient testCasesClient = TestCasesClient.create(testCasesSettings);
 

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 TestCasesSettings testCasesSettings = TestCasesSettings.newHttpJsonBuilder().build();
 TestCasesClient testCasesClient = TestCasesClient.create(testCasesSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > TestCasesClient

Static Methods

create()

public static final TestCasesClient create()

Constructs an instance of TestCasesClient with default settings.

Returns
TypeDescription
TestCasesClient
Exceptions
TypeDescription
IOException

create(TestCasesSettings settings)

public static final TestCasesClient create(TestCasesSettings settings)

Constructs an instance of TestCasesClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsTestCasesSettings
Returns
TypeDescription
TestCasesClient
Exceptions
TypeDescription
IOException

create(TestCasesStub stub)

public static final TestCasesClient create(TestCasesStub stub)

Constructs an instance of TestCasesClient, using the given stub for making calls. This is for advanced usage - prefer using create(TestCasesSettings).

Parameter
NameDescription
stubTestCasesStub
Returns
TypeDescription
TestCasesClient

Constructors

TestCasesClient(TestCasesSettings settings)

protected TestCasesClient(TestCasesSettings settings)

Constructs an instance of TestCasesClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsTestCasesSettings

TestCasesClient(TestCasesStub stub)

protected TestCasesClient(TestCasesStub stub)
Parameter
NameDescription
stubTestCasesStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

batchDeleteTestCases(AgentName parent)

public final void batchDeleteTestCases(AgentName parent)

Batch deletes test cases.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   testCasesClient.batchDeleteTestCases(parent);
 }
 
Parameter
NameDescription
parentAgentName

Required. The agent to delete test cases from. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

batchDeleteTestCases(BatchDeleteTestCasesRequest request)

public final void batchDeleteTestCases(BatchDeleteTestCasesRequest request)

Batch deletes test cases.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   BatchDeleteTestCasesRequest request =
       BatchDeleteTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   testCasesClient.batchDeleteTestCases(request);
 }
 
Parameter
NameDescription
requestBatchDeleteTestCasesRequest

The request object containing all of the parameters for the API call.

batchDeleteTestCases(String parent)

public final void batchDeleteTestCases(String parent)

Batch deletes test cases.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   testCasesClient.batchDeleteTestCases(parent);
 }
 
Parameter
NameDescription
parentString

Required. The agent to delete test cases from. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

batchDeleteTestCasesCallable()

public final UnaryCallable<BatchDeleteTestCasesRequest,Empty> batchDeleteTestCasesCallable()

Batch deletes test cases.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   BatchDeleteTestCasesRequest request =
       BatchDeleteTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .addAllNames(new ArrayList<String>())
           .build();
   ApiFuture<Empty> future = testCasesClient.batchDeleteTestCasesCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<BatchDeleteTestCasesRequest,Empty>

batchRunTestCasesAsync(BatchRunTestCasesRequest request)

public final OperationFuture<BatchRunTestCasesResponse,BatchRunTestCasesMetadata> batchRunTestCasesAsync(BatchRunTestCasesRequest request)

Kicks off a batch run of test cases.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: BatchRunTestCasesMetadata - response: BatchRunTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   BatchRunTestCasesRequest request =
       BatchRunTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setEnvironment(
               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
                   .toString())
           .addAllTestCases(new ArrayList<String>())
           .build();
   BatchRunTestCasesResponse response = testCasesClient.batchRunTestCasesAsync(request).get();
 }
 
Parameter
NameDescription
requestBatchRunTestCasesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<BatchRunTestCasesResponse,BatchRunTestCasesMetadata>

batchRunTestCasesCallable()

public final UnaryCallable<BatchRunTestCasesRequest,Operation> batchRunTestCasesCallable()

Kicks off a batch run of test cases.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: BatchRunTestCasesMetadata - response: BatchRunTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   BatchRunTestCasesRequest request =
       BatchRunTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setEnvironment(
               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
                   .toString())
           .addAllTestCases(new ArrayList<String>())
           .build();
   ApiFuture<Operation> future = testCasesClient.batchRunTestCasesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<BatchRunTestCasesRequest,Operation>

batchRunTestCasesOperationCallable()

public final OperationCallable<BatchRunTestCasesRequest,BatchRunTestCasesResponse,BatchRunTestCasesMetadata> batchRunTestCasesOperationCallable()

Kicks off a batch run of test cases.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: BatchRunTestCasesMetadata - response: BatchRunTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   BatchRunTestCasesRequest request =
       BatchRunTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setEnvironment(
               EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
                   .toString())
           .addAllTestCases(new ArrayList<String>())
           .build();
   OperationFuture<BatchRunTestCasesResponse, BatchRunTestCasesMetadata> future =
       testCasesClient.batchRunTestCasesOperationCallable().futureCall(request);
   // Do something.
   BatchRunTestCasesResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<BatchRunTestCasesRequest,BatchRunTestCasesResponse,BatchRunTestCasesMetadata>

calculateCoverage(CalculateCoverageRequest request)

public final CalculateCoverageResponse calculateCoverage(CalculateCoverageRequest request)

Calculates the test coverage for an agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   CalculateCoverageRequest request =
       CalculateCoverageRequest.newBuilder()
           .setAgent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   CalculateCoverageResponse response = testCasesClient.calculateCoverage(request);
 }
 
Parameter
NameDescription
requestCalculateCoverageRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
CalculateCoverageResponse

calculateCoverageCallable()

public final UnaryCallable<CalculateCoverageRequest,CalculateCoverageResponse> calculateCoverageCallable()

Calculates the test coverage for an agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   CalculateCoverageRequest request =
       CalculateCoverageRequest.newBuilder()
           .setAgent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   ApiFuture<CalculateCoverageResponse> future =
       testCasesClient.calculateCoverageCallable().futureCall(request);
   // Do something.
   CalculateCoverageResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CalculateCoverageRequest,CalculateCoverageResponse>

close()

public final void close()

createTestCase(AgentName parent, TestCase testCase)

public final TestCase createTestCase(AgentName parent, TestCase testCase)

Creates a test case for the given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   TestCase testCase = TestCase.newBuilder().build();
   TestCase response = testCasesClient.createTestCase(parent, testCase);
 }
 
Parameters
NameDescription
parentAgentName

Required. The agent to create the test case for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

testCaseTestCase

Required. The test case to create.

Returns
TypeDescription
TestCase

createTestCase(CreateTestCaseRequest request)

public final TestCase createTestCase(CreateTestCaseRequest request)

Creates a test case for the given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   CreateTestCaseRequest request =
       CreateTestCaseRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setTestCase(TestCase.newBuilder().build())
           .build();
   TestCase response = testCasesClient.createTestCase(request);
 }
 
Parameter
NameDescription
requestCreateTestCaseRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestCase

createTestCase(String parent, TestCase testCase)

public final TestCase createTestCase(String parent, TestCase testCase)

Creates a test case for the given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   TestCase testCase = TestCase.newBuilder().build();
   TestCase response = testCasesClient.createTestCase(parent, testCase);
 }
 
Parameters
NameDescription
parentString

Required. The agent to create the test case for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

testCaseTestCase

Required. The test case to create.

Returns
TypeDescription
TestCase

createTestCaseCallable()

public final UnaryCallable<CreateTestCaseRequest,TestCase> createTestCaseCallable()

Creates a test case for the given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   CreateTestCaseRequest request =
       CreateTestCaseRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setTestCase(TestCase.newBuilder().build())
           .build();
   ApiFuture<TestCase> future = testCasesClient.createTestCaseCallable().futureCall(request);
   // Do something.
   TestCase response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateTestCaseRequest,TestCase>

exportTestCasesAsync(ExportTestCasesRequest request)

public final OperationFuture<ExportTestCasesResponse,ExportTestCasesMetadata> exportTestCasesAsync(ExportTestCasesRequest request)

Exports the test cases under the agent to a Cloud Storage bucket or a local file. Filter can be applied to export a subset of test cases.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: ExportTestCasesMetadata - response: ExportTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ExportTestCasesRequest request =
       ExportTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setFilter("filter-1274492040")
           .build();
   ExportTestCasesResponse response = testCasesClient.exportTestCasesAsync(request).get();
 }
 
Parameter
NameDescription
requestExportTestCasesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<ExportTestCasesResponse,ExportTestCasesMetadata>

exportTestCasesCallable()

public final UnaryCallable<ExportTestCasesRequest,Operation> exportTestCasesCallable()

Exports the test cases under the agent to a Cloud Storage bucket or a local file. Filter can be applied to export a subset of test cases.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: ExportTestCasesMetadata - response: ExportTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ExportTestCasesRequest request =
       ExportTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setFilter("filter-1274492040")
           .build();
   ApiFuture<Operation> future = testCasesClient.exportTestCasesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ExportTestCasesRequest,Operation>

exportTestCasesOperationCallable()

public final OperationCallable<ExportTestCasesRequest,ExportTestCasesResponse,ExportTestCasesMetadata> exportTestCasesOperationCallable()

Exports the test cases under the agent to a Cloud Storage bucket or a local file. Filter can be applied to export a subset of test cases.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: ExportTestCasesMetadata - response: ExportTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ExportTestCasesRequest request =
       ExportTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setFilter("filter-1274492040")
           .build();
   OperationFuture<ExportTestCasesResponse, ExportTestCasesMetadata> future =
       testCasesClient.exportTestCasesOperationCallable().futureCall(request);
   // Do something.
   ExportTestCasesResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ExportTestCasesRequest,ExportTestCasesResponse,ExportTestCasesMetadata>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

Gets information about a location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = testCasesClient.getLocation(request);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<GetLocationRequest,Location> getLocationCallable()

Gets information about a location.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future = testCasesClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final TestCasesSettings getSettings()
Returns
TypeDescription
TestCasesSettings

getStub()

public TestCasesStub getStub()
Returns
TypeDescription
TestCasesStub

getTestCase(GetTestCaseRequest request)

public final TestCase getTestCase(GetTestCaseRequest request)

Gets a test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   GetTestCaseRequest request =
       GetTestCaseRequest.newBuilder()
           .setName(
               TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
           .build();
   TestCase response = testCasesClient.getTestCase(request);
 }
 
Parameter
NameDescription
requestGetTestCaseRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestCase

getTestCase(TestCaseName name)

public final TestCase getTestCase(TestCaseName name)

Gets a test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCaseName name = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]");
   TestCase response = testCasesClient.getTestCase(name);
 }
 
Parameter
NameDescription
nameTestCaseName

Required. The name of the testcase. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/testCases/<TestCase ID>.

Returns
TypeDescription
TestCase

getTestCase(String name)

public final TestCase getTestCase(String name)

Gets a test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String name = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString();
   TestCase response = testCasesClient.getTestCase(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the testcase. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/testCases/<TestCase ID>.

Returns
TypeDescription
TestCase

getTestCaseCallable()

public final UnaryCallable<GetTestCaseRequest,TestCase> getTestCaseCallable()

Gets a test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   GetTestCaseRequest request =
       GetTestCaseRequest.newBuilder()
           .setName(
               TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
           .build();
   ApiFuture<TestCase> future = testCasesClient.getTestCaseCallable().futureCall(request);
   // Do something.
   TestCase response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetTestCaseRequest,TestCase>

getTestCaseResult(GetTestCaseResultRequest request)

public final TestCaseResult getTestCaseResult(GetTestCaseResultRequest request)

Gets a test case result.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   GetTestCaseResultRequest request =
       GetTestCaseResultRequest.newBuilder()
           .setName(
               TestCaseResultName.of(
                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
                   .toString())
           .build();
   TestCaseResult response = testCasesClient.getTestCaseResult(request);
 }
 
Parameter
NameDescription
requestGetTestCaseResultRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestCaseResult

getTestCaseResult(TestCaseResultName name)

public final TestCaseResult getTestCaseResult(TestCaseResultName name)

Gets a test case result.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCaseResultName name =
       TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]");
   TestCaseResult response = testCasesClient.getTestCaseResult(name);
 }
 
Parameter
NameDescription
nameTestCaseResultName

Required. The name of the testcase. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/testCases/<TestCase ID>/results/<TestCaseResult ID>.

Returns
TypeDescription
TestCaseResult

getTestCaseResult(String name)

public final TestCaseResult getTestCaseResult(String name)

Gets a test case result.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String name =
       TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
           .toString();
   TestCaseResult response = testCasesClient.getTestCaseResult(name);
 }
 
Parameter
NameDescription
nameString

Required. The name of the testcase. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/testCases/<TestCase ID>/results/<TestCaseResult ID>.

Returns
TypeDescription
TestCaseResult

getTestCaseResultCallable()

public final UnaryCallable<GetTestCaseResultRequest,TestCaseResult> getTestCaseResultCallable()

Gets a test case result.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   GetTestCaseResultRequest request =
       GetTestCaseResultRequest.newBuilder()
           .setName(
               TestCaseResultName.of(
                       "[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
                   .toString())
           .build();
   ApiFuture<TestCaseResult> future =
       testCasesClient.getTestCaseResultCallable().futureCall(request);
   // Do something.
   TestCaseResult response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetTestCaseResultRequest,TestCaseResult>

importTestCasesAsync(ImportTestCasesRequest request)

public final OperationFuture<ImportTestCasesResponse,ImportTestCasesMetadata> importTestCasesAsync(ImportTestCasesRequest request)

Imports the test cases from a Cloud Storage bucket or a local file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: ImportTestCasesMetadata - response: ImportTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ImportTestCasesRequest request =
       ImportTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   ImportTestCasesResponse response = testCasesClient.importTestCasesAsync(request).get();
 }
 
Parameter
NameDescription
requestImportTestCasesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<ImportTestCasesResponse,ImportTestCasesMetadata>

importTestCasesCallable()

public final UnaryCallable<ImportTestCasesRequest,Operation> importTestCasesCallable()

Imports the test cases from a Cloud Storage bucket or a local file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: ImportTestCasesMetadata - response: ImportTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ImportTestCasesRequest request =
       ImportTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   ApiFuture<Operation> future = testCasesClient.importTestCasesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ImportTestCasesRequest,Operation>

importTestCasesOperationCallable()

public final OperationCallable<ImportTestCasesRequest,ImportTestCasesResponse,ImportTestCasesMetadata> importTestCasesOperationCallable()

Imports the test cases from a Cloud Storage bucket or a local file. It always creates new test cases and won't overwrite any existing ones. The provided ID in the imported test case is neglected.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: ImportTestCasesMetadata - response: ImportTestCasesResponse

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ImportTestCasesRequest request =
       ImportTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   OperationFuture<ImportTestCasesResponse, ImportTestCasesMetadata> future =
       testCasesClient.importTestCasesOperationCallable().futureCall(request);
   // Do something.
   ImportTestCasesResponse response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ImportTestCasesRequest,ImportTestCasesResponse,ImportTestCasesMetadata>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listLocations(ListLocationsRequest request)

public final TestCasesClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

Lists information about the supported locations for this service.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : testCasesClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestCasesClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<ListLocationsRequest,ListLocationsResponse> listLocationsCallable()

Lists information about the supported locations for this service.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response = testCasesClient.listLocationsCallable().call(request);
     for (Location element : response.getLocationsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,TestCasesClient.ListLocationsPagedResponse> listLocationsPagedCallable()

Lists information about the supported locations for this service.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future = testCasesClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

listTestCaseResults(ListTestCaseResultsRequest request)

public final TestCasesClient.ListTestCaseResultsPagedResponse listTestCaseResults(ListTestCaseResultsRequest request)

Fetches the list of run results for the given test case. A maximum of 100 results are kept for each test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListTestCaseResultsRequest request =
       ListTestCaseResultsRequest.newBuilder()
           .setParent(
               TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   for (TestCaseResult element : testCasesClient.listTestCaseResults(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListTestCaseResultsRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestCasesClient.ListTestCaseResultsPagedResponse

listTestCaseResults(TestCaseName parent)

public final TestCasesClient.ListTestCaseResultsPagedResponse listTestCaseResults(TestCaseName parent)

Fetches the list of run results for the given test case. A maximum of 100 results are kept for each test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCaseName parent = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]");
   for (TestCaseResult element : testCasesClient.listTestCaseResults(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentTestCaseName

Required. The test case to list results for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/ testCases/<TestCase ID>. Specify a - as a wildcard for TestCase ID to list results across multiple test cases.

Returns
TypeDescription
TestCasesClient.ListTestCaseResultsPagedResponse

listTestCaseResults(String parent)

public final TestCasesClient.ListTestCaseResultsPagedResponse listTestCaseResults(String parent)

Fetches the list of run results for the given test case. A maximum of 100 results are kept for each test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String parent =
       TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString();
   for (TestCaseResult element : testCasesClient.listTestCaseResults(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The test case to list results for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>/ testCases/<TestCase ID>. Specify a - as a wildcard for TestCase ID to list results across multiple test cases.

Returns
TypeDescription
TestCasesClient.ListTestCaseResultsPagedResponse

listTestCaseResultsCallable()

public final UnaryCallable<ListTestCaseResultsRequest,ListTestCaseResultsResponse> listTestCaseResultsCallable()

Fetches the list of run results for the given test case. A maximum of 100 results are kept for each test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListTestCaseResultsRequest request =
       ListTestCaseResultsRequest.newBuilder()
           .setParent(
               TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   while (true) {
     ListTestCaseResultsResponse response =
         testCasesClient.listTestCaseResultsCallable().call(request);
     for (TestCaseResult element : response.getTestCaseResultsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListTestCaseResultsRequest,ListTestCaseResultsResponse>

listTestCaseResultsPagedCallable()

public final UnaryCallable<ListTestCaseResultsRequest,TestCasesClient.ListTestCaseResultsPagedResponse> listTestCaseResultsPagedCallable()

Fetches the list of run results for the given test case. A maximum of 100 results are kept for each test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListTestCaseResultsRequest request =
       ListTestCaseResultsRequest.newBuilder()
           .setParent(
               TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .setFilter("filter-1274492040")
           .build();
   ApiFuture<TestCaseResult> future =
       testCasesClient.listTestCaseResultsPagedCallable().futureCall(request);
   // Do something.
   for (TestCaseResult element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListTestCaseResultsRequest,ListTestCaseResultsPagedResponse>

listTestCases(AgentName parent)

public final TestCasesClient.ListTestCasesPagedResponse listTestCases(AgentName parent)

Fetches a list of test cases for a given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   for (TestCase element : testCasesClient.listTestCases(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentAgentName

Required. The agent to list all pages for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Returns
TypeDescription
TestCasesClient.ListTestCasesPagedResponse

listTestCases(ListTestCasesRequest request)

public final TestCasesClient.ListTestCasesPagedResponse listTestCases(ListTestCasesRequest request)

Fetches a list of test cases for a given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListTestCasesRequest request =
       ListTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (TestCase element : testCasesClient.listTestCases(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListTestCasesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestCasesClient.ListTestCasesPagedResponse

listTestCases(String parent)

public final TestCasesClient.ListTestCasesPagedResponse listTestCases(String parent)

Fetches a list of test cases for a given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   for (TestCase element : testCasesClient.listTestCases(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The agent to list all pages for. Format: projects/<Project ID>/locations/<Location ID>/agents/<Agent ID>.

Returns
TypeDescription
TestCasesClient.ListTestCasesPagedResponse

listTestCasesCallable()

public final UnaryCallable<ListTestCasesRequest,ListTestCasesResponse> listTestCasesCallable()

Fetches a list of test cases for a given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListTestCasesRequest request =
       ListTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListTestCasesResponse response = testCasesClient.listTestCasesCallable().call(request);
     for (TestCase element : response.getTestCasesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListTestCasesRequest,ListTestCasesResponse>

listTestCasesPagedCallable()

public final UnaryCallable<ListTestCasesRequest,TestCasesClient.ListTestCasesPagedResponse> listTestCasesPagedCallable()

Fetches a list of test cases for a given agent.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ListTestCasesRequest request =
       ListTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<TestCase> future = testCasesClient.listTestCasesPagedCallable().futureCall(request);
   // Do something.
   for (TestCase element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListTestCasesRequest,ListTestCasesPagedResponse>

runTestCaseAsync(RunTestCaseRequest request)

public final OperationFuture<RunTestCaseResponse,RunTestCaseMetadata> runTestCaseAsync(RunTestCaseRequest request)

Kicks off a test case run.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: RunTestCaseMetadata

  • response: RunTestCaseResponse

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (TestCasesClient testCasesClient = TestCasesClient.create()) {
    RunTestCaseRequest request =
        RunTestCaseRequest.newBuilder()
            .setName(
                TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
            .setEnvironment(
                EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
                    .toString())
            .build();
    RunTestCaseResponse response = testCasesClient.runTestCaseAsync(request).get();
    }
    
Parameter
NameDescription
requestRunTestCaseRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<RunTestCaseResponse,RunTestCaseMetadata>

runTestCaseCallable()

public final UnaryCallable<RunTestCaseRequest,Operation> runTestCaseCallable()

Kicks off a test case run.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: RunTestCaseMetadata

  • response: RunTestCaseResponse

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (TestCasesClient testCasesClient = TestCasesClient.create()) {
    RunTestCaseRequest request =
        RunTestCaseRequest.newBuilder()
            .setName(
                TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
            .setEnvironment(
                EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
                    .toString())
            .build();
    ApiFuture<Operation> future = testCasesClient.runTestCaseCallable().futureCall(request);
    // Do something.
    Operation response = future.get();
    }
    
Returns
TypeDescription
UnaryCallable<RunTestCaseRequest,Operation>

runTestCaseOperationCallable()

public final OperationCallable<RunTestCaseRequest,RunTestCaseResponse,RunTestCaseMetadata> runTestCaseOperationCallable()

Kicks off a test case run.

This method is a long-running operation. The returned Operation type has the following method-specific fields:

- metadata: RunTestCaseMetadata

  • response: RunTestCaseResponse

    Sample code:

    
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (TestCasesClient testCasesClient = TestCasesClient.create()) {
    RunTestCaseRequest request =
        RunTestCaseRequest.newBuilder()
            .setName(
                TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString())
            .setEnvironment(
                EnvironmentName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[ENVIRONMENT]")
                    .toString())
            .build();
    OperationFuture<RunTestCaseResponse, RunTestCaseMetadata> future =
        testCasesClient.runTestCaseOperationCallable().futureCall(request);
    // Do something.
    RunTestCaseResponse response = future.get();
    }
    
Returns
TypeDescription
OperationCallable<RunTestCaseRequest,RunTestCaseResponse,RunTestCaseMetadata>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateTestCase(TestCase testCase, FieldMask updateMask)

public final TestCase updateTestCase(TestCase testCase, FieldMask updateMask)

Updates the specified test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCase testCase = TestCase.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   TestCase response = testCasesClient.updateTestCase(testCase, updateMask);
 }
 
Parameters
NameDescription
testCaseTestCase

Required. The test case to update.

updateMaskFieldMask

Required. The mask to specify which fields should be updated. The creationTime and lastTestResult cannot be updated.

Returns
TypeDescription
TestCase

updateTestCase(UpdateTestCaseRequest request)

public final TestCase updateTestCase(UpdateTestCaseRequest request)

Updates the specified test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   UpdateTestCaseRequest request =
       UpdateTestCaseRequest.newBuilder()
           .setTestCase(TestCase.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   TestCase response = testCasesClient.updateTestCase(request);
 }
 
Parameter
NameDescription
requestUpdateTestCaseRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestCase

updateTestCaseCallable()

public final UnaryCallable<UpdateTestCaseRequest,TestCase> updateTestCaseCallable()

Updates the specified test case.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   UpdateTestCaseRequest request =
       UpdateTestCaseRequest.newBuilder()
           .setTestCase(TestCase.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   ApiFuture<TestCase> future = testCasesClient.updateTestCaseCallable().futureCall(request);
   // Do something.
   TestCase response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateTestCaseRequest,TestCase>