Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to monitor HTTP calls using browsermob-proxy and nightwatch.js?

I am writing testcases using Nightwatch.js framework for SPA application. A requirement came in here we have to monitor HTTP calls and get the performance results for the site. As this could be easily achieved using JMeter.

Using automation testing tool, we can do it by using browsermob-proxy and selenium.

Is it possible to do the same using Nightwatch.js and browsermob-proxy?

Also what are the steps to do to the same.

like image 816
vibhor Avatar asked Nov 10 '22 12:11

vibhor


1 Answers

For using Nightwatchjs and browsermob-proxy together, check out this repo, which includes info on the NodeJS bindings for browsermob-proxy and programmatically generating HAR (HTTP Archive) files.

If you're content with just using Nightwatchjs, this repo has code in the tests directory for the following:

  • Custom command to get the requests made so far
  • Custom assertion for checking if a request, given a filter and query string params, exists.

You might have to brush up on how to add custom commands and assertions to your Nightwatch project, but after that you should be set to go!

like image 71
EricM Avatar answered Nov 14 '22 21:11

EricM