Class TestCasesClient (0.13.1)

public class TestCasesClient implements BackgroundResource

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 TestCasesSettings testCasesSettings =
     TestCasesSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 TestCasesClient testCasesClient = TestCasesClient.create(testCasesSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 TestCasesSettings testCasesSettings =
     TestCasesSettings.newBuilder().setEndpoint(myEndpoint).build();
 TestCasesClient testCasesClient = TestCasesClient.create(testCasesSettings);
 

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

Inheritance

java.lang.Object > TestCasesClient

Implements

BackgroundResource

Static Methods

create()

public static final TestCasesClient create()

Constructs an instance of TestCasesClient with default settings.

Returns
Type Description
TestCasesClient
Exceptions
Type Description
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
Name Description
settings TestCasesSettings
Returns
Type Description
TestCasesClient
Exceptions
Type Description
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
Name Description
stub TestCasesStub
Returns
Type Description
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
Name Description
settings TestCasesSettings

TestCasesClient(TestCasesStub stub)

protected TestCasesClient(TestCasesStub stub)
Parameter
Name Description
stub TestCasesStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

batchDeleteTestCases(AgentName parent)

public final void batchDeleteTestCases(AgentName parent)

Batch deletes test cases.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   testCasesClient.batchDeleteTestCases(parent);
 }
 
Parameter
Name Description
parent AgentName

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request BatchDeleteTestCasesRequest

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   testCasesClient.batchDeleteTestCases(parent);
 }
 
Parameter
Name Description
parent String

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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request BatchRunTestCasesRequest

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

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   CalculateCoverageRequest request =
       CalculateCoverageRequest.newBuilder()
           .setAgent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   CalculateCoverageResponse response = testCasesClient.calculateCoverage(request);
 }
 
Parameter
Name Description
request CalculateCoverageRequest

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

Returns
Type Description
CalculateCoverageResponse

calculateCoverageCallable()

public final UnaryCallable<CalculateCoverageRequest,CalculateCoverageResponse> calculateCoverageCallable()

Calculates the test coverage for an agent.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   TestCase testCase = TestCase.newBuilder().build();
   TestCase response = testCasesClient.createTestCase(parent, testCase);
 }
 
Parameters
Name Description
parent AgentName

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

testCase TestCase

Required. The test case to create.

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request CreateTestCaseRequest

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

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
parent String

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

testCase TestCase

Required. The test case to create.

Returns
Type Description
TestCase

createTestCaseCallable()

public final UnaryCallable<CreateTestCaseRequest,TestCase> createTestCaseCallable()

Creates a test case for the given agent.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request ExportTestCasesRequest

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

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
OperationCallable<ExportTestCasesRequest,ExportTestCasesResponse,ExportTestCasesMetadata>

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
Type Description
OperationsClient

getSettings()

public final TestCasesSettings getSettings()
Returns
Type Description
TestCasesSettings

getStub()

public TestCasesStub getStub()
Returns
Type Description
TestCasesStub

getTestCase(GetTestCaseRequest request)

public final TestCase getTestCase(GetTestCaseRequest request)

Gets a test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request GetTestCaseRequest

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

Returns
Type Description
TestCase

getTestCase(TestCaseName name)

public final TestCase getTestCase(TestCaseName name)

Gets a test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCaseName name = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]");
   TestCase response = testCasesClient.getTestCase(name);
 }
 
Parameter
Name Description
name TestCaseName

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

Returns
Type Description
TestCase

getTestCase(String name)

public final TestCase getTestCase(String name)

Gets a test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String name = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]").toString();
   TestCase response = testCasesClient.getTestCase(name);
 }
 
Parameter
Name Description
name String

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

Returns
Type Description
TestCase

getTestCaseCallable()

public final UnaryCallable<GetTestCaseRequest,TestCase> getTestCaseCallable()

Gets a test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request GetTestCaseResultRequest

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

Returns
Type Description
TestCaseResult

getTestCaseResult(TestCaseResultName name)

public final TestCaseResult getTestCaseResult(TestCaseResultName name)

Gets a test case result.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCaseResultName name =
       TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]");
   TestCaseResult response = testCasesClient.getTestCaseResult(name);
 }
 
Parameter
Name Description
name TestCaseResultName

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

Returns
Type Description
TestCaseResult

