Skip to content

Run ScanAPI Locally

Camila Maia edited this page May 25, 2021 · 6 revisions

Install

Requirements:

Fork or clone the repository and enter into the project's folder:

$ git clone git@github.com:scanapi/scanapi.git
$ cd scanapi

Create a virtualenv for ScanAPI and activate it:

$ make sh

Install the dependencies:

$ make install

Run

Run the ScanAPI:

$ poetry run scanapi

For help, run:

$ poetry run scanapi --help

As you may noticed, you need an API specification file to run ScanAPI properly. Otherwise you will receive this error:

$ poetry run scanapi
ERROR:scanapi:Could not find API spec file: scanapi.yaml. [Errno 2] No such file or directory: 'scanapi.yaml'

For that, we have the ScanAPI Examples repository, with some API specification examples that you can use.

Clone ScanAPI Examples

In another terminal tab, outside scanapi folder, clone the ScanAPI examples project:

$ git clone git@github.com:scanapi/examples.git

Your workspace should have these both folders now:

▶ ls
scanapi               examples

Activate the virtualenv created before:

$ cd scanapi
$ make sh

Run the ScanAPI for the API example you prefer:

PokèAPI

$ poetry run scanapi run examples/pokeapi/scanapi.yaml -c examples/pokeapi/scanapi.conf -o examples/pokeapi/scanapi-report.html

Demo-API

$ poetry run scanapi run examples/demo-api/scanapi.yaml -c examples/demo-api/scanapi.conf -o examples/demo-api/scanapi-report.html

Tests

To run the tests, run:

$ make test