Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Running Tests

Connor McCoy edited this page Jan 20, 2015 · 13 revisions

Client Tests

The PerfKit Explorer client has unit tests run with karma/jasmine. Once the installation requirements are completed, tests can be run with the following commands (from the project root folder):

cd client

karma start

Environment Setup (client)

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:

npm install karma --save-dev

sudo npm install -g karma-cli

npm install karma-jasmine --save-dev

npm install karma-closure --save-dev

npm install karma-chrome-launcher --save-dev

npm install karma-jasmine-html-reporter --save-dev

npm install karma-ng-html2js-preprocessor --save-dev

Server Tests

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

Environment Setup (server)

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

sudo pip install webtest

sudo pip install google-api-python-client

sudo pip install webapp2

sudo pip install mox

sudo pip install 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

Clone this wiki locally