Last updated December 24, 2014.

The Drupal.org testbot Puppet provisioning package comes with a Vagrantfile, which you can use to make a virtual machine locally.

The testbot itself is a Drupal-based test runner.

This document shows you a bit of how to use this system. In all cases the testbot runs on Debian OS as a guest machine on whatever host machine you're using; You can use Linux, MacOS, or Windows as the host machine, wherever Vagrant and Virtualbox are supported.

The goal: Run a branch test on a drupal.org project.

We'll run the tests in the Examples for Developers project as an example.

You need:

Phase 1: Install The Stuff

  1. Install VirtualBox and Vagrant. Super-duper easy.
  2. Open up a shell terminal on your computer.
  3. Get the drupaltestbot-puppet project. You'll use git, and instructions are here: https://drupal.org/project/drupaltestbot-puppet/git-instructions But basically git clone --branch master http://git.drupal.org/project/drupaltestbot-puppet.git is the magic incantation. Note that on a Windows host machine you will need to use git clone -c core.autocrlf=input git://git.drupal.org/project/drupaltestbot-puppet.git as we need a repo with *Linux* line endings, not windows line endings
  4. cd drupaltestbot-puppet
  5. vagrant up This will cause vagrant to spend a bunch of time downloading the virtual machine image, and then starting it up and provisioning it.

If you see some errors during provisioning, here are some troubleshooting steps you can take, in ascending order of desperation:

  1. You can run vagrant provision. This will cause Puppet to re-provision the machine, which might work. You can do this as many times as you wish with no ill-effect.
  2. To completely start from scratch again, you can run vagrant destroy and this will demolish your project vagrant box. Then run vagrant up again.
  3. if you're completely out of luck, you can try vagrant box remove DebianWheezy64. 'DebianWheezy64' is the current box specified in the Vagrantfile. You can double check which box to remove by consulting the Vagrantfile.
  4. File an issue in the drupaltestbot-puppet issue queue - Attach a file showing the output of vagrant provision (the whole thing) and give information about your specific environment.

Phase 2: Status Check

Once you've done vagrant-ing up and everything's all spinning along happily, you can log in to the Drupal-based test runner and see if everything's working.

The vagrant virtual machine has a web server and you can get to it by putting this into your web browser: http://172.16.2.100/ (This IP is set in the project's Vagrantfile.)

The login credentials are: admin password: drupaltesting1

Once you're logged in, you can poke around like you would with any Drupal site.

But you really want to look at the PIFR management section: http://172.16.2.100/admin/pifr

  • 'Client Check', which takes a while to load, and then tells you whether the machine can communicate with the various services it needs. This is useful if you think your machine can't download projects to test, for instance. Some of these will be red, but we don't care that much for our purposes.

  • 'Configuration'. This is where you'd put credentials for this testbot if you wanted it to be in the testbot queue. This isn't what we're doing under vagrant, so just leave it all alone; the defaults are great for our purposes.

  • 'Run Tests Locally.' This looks like what we want, right?

Phase 3: Run A Test

Once you're logged in, you can go to the 'Run Tests Locally' page: http://172.16.2.100/admin/pifr/run-test

Let's run our test. Recall that our goal is to run a branch test on Examples for Developers. There are other kinds of tests, as well, but they're left as an exercise for the reader.

  • Make sure the test plugin is set to 'SimpleTest.'

  • Set 'Test Type' to 'Project Branch/Tag.'

  • Click 'Next.' This takes us to the 'Customize SimpleTest Parameters' page.

  • Pick your favorite Drupal core version. Let's choose Drupal 8, because the Examples project for D8 doesn't have many tests to run.

  • For 'Project Name' enter 'examples'.

  • For 'Project Repository' enter the git URL for Examples. Hint: git://git.drupal.org/project/examples.git

  • For 'Project Branch' we'll enter the name of a branch within that git repository. For Examples, that's 8.x-1.x

  • Click 'Run Test.'

  • The test will now run, and will take some time. Unfortunately there's no real-time status display.

Comments

cam8001’s picture

I have downloaded this and have it provisioned locally, but:

a) When I browse to it, I get a standard Apache page, no Drupal, and;
b) I can't login to the shell to see what is up.

I can see some authorised keys in the manifests. Do I need to be added there? Or is there another way to login?

rfay’s picture

It sounds like the provision didn't complete. Run it until it does.

vagrant provision

You can use

vagrant ssh

To log into any vagrant instance.

You'll want to spend just a bit of time experimenting with vagrant to get familiar with it.

Feel free to post a detailed issue in the testbot queue. I won't be able to respond for 2-3 weeks, but others might.

robcolburn’s picture

I'm still a little confused, an example of how to apply a patch to D7 core would be great.

Rob Colburn

iamanupmenon’s picture

Output: [fatal: The remote end hung up unexpectedly
Cloning into \'checkout\'...].
[02:43:13] Main branch [8.0.x] checkout [failed].

Can u please help me out with this error
:)
Thanks in advance

-Mr.Menon