Docs Code Examples

Documentation for:

Getting Started

You'll need …


Get PHP for your system.


Install the Sausage library in your project directory.

mkdir sauce-demo && cd sauce-demo
curl -s | SAUCE_USERNAME=<username> SAUCE_ACCESS_KEY=<access-key> php

Note: Sausage has certain requirements which this installer will check for, and inform you how to resolve if they are not met. For more information, see the Sausage documentation.

Run Your First Test Suite

(Make sure you're in the project directory where you installed Sausage)

vendor/bin/phpunit SeleniumRCDemo.php

PHPUnit will run the tests on Sauce, and you'll see each one as it passes!

Run Your Tests in Parallel

Use Paratest to make your Selenium tests run faster, in parallel:

vendor/bin/paratest -p 8 -f --phpunit=vendor/bin/phpunit SeleniumRCDemo.php


Here's what was in the SeleniumRCDemo.php file:


require_once 'vendor/autoload.php';

class basic_example extends Sauce\Sausage\SeleniumRCTestCase
    public static $browsers = array(
        // FF 11 on Sauce
            'browser' => 'firefox',
            'browserVersion' => '11',
            'os' => 'Windows 2003',

    public function setUp()

    public function postSessionSetUp()

    public function testTitle()
        $this->assertTitle("I am a page title - Sauce Labs");

    public function testLink()
        $this->click('id=i am a link');
        $driver = $this;
        $title_test = function() use ($driver) {
            return ($driver->getTitle() == "I am another page title - Sauce Labs");
        $this->spinAssert("Title never matched!", $title_test);

    public function testTextbox()
        $test_text = "This is some text";
        $this->type('id=i_am_a_textbox', $test_text);
        $this->assertElementValueEquals('id=i_am_a_textbox', $test_text);

    public function testSubmitComments()
        $comment = "This comment rocks lots of rocks";
        $this->type('id=comments', $comment);
        $driver = $this;

        $comment_test =
            function() use ($comment, $driver)
                $text = $driver->getText('id=your_comments');
                return ($text == "Your comments: $comment");

        $this->spinAssert("Comment never showed up!", $comment_test);


Get saucy

  1. Your first test just ran! Check out the results on your Account Page.
  2. Visit our Available Browsers page!
  3. Visit our resources page, and see all the available Sauce integrations.