-
Notifications
You must be signed in to change notification settings - Fork 64
Running Tests
The PerfKit Explorer client has unit tests run with karma/jasmine.
The necessary libraries for PerfKit client tests are installed using the Node Package Manager (npm). You can find an installer for NodeJS at http://nodejs.org/download/. Once Node is installed, use npm to install the remaining packages in a path outside your project root:
mkdir ~/projects/karma
cd ~/projects/karma
sudo npm install -g karma-cli
npm install -save-dev \
karma karma-jasmine karma-closure karma-chrome-launcher \
karma-jasmine-html-reporter karma-ng-html2js-preprocessor
Once the installation requirements are completed, tests can be run with the following commands (from the project root folder):
cd ~/projects/PerfKitExplorer
cd client
~/projects/karma/node_modules/karma/bin/karma start
The PerfKit Explorer server has unit and integration tests run with PyTest. Once the installation requirements are completed, tests can be run with the following commands (from the project root folder):
cd server
py.test
The necessary libraries for PerfKit server tests are installed using pip. You can find installation instructions for pip at https://pip.pypa.io/en/latest/installing.html. Once pip is installed, use it to install the remaining packages:
sudo pip install pytest webtest google-api-python-client webapp2 mox jinja2
Next, we need to alter our PYTHONPATH
to include AppEngine libraries. One way to accomplish this is editing your ~/.bashrc
or ~/.bash_profile
file with the following entries. Otherwise, use the method of your choice to add the paths noted below:
export PYTHONPATH=$PYTHONPATH:/usr/local/google_appengine
export PYTHONPATH=$PYTHONPATH:/usr/local/google_appengine/lib/fancy_urllib
export PYTHONPATH=$PYTHONPATH:/usr/local/google_appengine/lib/yaml/lib
export PYTHONPATH=$PYTHONPATH:/usr/local/google_appengine/lib
Source the resource file to establish the new paths.
source ~/.bash_profile
At this point, we need to install the virtualenv package. This creates a virtual python environment, and is required for AppEngine handler tests.
sudo pip install virtualenv
Navigate to the /server folder in your project root, and create a new virtualenv:
cd server
virtualenv venv
You can activate your virtual environment from the server
folder with the following command:
source venv/bin/activate
You will see (activate) at the beginning of your shell prompt, ex:
(venv)johndoe-devbox:server johndoe$
Finally, navigate to the server/perfkit
folder and run tests:
cd perfkit
py.test