test_history_server documentation

Unit test history report server

Contents

Installation

Prerequisites

  • Apache
  • MySQL
  • Python
  • Pip

Install the latest revision from GitHub

Run the following command to install the latest version from GitHub:

pip install git+https://github.com/KarrLab/test_history_server.git#egg=test_history_server

Configure the package

  1. Create a MySQL database

  2. Edit the site and database configuration in /path/to/web-server/test_history_server/test_history_server/site/settings.py

  3. Setup the database:

    cd /path/to/web-server/test_history_server/test_history_server/site
    python manage.py makemigrations core
    python manage.py migrate
    
  4. Edit the server configuration in /path/to/web-server/test_history_server/test_history_server/site/wsgi.py

Usage

Browsing test histories

To browse test histories, open the URL specified by BASE_URL in /path/to/web-server/test_history_server/test_history_server/site/settings.py.

Uploading test reports

The following example illustrates how to add test reports to the database:

import requests

r = requests.post('<settings.BASE_URL>/rest/submit_report',
      data={
          'token': <test_server_token>,
          'repo_name': <repo_name>,
          'repo_owner': <repo_owner>,
          'repo_branch': <repo_branch>,
          'repo_revision': <repo_revision>,
          'build_num': <build_num>,
          'report_name': <extra textual label for individual reports within build, such as to indicate results from different versions of Python>,
      },
      files={
          'report': </path/to/junit-style-XML-test-report.xml>,
      })

r_json = r.json()

if not r_json['success']:
    raise BuildHelperError('Error uploading report to test history server: {}'.format(r_json['message']))

REST API documentation

  • Endpoint: <settings.BASE_URL>/rest/submit_report
  • Method: POST
  • Arguments:
    • token (string): secret token used to authenticate with server
    • repo_owner (string): user or organization which owns the GitHub repository
    • repo_name (string): the name of the GitHub repository
    • repo_branch (string): the name of the branch of the repository that was tested
    • repo_revision (string): the SHA1 key of the revision that was tested
    • build_num (integer): the build number that was tested
    • report_name (string, optional): textual label for individual reports within build, such as to indicate results from different versions of Python
    • report (file): JUnit-style XML test report

About

License

The software is released under the MIT license

The MIT License (MIT)

Copyright (c) 2016 Karr Lab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Development team

This package was developed by the Karr Lab at the Icahn School of Medicine at Mount Sinai in New York, USA.

Acknowledgements

This work was supported by a National Institute of Health MIRA award [grant number 1 R35 GM 119771-01].

Questions and comments

Please contact the Karr Lab with any questions or comments.