Skip to content

testingbot/testingbot-php

Repository files navigation

Testingbot-PHP

This is the TestingBot PHP client which makes it easy to interact with the TestingBot API

License

Testingbot-PHP is available under the Apache 2 license. See LICENSE.APACHE2 for more details.

Usage

TestingBot-PHP is distributed with Composer, which means you can include it in your project:

composer require testingbot/testingbot-php

or edit the composer.json file and add:

{
    "require": {
        "testingbot/testingbot-php": ">=1.0.0"
    }
}

To start, create a new TestingBot\TestingBotAPI object and pass in the key and secret you obtained from TestingBot

$api = new TestingBot\TestingBotAPI($key, $secret);

Now you can use the various methods we've made available to interact with the API:

getBrowsers

Gets a list of browsers you can test on

$api->getBrowsers();

getDevices

Gets a list of devices you can test on

$api->getDevices();

getAvailableDevices

Gets a list of available devices you can test on

$api->getAvailableDevices();

getDevice

Gets information for a specific device

$api->getDevice($deviceID);

getUserInfo

Gets your user information

$api->getUserInfo();

updateUserInfo

Updates your user information

$api->updateUserInfo(array('first_name' => 'test'));

updateJob

Updates a Test with Meta-data to display on TestingBot. For example, you can specify the test name and whether the test succeeded or failed:

$api->updateJob($webdriverSessionID, array('name' => 'mytest', 'success' => true));

getJob

Gets meta information for a job (test) by passing in the WebDriver sessionID of the test you ran on TestingBot:

$api->getJob($webdriverSessionID);

getJobs

Gets a list of previous jobs/tests that you ran on TestingBot, order by last run:

$api->getJobs(0, 10); // last 10 tests

deleteJob

Deletes a test from TestingBot

$api->deleteJob($webdriverSessionID);

stopJob

Stops a running test on TestingBot

$api->stopJob($webdriverSessionID);

getBuilds

Gets a list of builds that you ran on TestingBot, order by last run:

$api->getBuilds(0, 10); // last 10 builds

getBuild

Gets a build from TestingBot (a group of tests)

$api->getBuild($buildIdentifier);

deleteBuild

Deletes a build from TestingBot.

$api->deleteBuild($buildIdentifier);

getTunnels

Gets a list of active tunnels for your account.

$api->getTunnels();

deleteTunnel

Deletes an active tunnel.

$api->deleteTunnel($tunnelID);

uploadLocalFileToStorage

Uploads a local file (.apk, .ipa, .zip) to TestingBot Storage.

$api->uploadLocalFileToStorage($pathToLocalFile);

uploadRemoteFileToStorage

Uploads a remote file (.apk, .ipa, .zip) to TestingBot Storage.

$api->uploadRemoteFileToStorage($urlToRemoteFile);

getStorageFile

Gets meta data from a file previously uploaded to TestingBot Storage. AppUrl is the tb:// url you previously received from the TestingBot API.

$api->getStorageFile($appUrl);

getStorageFiles

Gets meta data from all file previously uploaded to TestingBot Storage.

$api->getStorageFiles();

deleteStorageFile

Deletes a file previously uploaded to TestingBot Storage. AppUrl is the tb:// url you previously received from the TestingBot API.

$api->deleteStorageFile($appUrl);

getAuthenticationHash

Calculates the hash necessary to share tests with other people

$api->getAuthenticationHash($identifier);