JMeter:如何在 JMeter 中访问远程云目录?

JMeter: How to access a remote Cloud directory in JMeter?

我需要访问 远程云目录 (microsoft azure) 以列出文件夹中的文件。我还需要将一些文件移动到云目录中的另一个文件夹(剪切和粘贴)。

我找到了一些关于使用 Beanshell SamplerForeach 的答案controller 获取目录中的文件(这是针对我本地计算机上的文件夹结构)。我能够使用 Debug Samplerview results tree 检查结果]。但是,我不确定如何将其用于云目录。

我还找到了有关使用 目录列表配置插件 的答案,这也适用于本地目录。但是我无法传递到云目录的路径。

有没有办法访问云目录?我是 JMeter 的新手。 请帮忙。谢谢。

如果您谈论的是 Azure Files - it can be accessed either via NFS protocol or SMB 协议。

None 协议受 JMeter 或任何 plugins so you will have to use JSR223 Sampler and write some custom Groovy code using the relevant Java library like EMC NFS Java Client or JCIFS. For the latter one example code can be found in How to Load Test SMB/CIFS with JMeter 支持,以防万一:

import jcifs.smb.NtlmPasswordAuthentication
import jcifs.smb.SmbFile

String url = "smb://path/to/your/cloud/directory";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(null, "username", "password");
SmbFile smbFile = new SmbFile(url, auth);
SmbFile[] files = smbFile.listFiles("*");

for (int i = 0; i < files.length; i++) {
    log.info("File + " + i + ": " + files[i].getName());
}