簡體   English   中英

Microsoft Visual Studio Web性能測試記錄器可以將文件從Internet Explorer保存到本地磁盤嗎?

[英]Can Microsoft Visual Studio Web Performance Test Recorder save file from the Internet Explorer to local disk?

我正在使用Web Performance Test Recorder進行負載測試。 我的客戶要求保存正在IE上顯示的PDF文件。 僅靠Web性能測試就能做到嗎? 如果沒有,有沒有可能的解決方案?

據我所知,沒有內置的方式可以保存響應。 您將必須編寫WebTestRequestPlugin才能將響應寫入文件。

這是一個簡單的實現作為起點。

public class SaveResponsePlugin : WebTestRequestPlugin
{
    [DisplayName("File Name")]
    [Description("Name of file in which to save the response")]
    public string FileName { get; set; }

    public override void PostRequest(object sender, PostRequestEventArgs e)
    {
        if (e.ResponseExists && !e.Response.IsBodyEmpty)
            File.WriteAllBytes(this.FileName, e.Response.BodyBytes);
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM