# What can I use to do load testing or functional testing of my web server?

Here are some links to open source web server load and functional testing programs or frameworks:

## [ab – Apache <span class="caps">HTTP</span> server benchmarking tool](http://httpd.apache.org/docs/2.0/programs/ab.html)

- Somes with Apache on some platform.
- Very easy to use. Supports parameters such as concurrency and <span class="caps">POST</span> data.
- It tells you how many requests succeeded and how many failed (by response code and/or timeout), the request rate, etc. However, you cannot see which ones failed and why, etc.
- No support for distributing work across machines.

## [Apache JMeter](http://jakarta.apache.org/jmeter/)

- Constructs and runs test plans in its <span class="caps">GUI</span>. I think you can use the JMeter classes (in Java) directly, instead of using the <span class="caps">GUI</span>. Documentation is scarce in this area too.
- Supports distributing work across machines. Multiple machines can load the test and another machine can observe the test.
- Pretty limited in terms of running dynamic test cases: There are built-in functions (like one that gets the current time), regular expression, and [<span class="caps">JEXL</span>](http://commons.apache.org/jexl/), but you can’t use custom code in test cases easily.
- Sends and receives <span class="caps">HTTP</span> requests and responses. Not aware of browser behavior or client-side scripting.

## [Selenium](http://seleniumhq.org/)

- 3 variants: 
    - Selenium: write test plans in a language called Selenese in the Selenium <span class="caps">IDE</span>
    - Selenium RC: incorporate test plans into programs; server part is in Java but client drivers exist for Java, .Net, Perl, <span class="caps">PHP</span>, Python and Ruby at least.
    - Selenium Grid: a version of RC that enables spreading of test load among multiple processes and/or machines
- Functional testing (all) and load testing (RC, Grid)
- Runs in actual browsers so it can be used to test browser behavior or client-side scripting. For example, you can tell the script to click on a specific element in the page, even if the element is created by JavaScript loaded at run-time.
- [<span class="caps">FAQ</span> of Grid](http://selenium-grid.seleniumhq.org/faq.html) states that it’s not designed for load testing. 
    - One of the reasons: it’s resource-intensive to run multiple simultaneous instances of actual browsers.
    - Grid’s “principle author” [stated](http://mguillem.wordpress.com/2007/10/04/thoughts-on-selenium-grid/) that each machine should be able to run 10-20 browser instances. This is still much more resource-intensive than many alternatives. I’ve read somewhere that [BrowseMob](http://browsermob.com/performance-testing) provides performance-testing service using exactly this software though.

## [HtmlUnit](http://htmlunit.sourceforge.net/)

- A Java library providing building blocks for testing. I’ve read that front-ends exist.
- Primarily for functional testing, but also used by many for load testing.
- Claims to “understand” page content and runs JavaScript including <span class="caps">AJAX</span>.

## [Simple Test](http://simpletest.sourceforge.net/)

- Unit testing for <span class="caps">PHP</span>
- A browser class that simulates a browser’s behavior is included
- No real support for load testing beyond timing a request, as there is no concurrency (within the program at least).

## Other

- [Canoo](http://webtest.canoo.com/webtest/manual/WebTestHome.html)
- [List of 23 Open Source Performance Testing Tools](http://opensourcetesting.org/performance.php)