CLI newman
JSON. newman :
sudo npm install -g newman
, HTML- , newman-reporter-html
.
sudo npm install -g newman-reporter-html
, :
newman run <path to your collection json file> -e <path to your environment json file> -r cli,html
By default, the HTML file will not contain the body of the request and response. To do this, first load the default steering wheel template, and then tweak it a little. You can find the default steering pattern here . Download the file and save it as template.hbs
. Then open it in any editor and find the code in which it displays Status Code
. It might look like this:
<div class="col-md-12"> </div>
<br/><div class="col-md-4">Status code</div><div class="col-md-8">{{response.code}}</div><br/>
Add the following lines below this part:
<div class="col-md-12"> </div>
<br/><div class="col-md-4">Request body</div>
<div class="col-md-8">
<textarea class="json" disabled rows="8" cols="70">
{{request.body}}
</textarea>
</div><br/>
<div class="col-md-12"> </div>
<br/><div class="col-md-4">Response body</div>
<div class="col-md-8">
<textarea class="json" disabled rows="8" cols="70">
{{response.body}}
</textarea>
</div><br/>
Now you can run the following command to render HTML with the body of the request and response:
newman run <path to your collection json file> -e <path to your environment json file> -r cli,html --reporter-html-template template.hbs
Hope this helps!
source
share