I am trying to use a Java Maven program that will allow me to import XRAY Cucumber tests off of a JIRA page using the RESTful API and am running into an issue with the demo where I am getting stuck in an infinite loop. Here is the project link that will provide some more details and the project: https://github.com/kristapsmelderis/xray-test-automation-example
I know the problem is specifically in this method:
` 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));
}`
I am following all of the instructions for the demo and have changed the system properties to what the original author has specified. When I run the program I get stuck in an infinite loop of "Checking if the tests are inputted and put in a new file". I suspect it is something to do with curl, although I believe I have set it up properly on Windows as the test command the author provided worked for me. I am also connected to a company VPN on NetScalar Gateway while using this, could this be having an effect on the program? Any help or suggestions would be greatly appreciated!
Well, it seems that the file pointed to by pathToOutputFile
doesn't exist, whatever it is. Try looking into that, I unfortunately can't help you more than so.