Created
December 15, 2013 16:04
-
-
Save photopresentr/7974747 to your computer and use it in GitHub Desktop.
Convert HAR Archive to Siege URL List using node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
* har2siege.js | |
* converts a HAR file generated by chrome to an url file as required | |
* by the siege performance testing tool (http://www.joedog.org/siege-home/) | |
* | |
* Usage: | |
* - save har file in chrome. make sure extension is .json, e.g. myrequests.json | |
* - put the relative path as the only parameter on the command line | |
* - redirect STDOUT to the file you want as the urllist for siege | |
* | |
* Example: ./har2siege.js ./myrequests.json > ./urllist.txt | |
*/ | |
var har = require(process.argv[2]); | |
var _ = require('underscore'); | |
process.stdout.write( | |
_.map(har.log.entries, function(entry) { | |
return entry.request.url + | |
(entry.request.method =='POST' ? ' POST ' + entry.request.postData.text : ''); | |
}).join('\n')); |
Hi.
I made an alternate Version to not use underscore .. https://gist.github.com/kuddl/5a3104b2c6e66839cf69
Thanks for your initial work!
Tobias
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Convert Chrome HTTP Request Archive (HAR) to a Siege URL List for benchmarking
In the Chrome Developer Tools, under the Network Panel, you can receive a list of all HTTP requests made by a page. With a right click, you can open the context menu and choose "Save as HAR with Content". This saves a little JSON file on your disk which contains a record of all the requests made in the session.
This is almost what you need to do performance testing of your single page app with the Siege (http://www.joedog.org/siege-home/) open source tool. You only need to convert the HAR file to a simple text file, which is what the script in this gist does.
How to
npm -g install underscore
(as root) on the consoleThe program writes out one request per line. In case of POST requests, it also puts the POST data as required by siege. Now you can benchmark your app with siege!
For example, run
siege -c10 -d5 -v -f urllist.txt
to simulateOther Projects