Capybara: Ruby library to simulate user browser interactions with support for multiple test drivers

Capybara logo

http://jnicklas.github.io/capybara/


From the Capybara site:

Tired of clicking around in your browser trying to make sure your applications work as expected? Capybara is a library written in the Ruby programming language which makes it easy to simulate how a user interacts with your application.

Capybara can talk with many different drivers which execute your tests through the same clean and simple interface. You can seamlessly choose between Selenium, Webkit or pure Ruby drivers.

Tackle the asynchronous web with Capybara’s powerful synchronization features. Capybara automatically waits for your content to appear on the page, you never have to issue any manual sleeps.

Nightmare: High level wrapper for Phantomjs that provides a streamlined API

Nightmare logo

http://www.nightmarejs.org/

Raw PhantomJS

phantom.create(function (ph) {
  ph.createPage(function (page) {
    page.open('http://yahoo.com', function (status) {
      page.evaluate(function () {
        var el =
          document.querySelector('input[title="Search"]');
        el.value = 'github nightmare';
      }, function (result) {
        page.evaluate(function () {
          var el = document.querySelector('.searchsubmit');
          var event = document.createEvent('MouseEvent');
          event.initEvent('click', true, false);
          el.dispatchEvent(event);
        }, function (result) {
          ph.exit();
        });
      });
    });
  });
});

With Nightmare

new Nightmare()
  .goto('http://yahoo.com')
  .type('input[title="Search"]', 'github nightmare')
  .click('.searchsubmit')
  .run();

DHC (Dev HTTP Client) – Google Chrome extension to discover, manipulate, & test HTTP REST services

DHC logo

From the DHC Chrome Web Store page:

Easily construct custom HTTP requests, save them permanently, take advantage of variables and contexts.

DHC (aka Dev HTTP Client) is designed and developed by a developer for developers to make direct HTTP resource discovery, manipulation and testing more easily. Beside the main function, sending/receiving custom HTTP requests/responses, it allows permanently to save a request to a local repository for later reuse and moreover the request declaration can include variables that are context specific. With the use of contexts you can easily switch between various environments without modifying request declaration. (e.g. from a test environment to production)

GoLang HTTP load testing tool and library

Vegeta image

Not as poweful as JMeter, but way simpler to get setup, especially from the command line. I am currently using it to throw some load at a dev server to observe the memory utilization over time.

$ vegeta -h
Usage: vegeta [globals] <command> [options]

attack command:
  -body="": Requests body file
  -duration=10s: Duration of the test
  -header=: Request header
  -ordering="random": Attack ordering [sequential, random]
  -output="stdout": Output file
  -rate=50: Requests per second
  -redirects=10: Number of redirects to follow
  -targets="stdin": Targets file
  -timeout=0: Requests timeout

report command:
  -input="stdin": Input files (comma separated)
  -output="stdout": Output file
  -reporter="text": Reporter [text, json, plot]

global flags:
  -cpus=8 Number of CPUs to use

examples:
  echo "GET http://localhost/" | vegeta attack -duration=5s | tee results.bin | vegeta report
  vegeta attack -targets=targets.txt > results.bin
  vegeta report -input=results.bin -reporter=json > metrics.json
  cat results.bin | vegeta report -reporter=plot > plot.html

Spek: BDD Specification Framework For The JVM

http://jetbrains.github.io/spek/ (via)

Sample code from the Spek website written in the Spek DSL:

class TaxCalculatorSpecs: Spek() {{

    given("Tax rate calculator with default locale settings") {
        val taxRateCalculator = TaxRateCalculator()
        on("calculating the rate for an income of 200 and an average change of 10 per semester") {
            val value = taxRateCalculator.calculateRate(200, 10)
            it("should result in a value of 300") {
                assertEquals(300, value)
            }
        }
    }
}}