Click here to Skip to main content
12,999,837 members (48,008 online)
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 6 Apr 2014

AngularJS Unit Testing on Amazon Elastic Bamboo Instance

, 6 Apr 2014
Rate this:
Please Sign up or sign in to vote.
How to setup unit test environment on Amazon Elastic Bamboo instance


I'm working on greenfield SPA web application based on AngularJS. The beauty of this framework is the ability to cover almost every aspect of your application with unit tests. And it is really easy to start if you use boilerplates such as angular-seed which provides unit test core you have to extend with your real tests.

Local setup on Windows laptop was completed in a few minutes: clone angular-seed, run npm to install necessary packages and check karma unit test runner is working and sample tests are green. Although you can have a few small issues related to PATH variables, it doesn't take significant time to fix them and continue.

Then it was a turn of server environment to be set up. I'm not a Linux person and in that moment, even didn't know what kind of Linux is installed there. The only thing I had was SSH access. I have checked that node, npm, karma commands are not recognized and started installation process. After many trials and errors, I stuck on a step of installing of browser (tried both Chrome and Firefox) which is vital for karma unit test runner. There was a dependency on absent GTK+ libraries and I finally gave up with this approach.

But then I found two important things: headless browser PhantomJS which is supported by karma and node which was already installed on the server but not registered anywhere. So I've got clean instance and made following steps which gave me working environment at the end.


Lookup for installed node which gave me /opt/node-0.10/:

find / -name node -print 2>/dev/null 

Link node and npm binaries:

cd /usr/bin 
sudo ln -s /opt/node-0.10/bin/node
sudo ln -s /opt/node-0.10/bin/npm 

Install necessary npm modules (I prefer global deployment):

sudo npm install karma -g 
sudo npm install phantomjs -g
sudo npm install karma-jasmine -g
sudo npm install karma-spec-reporter -g 
sudo npm install karma-phantomjs-launcher -g 

Link karma binary:

sudo ln -s /opt/node-0.10/lib/node_modules/karma/bin/karma 

Modify karma configuration in karma.conf.js from angular-seed to use PhantomJS browser:

browsers: ['PhantomJS'], 
plugins: [ 

And if everything above ended up correctly, the following script from angular-seed should report successful execution of your unit tests (script below was a part of the previous version of angular-seed, now tests are executed using npm and configuration from package.json):

bash /scripts/ 

Points of Interest

This should be a good start for those who never had much Linux/AWS/Bamboo experience but have to setup continuous integration environments in the same server configuration.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Beam Technology
Australia Australia
No Biography provided

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170624.1 | Last Updated 6 Apr 2014
Article Copyright 2014 by Mike114
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid