次の方法で共有


LoadTestAdministrationClient.GetTestsAsync メソッド

定義

完全修飾リソース ID (subscriptions/{subId}/resourceGroups/{rg}/providers/Microsoft.LoadTestService/loadtests/{resName} など) によってすべてのロード テストを取得します。

public virtual Azure.AsyncPageable<BinaryData> GetTestsAsync (string orderby = default, string search = default, DateTimeOffset? lastModifiedStartTime = default, DateTimeOffset? lastModifiedEndTime = default, Azure.RequestContext context = default);
abstract member GetTestsAsync : string * string * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
override this.GetTestsAsync : string * string * Nullable<DateTimeOffset> * Nullable<DateTimeOffset> * Azure.RequestContext -> Azure.AsyncPageable<BinaryData>
Public Overridable Function GetTestsAsync (Optional orderby As String = Nothing, Optional search As String = Nothing, Optional lastModifiedStartTime As Nullable(Of DateTimeOffset) = Nothing, Optional lastModifiedEndTime As Nullable(Of DateTimeOffset) = Nothing, Optional context As RequestContext = Nothing) As AsyncPageable(Of BinaryData)

パラメーター

orderby
String

サポートされているフィールドを (フィールド asc/desc) 形式で並べ替えます。 例: lastModifiedDateTime asc。 サポートされているフィールド - lastModifiedDateTime。

search
String

検索可能なフィールドのプレフィックス ベースの大文字と小文字を区別する検索 - displayName、createdBy。 たとえば、表示名が Login Test であるテストを検索するには、検索パラメーターに Login を指定できます。

lastModifiedStartTime
Nullable<DateTimeOffset>

最後に更新された時間範囲の DateTime(ISO 8601 リテラル形式) を開始して、テストをフィルター処理します。

lastModifiedEndTime
Nullable<DateTimeOffset>

テストをフィルター処理するために最後に更新された時間範囲の End DateTime(ISO 8601 リテラル形式)。

context
RequestContext

要求コンテキスト。これは、クライアント パイプラインの既定の動作を呼び出しごとにオーバーライドできます。

戻り値

AsyncPageable<T>オブジェクトの一覧を含むサービスの BinaryData 。 コレクション内の各項目の本文スキーマの詳細については、以下の「解説」セクションを参照してください。

例外

サービスから成功以外の状態コードが返されました。

このサンプルでは、GetTestsAsync を呼び出して結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new LoadTestAdministrationClient(endpoint, credential);

await foreach (var data in client.GetTestsAsync())
{
    JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
    Console.WriteLine(result.ToString());
}

このサンプルでは、すべてのパラメーターを使用して GetTestsAsync を呼び出す方法と、結果を解析する方法を示します。

var credential = new DefaultAzureCredential();
var endpoint = new Uri("<https://my-service.azure.com>");
var client = new LoadTestAdministrationClient(endpoint, credential);

await foreach (var data in client.GetTestsAsync("<orderby>", "<search>", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234))
{
    JsonElement result = JsonDocument.Parse(data.ToStream()).RootElement;
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("clientMetric").ToString());
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("aggregate").ToString());
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("condition").ToString());
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("requestName").ToString());
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("value").ToString());
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("action").ToString());
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("actualValue").ToString());
    Console.WriteLine(result.GetProperty("passFailCriteria").GetProperty("passFailMetrics").GetProperty("<test>").GetProperty("result").ToString());
    Console.WriteLine(result.GetProperty("secrets").GetProperty("<test>").GetProperty("value").ToString());
    Console.WriteLine(result.GetProperty("secrets").GetProperty("<test>").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("certificate").GetProperty("value").ToString());
    Console.WriteLine(result.GetProperty("certificate").GetProperty("type").ToString());
    Console.WriteLine(result.GetProperty("certificate").GetProperty("name").ToString());
    Console.WriteLine(result.GetProperty("environmentVariables").GetProperty("<test>").ToString());
    Console.WriteLine(result.GetProperty("loadTestConfiguration").GetProperty("engineInstances").ToString());
    Console.WriteLine(result.GetProperty("loadTestConfiguration").GetProperty("splitAllCSVs").ToString());
    Console.WriteLine(result.GetProperty("loadTestConfiguration").GetProperty("quickStartTest").ToString());
    Console.WriteLine(result.GetProperty("loadTestConfiguration").GetProperty("optionalLoadTestConfig").GetProperty("endpointUrl").ToString());
    Console.WriteLine(result.GetProperty("loadTestConfiguration").GetProperty("optionalLoadTestConfig").GetProperty("virtualUsers").ToString());
    Console.WriteLine(result.GetProperty("loadTestConfiguration").GetProperty("optionalLoadTestConfig").GetProperty("rampUpTime").ToString());
    Console.WriteLine(result.GetProperty("loadTestConfiguration").GetProperty("optionalLoadTestConfig").GetProperty("duration").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("configFileInfo").GetProperty("url").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("configFileInfo").GetProperty("fileName").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("configFileInfo").GetProperty("fileType").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("configFileInfo").GetProperty("expireDateTime").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("configFileInfo").GetProperty("validationStatus").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("configFileInfo").GetProperty("validationFailureDetails").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("testScriptFileInfo").GetProperty("url").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("testScriptFileInfo").GetProperty("fileName").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("testScriptFileInfo").GetProperty("fileType").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("testScriptFileInfo").GetProperty("expireDateTime").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("testScriptFileInfo").GetProperty("validationStatus").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("testScriptFileInfo").GetProperty("validationFailureDetails").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("userPropFileInfo").GetProperty("url").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("userPropFileInfo").GetProperty("fileName").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("userPropFileInfo").GetProperty("fileType").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("userPropFileInfo").GetProperty("expireDateTime").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("userPropFileInfo").GetProperty("validationStatus").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("userPropFileInfo").GetProperty("validationFailureDetails").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("inputArtifactsZipFileInfo").GetProperty("url").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("inputArtifactsZipFileInfo").GetProperty("fileName").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("inputArtifactsZipFileInfo").GetProperty("fileType").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("inputArtifactsZipFileInfo").GetProperty("expireDateTime").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("inputArtifactsZipFileInfo").GetProperty("validationStatus").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("inputArtifactsZipFileInfo").GetProperty("validationFailureDetails").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("additionalFileInfo")[0].GetProperty("url").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("additionalFileInfo")[0].GetProperty("fileName").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("additionalFileInfo")[0].GetProperty("fileType").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("additionalFileInfo")[0].GetProperty("expireDateTime").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("additionalFileInfo")[0].GetProperty("validationStatus").ToString());
    Console.WriteLine(result.GetProperty("inputArtifacts").GetProperty("additionalFileInfo")[0].GetProperty("validationFailureDetails").ToString());
    Console.WriteLine(result.GetProperty("testId").ToString());
    Console.WriteLine(result.GetProperty("description").ToString());
    Console.WriteLine(result.GetProperty("displayName").ToString());
    Console.WriteLine(result.GetProperty("subnetId").ToString());
    Console.WriteLine(result.GetProperty("keyvaultReferenceIdentityType").ToString());
    Console.WriteLine(result.GetProperty("keyvaultReferenceIdentityId").ToString());
    Console.WriteLine(result.GetProperty("createdDateTime").ToString());
    Console.WriteLine(result.GetProperty("createdBy").ToString());
    Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString());
    Console.WriteLine(result.GetProperty("lastModifiedBy").ToString());
}

