你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

LoadTestAdministrationClient.GetTestFile 方法

定义

按文件名获取测试文件。

public virtual Azure.Response GetTestFile (string testId, string fileName, Azure.RequestContext context = default);
abstract member GetTestFile : string * string * Azure.RequestContext -> Azure.Response
override this.GetTestFile : string * string * Azure.RequestContext -> Azure.Response
Public Overridable Function GetTestFile (testId As String, fileName As String, Optional context As RequestContext = Nothing) As Response

参数

testId
String

负载测试的唯一名称只能包含小写字母、数字、下划线或连字符字符。

fileName
String

文件扩展名为 app.jmx 的文件名。

context
RequestContext

请求上下文,它可以基于每个调用替代客户端管道的默认行为。

返回

从服务返回的响应。 响应正文架构的详细信息位于下面的“备注”部分。

例外

testIdfileName 为 null。

testIdfileName 是空字符串,预期为非空。

服务返回了不成功状态代码。

示例

此示例演示如何使用所需参数调用 GetTestFile 并分析结果。

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

Response response = client.GetTestFile("<testId>", "<fileName>");

JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
Console.WriteLine(result.GetProperty("url").ToString());
Console.WriteLine(result.GetProperty("fileName").ToString());
Console.WriteLine(result.GetProperty("fileType").ToString());
Console.WriteLine(result.GetProperty("expireDateTime").ToString());
Console.WriteLine(result.GetProperty("validationStatus").ToString());
Console.WriteLine(result.GetProperty("validationFailureDetails").ToString());

注解

下面是响应有效负载的 JSON 架构。

响应正文:

FileInfo架构:

{
  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
}

适用于