I want to generate test case wise reports in respective folder. So for example if I run login test case , it's allure html report should save in /reports/login.
I can do it easily by executing below command manually once my test execution completes. Command I use is :
allure generate allure-results -o E:\project\target\reports\loginReport --clean
But here difficulty is I have to execute command manually every time to generate report.
So I decided to execute this allure command from java , I tried following code :
String cmd = "allure generate allure-results -o E:\\project\target\\reports\\loginReport --clean";
Process process = Runtime.getRuntime().exec(cmd);
process.waitFor();
I am calling above code as last test in my code. But getting error :
java.io.IOException: Cannot run program "allure": CreateProcess error=2, The system cannot find the file specified
so question is how can I execute above command from my java code. I am using Java, selenium, TestNG and maven.
Note : I have already set class path for allure package.
The below code works perfectly fine for me. I have Java 1.8 installed on my mac machine.
String[] cmd = {"allure", "serve","/Users/kireeti/IdeaProjects/testautomationframeworkshaft/allure-results"};
Runtime.getRuntime().exec(cmd);
Thread.sleep(90000);