web_performo¶ ↑
DESCRIPTION:¶ ↑
Library to allow you to time and compare website performance. Built out of a project requirement that new websites should not run any slower than the old websites.
The measurements taken are the time it takes for the first byte to be received from the web server and the time taken for a page to render in a given browser.
SYNOPSIS:¶ ↑
Getting the performance statistics of a given URL:
performo = WebPerformo.new('firefox') performo.run('http://www.google.com') # high precision seconds taken to return the first byte from the web server performo.first_byte_speed #=> 3.189367457887645 # high precision seconds taken to render the page in a browser performo.render_speed #=> 6.34988954874875
Compare the performance of two sites:
performo = WebPerformo.new() fast_site = performo.run('http://www.fastsite.com') slow_site = performo.run('http://www.slowsite.com') if slow_site > fast_site puts "slow site is slower than a fast site (obviously)" end
Make an assertion about website performance:
performo = WebPerformo.new() fast_site = performo.run('http://www.fastsite.com') slow_site = performo.run('http://www.slowsite.com') fast_site.assert > slow_site #=> exception! slow_site.assert < fast_site #=> exception! fast_site.assert < slow_site #=> true slow_site.assert > fast_site #=> true
When comparing, remember that we’re comparing time elapsed. So…
slow_site_stats > fast_site_stats #=> true fast_site_stats < slow_site_stats #=> true slow_site_stats < fast_site_stats #=> false fast_site_stats > slow_site_stats #=> false
REQUIREMENTS:¶ ↑
-
selenium-webdriver >= 0.0.18
INSTALL:¶ ↑
-
sudo gem install web_performo
LICENSE:¶ ↑
Copyright © 2010 Stephen Hardisty
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish,distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Except as contained in this notice, neither the names of the above copyright holders nor sponsors in relation to the Software (REA Group or its subsidiaries) shall be used in advertising or otherwise to promote the sale, use or other dealings in the Software without prior written authorization.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS OR SPONSORS IN RELATION TO THE SOFTWARE (REA GROUP LIMITED OR ITS SUBSIDIARIES) OR THEIR RELATED PERSONS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.