0
votes

I have a following newman command: newman run "collection.json" -e "environment.json" --reporters html,cli --reporter-html-template ~/node_modules/newman-reporter-html/lib/template-default.hbs --reporter-html-export test_result.html --delay-request 1500 I save the above command in test.sh file. When I run the file as ./test.sh, it generates the html output but when the run the same file from a php file it does not generate the html file.

Following is my php file

<?
$cmd = file_get_contents("test.sh");
while (@ ob_end_flush()); // end all output buffers if any

$proc = popen($cmd, 'r');
echo '<pre>';
while (!feof($proc))
{
    echo fread($proc, 4096);
    @ flush();
}
echo '</pre>';
?>

This php file executes the newman command and prints the live output of the terminal in the browser window. After its execution it should generate the html file but it does not. Can anyone help me in pointing out what I am doing wrong or is there any other newman command?

1

1 Answers

0
votes

Found the solution: Remove the --reporter-html-template ~/node_modules/newman-reporter-html/lib/template-default.hbs parameter from the newman command or keep the template-default.hbs file in the same directory in which .sh file is placed.