TestingBot Blog

TestingBot provides a cloud of browsers to run Automated, Live and Visual browser testing.

< Back to Blog Overview

Using git to automate your browser testing



If you're looking for a way to run tests after each git commit push, you can use the 'post-commit' hook supplied by git.

In your repository, create a post-commit file:

vim .git/hooks/post-commit

In this file you can for example add a cURL call which will start all your browser tests at TestingBot via API.

curl -u key:secret https://api.testingbot.com/v1/lab/trigger_all -X POST -d ""

Optionally, you can specify an API callback URL at TestingBot, which will be called when all tests are finished. Our API will call your URL and supply the test results in JSON format.

If you only want to do this for a specific branch, you can use this snippet:

while read oldrev newrev refname
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
if [ "master" == "$branch" ]; then
# Do something

Tip: you can also use 'pre-push' or 'post-receive' hooks, depending on when in the git process you'd like to run your tests.

< Back to Blog Overview