I am looking for a tool to test a website from a Linux command line.
From the output, I need to know the http response (status codes) but also benchmark the time it takes to download the different elements of the site.
Thank you in advance.
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
Please see Apache Benchmark:
This should give you an overview of your page's performance.
You may want to look at the following options of
--write-out- displays any of several time-related variables
--trace-time- Prepends a time stamp to each trace or verbose line
--include- (HTTP) Include the HTTP-header in the output.
--trace-ascii <file>- Enables a full trace dump of all incoming and outgoing data, including descriptive information
And the following option of
--timestamping- Turn on time-stamping
Selenium and Curl are good options depending on what your goal is. Also, a utility that I've come to like quite a bit is
twill. More information is available at http://twill.idyll.org/.
It's nice as it has it's own little specialized language for filling out forms, validating links, and checking response codes. Since it's just Python code, you can easily import the libraries and automate your tests yourself if you'd like to do something different.
try a commandline tool called 'siege' as instructed here
What tool you choose depends on what you want to measure and the complexity of the site.
If the behaviour of the site is dependent on cookies (e.g. user needs to login) then ab / curl / wget (described in other answers) will not suffice. One solution is to use http::recorder / www::mechanize.
All the data you are asking for is in your webserver logs - and a simple awk script will return it in a more readable form.
benchmark the time it takes to download the different elements of the site.
This is a very poor indicator of performance (although it is useful for monitoring the health of a production system). With the exception of large/slow resources such as bulky reports, iso images, multimedia files the perception of performance has got very little to do with the time taken to process a single request - and its really difficult to measure this accurately (simply adding %D to your apache log appears to solve the problem but ignores TCP handshakes, SSL negotiation, caching effects, DNS lookup times).
There is also the argument about measuring the performance actually delivered to users of the site (RUM) vs synthetic testing.
If you are going to need something bigger then curl and/or wget, there is also selenium
I think for running performance test you can try JMeter. You can record your test using the built in proxy. It also runs in text mode, local or distributed. You can save your results in csv or xml format. If using xml format you can also store the content of the page.
pip install httpie --user
$ http -h http://serverfault.com/q/124952/113899 HTTP/1.1 302 Found Accept-Ranges: bytes Age: 0 Cache-Control: private Connection: keep-alive Content-Length: 198 Content-Type: text/html; charset=utf-8 Date: Fri, 06 Jan 2017 10:01:06 GMT Location: http://serverfault.com/questions/124952/testing-a-website-from-linux-command-line Set-Cookie: prov=392298d9-103e-7dfc-5b55-8738be46cf3b; domain=.serverfault.com; expires=Fri, 01-Jan-2055 00:00:00 GMT; path=/; HttpOnly Via: 1.1 varnish X-Cache: MISS X-Cache-Hits: 0 X-DNS-Prefetch-Control: off X-Frame-Options: SAMEORIGIN X-Request-Guid: 07a25de4-6e16-4aa8-acfc-12b1bbbc6180 X-Served-By: cache-hhn1543-HHN X-Timer: S1483696865.976259,VS0,VE187