Files
api-guidelines/guides/api-testing-ci-environment.md
apidesigner 81a3388729 Updates guides/api-testing-ci-environment.md
Auto commit by GitBook Editor
2017-05-26 12:27:42 +00:00

1.7 KiB

Jenkins CI Environment for Apiary Project

This guide describes steps necessary for testing an API described in a swagger file with Dredd in a CI Environment (Jenkins, TeamCity).

Environment Prerequisites

The following must be available in the CI environment prior to testing:

  1. Node.js runtime MUST be available in the CI environment:

    $ node -v
    v7.5.0
    
  2. Ruby runtime MUST be available in the CI environment:

    $ ruby -v
    ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin16]
    
  3. Dredd MUST be installed globally in the CI environment:

    $ npm install -g dredd --no-optional 
    
    $ dredd --version
    dredd v2.2.5 (Darwin 16.4.0; x64)
    
  4. Apiary CLI Tool MUST be intalled globally in the CI environment:

    $ gem install apiaryio
    
    $ apiary version
    0.8.0
    
  5. Apiary API Key MUST be set in the CI Environment environment variables:

    $ export APIARY_API_KEY=xyz
    

    To obtain an Apiary API key, head to https://login.apiary.io/tokens.

Testing an API

To test an API within the CI environment provisioned as mentioned in the environment prerequisites you will need the following:

  1. The name (subodmain) of API project at Apiary

    export APIARY_API_NAME=bomapi3
    
    
  2. A swagger.yaml file with the description of API being tested

    To fetch the swagger.yaml file from Apiary run the following command before the test:

    $ apiary fetch --api-name=$APIARY_API_NAME --output="swagger.yaml"
    
  3. The HOST address of the service being tested.