SHARE

EDUCATION

Headless integration testing using capybara-webkit

This post is for developers or sysadmins setting up Rails integration testing on a CI system like Travis, Hudson, or Bamboo.

We use Cucumber for integration testing our Rails servers, and by default all Cucumber scenarios tagged with “@javascript” pop up a browser. We needed to get this running headless so we could run these tests on our build machine. We use the Atlassian suite, and Bamboo for CI, running on EC2.

The de facto way of running headless tests in Rails is to use capybara-webkit, which is easy to install and run locally following the guides here.

Capybara-webkit relies on Qt, which is straightforward (though slow) to install on OS X, which we use for development. Our build box however is Amazon Linux, which is supposedly a distant cousin of CentOS. We’re using Amazon Linux because Bamboo OnDemand provides a set of stock Amazon Linux AMIs for builds that we have extended and customized.

We started out following the CentOS 6.3 installation guide from the capybara-webkit wiki above but quickly encountered problems because Amazon Linux doesn’t ship with a lot of libraries you might expect from Redhat or CentOS, like gcc and x11.

Here are the steps we followed to get Qt installed and our headless Cucumber tests running on our Bamboo build machine. This installation process was tested on ec2 AMI ami-51792c38 (i686).


# First install dependencies listed on http://qt-project.org/doc/qt-4.8/requirements-x11.html that do not ship with amazon linux amis.
# If you dont do this, ./configure below will fail with errors like "Basic XLib functionality test failed!"

yum install -y gcc-c++
yum install -y libX11-devel
yum install -y fontconfig-devel
yum install -y libXcursor-devel
yum install -y libXext-devel
yum install -y libXfixes
yum install -y libXft-devel
yum install -y libXi-devel
yum install -y libXrandr-devel
yum install -y libXrender-devel
 
# download, configure, and install qt from source
wget http://download.qt-project.org/official_releases/qt/4.8/4.8.5/qt-everywhere-opensource-src-4.8.5.tar.gz
tar xzvf qt-everywhere-opensource-src-4.8.5.tar.gz
cd qt-everywhere-opensource-src-4.8.5
./configure --platform=linux-g++-32
 
# caution: this will take a long time, 5 hrs on an m1.small!
gmake
gmake install
 
# add qmake location to path
export PATH=$PATH:/usr/local/Trolltech/Qt-4.8.5/bin/
 
# now finally gem install will work!
gem install capybara-webkit

Curious about Pedago online education? Enter your email address to be added to our beta list.

Questions, comments? You should follow Pedago on Twitter.


SHARE

Trending now

Title of the article is shown, along with the logo for Quantic School of Business and Technology and a 3D image of an AI icon.
ARTIFICIAL INTELLIGENCEJanuary 28, 2025
10 Software Engineering Skills Needed to Lead in the AI Economy

It has been predicted that AI will contribute $19.9 trillion to the global economy through 2030. However, if this potential is to be realized, there will be an acute need for technically skilled leaders and software engineering professionals able to bridge the gap between the remarkable emerging capabilities of foundation AI models such as ChatGPT, …

MSSE image horizontal
ARTIFICIAL INTELLIGENCEDecember 6, 2024
Software Engineering Careers: Thrive in the Age of AI

The global AI Development Tool Software market is rapidly expanding, with revenue reaching $8.44 billion in 2024 and growing at an annual rate (CAGR) of 8.61%, hitting $12.75 billion by 2029. As a result, this surge reflects the increasing adoption of AI technologies across industries, dramatically reshaping how software engineers design, deploy, and manage applications. …

EDUCATIONSeptember 23, 2024
MiyaMiya, Impact Arm of Pedago, Quantic’s Sister Company, is Named Clinton Global Initiative Commitment Maker, Expands STEM Education Access in Cambodia

September 23, 2024 – MiyaMiya, the philanthropic arm of Pedago, the sister company of Quantic School of Business and Technology, has been honored as a Commitment Maker by the Clinton Global Initiative (CGI). This recognition highlights MiyaMiya’s dedication to advancing education, specifically STEM learning, in Cambodia. As part of this commitment, MiyaMiya will spearhead a …

Ready to jump start your career?

Start learning with Quantic.