注釈

ページング可能な応答の 1 つの項目の JSON スキーマを次に示します。

応答本文:

TestsListValueスキーマ:

{
  passFailCriteria: {
    passFailMetrics: Dictionary<string, PassFailMetric>, # Optional. Map of id and pass fail metrics { id  : pass fail metrics }.
  }, # Optional. Pass fail criteria for a test.
  secrets: Dictionary<string, Secret>, # Optional. Secrets can be stored in an Azure Key Vault or any other secret store. If the secret is stored in an Azure Key Vault, the value should be the secret identifier and the type should be AKV_SECRET_URI. If the secret is stored elsewhere, the secret value should be provided directly and the type should be SECRET_VALUE.
  certificate: {
    value: string, # Optional. The value of the certificate for respective type
    type: "AKV_CERT_URI", # Optional. Type of certificate
    name: string, # Optional. Name of the certificate.
  }, # Optional. Certificates metadata
  environmentVariables: Dictionary<string, string>, # Optional. Environment variables which are defined as a set of <name,value> pairs.
  loadTestConfiguration: {
    engineInstances: number, # Optional. The number of engine instances to execute load test. Supported values are in range of 1-45. Required for creating a new test.
    splitAllCSVs: boolean, # Optional. If false, Azure Load Testing copies and processes your input files unmodified across all test engine instances. If true, Azure Load Testing splits the CSV input data evenly across all engine instances. If you provide multiple CSV files, each file will be split evenly.
    quickStartTest: boolean, # Optional. If true, optionalLoadTestConfig is required and JMX script for the load test is not required to upload.
    optionalLoadTestConfig: {
      endpointUrl: string, # Optional. Test URL. Provide the complete HTTP URL. For example, http://contoso-app.azurewebsites.net/login
      virtualUsers: number, # Optional. No of concurrent virtual users
      rampUpTime: number, # Optional. Ramp up time
      duration: number, # Optional. Test run duration
    }, # Optional. Optional load test config
  }, # Optional. The load test configuration.
  inputArtifacts: {
    configFileInfo: {
      url: string, # Optional. File URL.
      fileName: string, # Optional. Name of the file.
      fileType: "JMX_FILE" | "USER_PROPERTIES" | "ADDITIONAL_ARTIFACTS", # Optional. File type
      expireDateTime: string (ISO 8601 Format), # Optional. Expiry time of the file (ISO 8601 literal format)
      validationStatus: "NOT_VALIDATED" | "VALIDATION_SUCCESS" | "VALIDATION_FAILURE" | "VALIDATION_INITIATED" | "VALIDATION_NOT_REQUIRED", # Optional. Validation status of the file
      validationFailureDetails: string, # Optional. Validation failure error details
    }, # Optional. File info
    testScriptFileInfo: FileInfo, # Optional. File info
    userPropFileInfo: FileInfo, # Optional. File info
    inputArtifactsZipFileInfo: FileInfo, # Optional. File info
    additionalFileInfo: [FileInfo], # Optional. Additional supported files for the test run
  }, # Optional. The input artifacts for the test.
  testId: string, # Optional. Unique test name as identifier.
  description: string, # Optional. The test description.
  displayName: string, # Optional. Display name of a test.
  subnetId: string, # Optional. Subnet ID on which the load test instances should run.
  keyvaultReferenceIdentityType: string, # Optional. Type of the managed identity referencing the Key vault.
  keyvaultReferenceIdentityId: string, # Optional. Resource Id of the managed identity referencing the Key vault.
  createdDateTime: string (ISO 8601 Format), # Optional. The creation datetime(ISO 8601 literal format).
  createdBy: string, # Optional. The user that created.
  lastModifiedDateTime: string (ISO 8601 Format), # Optional. The last Modified datetime(ISO 8601 literal format).
  lastModifiedBy: string, # Optional. The user that last modified.
}

適用対象