0

我正在尝试使用 Java Maven 程序,该程序允许我使用 RESTful API 从 JIRA 页面导入 XRAY Cucumber 测试,并且在演示中遇到问题,我陷入了无限循环。这是将提供更多详细信息和项目的项目链接:https
://github.com/kristapsmelderis/xray-test-automation-example 我知道问题出在这种方法中:

`    public static void importTestsFromJIRA(String username, String password, String jiraURL, String 
    jiraKeys, String pathToOutputFile) {
            String[] command = {"curl.exe", "-D-", "-X", "GET", "-H",
                    "Authorization: Basic " + encodeBase64String(username + ":" + password),
                    jiraURL + "/rest/raven/1.0/export/test?keys=" + jiraKeys, "-o", pathToOutputFile
            };
            ProcessBuilder process = new ProcessBuilder(command);
            Process p;
            try {
                System.out.println("\ninfo: Starting process that accepts curl GET command\n");
                p = process.start();
            } catch (IOException e) {
                System.out.print("\nerror: Tried to execute curl command and output to a file, something 
    went wrong\n");
                e.printStackTrace();
            }
            do {
                System.out.println("\ninfo: Checking if tests are imported and put in a new file\n");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException ex) {
                    Thread.currentThread().interrupt();
                }
                } while (!fileExists(pathToOutputFile));
        }`

我按照演示的所有说明进行操作,并将系统属性更改为原作者指定的内容。当我运行程序时,我陷入了“检查测试是否输入并放入新文件”的无限循环中。我怀疑这与 curl 有关,尽管我相信我已经在 Windows 上正确设置了它,因为作者提供的测试命令对我有用。我在使用它时还连接到 NetScalar Gateway 上的公司 VPN,这会对程序产生影响吗?任何帮助或建议将不胜感激!

4

2 回答 2

1

好吧,似乎 指向的文件pathToOutputFile不存在,不管它是什么。试着调查一下,不幸的是,我不能帮助你更多。

于 2019-12-04T21:56:33.283 回答
1

我可能对此不以为然,但我相信需要在 cURL 命令行中引用文件名。cURL 手册页中的所有示例都在其 -o 参数后引用了文件名。

于 2019-12-04T21:57:27.340 回答