SOAPUI Groovy 脚本调用命令行

发布于 2025-01-04 08:22:57 字数 348 浏览 4 评论 0原文

我想运行

ipconfig /all | 之类的命令找到“IPv4”

,它可以获取我连接到的所有接口的 IP 地址。这在纯 Java 或 C# 中是直接的,他们甚至为此提供了托管 API。我可以运行“命令行”命令或访问托管对象来获取我正在寻找的特定接口的 IP 地址。

我有 SOAPUI Pro 并且知道 API 位于此处,但我找不到如何进行命令行调用并获取结果 - 也不是使用该 API 获取 IP 地址的直接方法。

最终我想将运行时 IP 地址存储在项目属性中。

I would like to run something like

ipconfig /all | find "IPv4"

that fetches the IP addresses for all the interfaces I'm connected to. This is straight forward in pure Java or C#, and they even have a managed API for this. I could run a 'command line' command or access managed objects to fetch the IP address of the particular interface I'm looking for.

I have SOAPUI Pro and am aware the API is here, but I cant find out how do either make a command line call and fetch the result- nor a direct way to get the IP addresses with that API.

Ultimately I want to store the runtime IP address in a project property.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暗地喜欢 2025-01-11 08:22:57

此脚本运行 ipconfig /all 命令并将结果获取到变量中。但是获取IP的解析还有待完成。目前,Groovy 步骤将返回整个 ipconfig 结果。

def result = "ipconfig /all".execute().text

//Do stuff with the result, probably RegEx your way to the IpAdress

return result;

This script runs the ipconfig /all command and gets the result into a variable. But the parsing to get the IP remains to be done. Currently the Groovy step will return the entire ipconfig result.

def result = "ipconfig /all".execute().text

//Do stuff with the result, probably RegEx your way to the IpAdress

return result;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文