getTestCaseResult(String name)

public final TestCaseResult getTestCaseResult(String name)

Gets a test case result.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String name =
       TestCaseResultName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]", "[RESULT]")
           .toString();
   TestCaseResult response = testCasesClient.getTestCaseResult(name);
 }
 
Parameter
Name Description
name String

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

Returns
Type Description
TestCaseResult

getTestCaseResultCallable()

public final UnaryCallable<GetTestCaseResultRequest,TestCaseResult> getTestCaseResultCallable()

Gets a test case result.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   ImportTestCasesRequest request =
       ImportTestCasesRequest.newBuilder()
           .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
           .build();
   ImportTestCasesResponse response = testCasesClient.importTestCasesAsync(request).get();
 }
 
Parameter
Name Description
request ImportTestCasesRequest

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

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
OperationCallable<ImportTestCasesRequest,ImportTestCasesResponse,ImportTestCasesMetadata>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

listTestCaseResults(ListTestCaseResultsRequest request)

public final TestCasesClient.ListTestCaseResultsPagedResponse listTestCaseResults(ListTestCaseResultsRequest request)

Fetches a list of results for a given test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request ListTestCaseResultsRequest

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

Returns
Type Description
TestCasesClient.ListTestCaseResultsPagedResponse

listTestCaseResults(TestCaseName parent)

public final TestCasesClient.ListTestCaseResultsPagedResponse listTestCaseResults(TestCaseName parent)

Fetches a list of results for a given test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCaseName parent = TestCaseName.of("[PROJECT]", "[LOCATION]", "[AGENT]", "[TEST_CASE]");
   for (TestCaseResult element : testCasesClient.listTestCaseResults(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent TestCaseName

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
Type Description
TestCasesClient.ListTestCaseResultsPagedResponse

listTestCaseResults(String parent)

public final TestCasesClient.ListTestCaseResultsPagedResponse listTestCaseResults(String parent)

Fetches a list of results for a given test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
parent String

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
Type Description
TestCasesClient.ListTestCaseResultsPagedResponse

listTestCaseResultsCallable()

public final UnaryCallable<ListTestCaseResultsRequest,ListTestCaseResultsResponse> listTestCaseResultsCallable()

Fetches a list of results for a given test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
UnaryCallable<ListTestCaseResultsRequest,ListTestCaseResultsResponse>

listTestCaseResultsPagedCallable()

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

Fetches a list of results for a given test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   AgentName parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]");
   for (TestCase element : testCasesClient.listTestCases(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent AgentName

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

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Name Description
request ListTestCasesRequest

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

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   String parent = AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString();
   for (TestCase element : testCasesClient.listTestCases(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
Name Description
parent String

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

Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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.getResponsesList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
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 for illustrative purposes only.
    // It may require modifications to work in your environment.
    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
Name Description
request RunTestCaseRequest

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

Returns
Type Description
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 for illustrative purposes only.
    // It may require modifications to work in your environment.
    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
Type Description
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 for illustrative purposes only.
    // It may require modifications to work in your environment.
    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
Type Description
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 for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   TestCase testCase = TestCase.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   TestCase response = testCasesClient.updateTestCase(testCase, updateMask);
 }
 
Parameters
Name Description
testCase TestCase

Required. The test case to update.

updateMask FieldMask

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

Returns
Type Description
TestCase

updateTestCase(UpdateTestCaseRequest request)

public final TestCase updateTestCase(UpdateTestCaseRequest request)

Updates the specified test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 try (TestCasesClient testCasesClient = TestCasesClient.create()) {
   UpdateTestCaseRequest request =
       UpdateTestCaseRequest.newBuilder()
           .setTestCase(TestCase.newBuilder().build())
           .setUpdateMask(FieldMask.newBuilder().build())
           .build();
   TestCase response = testCasesClient.updateTestCase(request);
 }
 
Parameter
Name Description
request UpdateTestCaseRequest

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

Returns
Type Description
TestCase

updateTestCaseCallable()

public final UnaryCallable<UpdateTestCaseRequest,TestCase> updateTestCaseCallable()

Updates the specified test case.

Sample code:


 // This snippet has been automatically generated for illustrative purposes only.
 // It may require modifications to work in your environment.
 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
Type Description
UnaryCallable<UpdateTestCaseRequest,TestCase>