Features
< Back to Blog Overview

Git hook for Selenium

2015-05-20
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews

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:

#!/bin/bash

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

    fi
done

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.

TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

blank

At TestingBot we make sure that all VMs running in our network are patched with the latest updates. We make sure to update our Windows Virtual M...

Read more
blank

At TestingBot, we like our users to profit from fast access to our VMs. In our manual testing area, we provide a way to pick an Operating System...

Read more
blank

2014 for TestingBot

2014-12-29

As we're approaching the end of 2014, we like to list a few goals TestingBot achieved this year: The number of paying customers increased by 43%...

Read more
blank

Our Selenium grid now supports running your Selenium tests with a different version of Selenium. By default, we always run your tests on Selenium ...

Read more
TestingBot has moved to its own cloud!

Ever since we started TestingBot (almost 2 years ago!) we've been running TestingBot on Amazon AWS (EC2 + S3 + other services).

Read more
TestingBot open-sources NodeJS based Selenium grid

Today we've released our NodeJS code which runs our Selenium hub. This code has been running in production for over 11 months now on a single CPU...

Read more