Skip to content

Tests

Automated Tests

Unitary: tests the individual components (each unit) in isolation.

Integration: tests the combined entity of different units, modules or components.

Coverage: test coverage of 99%.

.
├── tests
│   ├── helpers/
│   ├── integration/
│   |   ├── adapters/
|   |   |   ├── gateway/
|   |   |   └── helpers/
│   |   ├── core/
|   |   |   └── usecases/
│   |   └── framework/
|   |       ├── dependencies/
|   |       ├── exceptions/
|   |       ├── fastapi/
|   |       └── middleware/
│   ├── mocks/
│   └── unitary/
│       ├── adapters/
|       |   ├── gateway/
|       |   ├── helpers/
|       |   └── presenters/
│       ├── core/
|       |   ├── data/
|       |   ├── domain/
|       |   └── usecases/
│       └── framework/
|           ├── dependencies/
|           └── exceptions/

You can configure and use the VsCode to test all the scripts with Pytest and Coverage:

launch.json
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python Debugger: FastAPI",
      "type": "debugpy",
      "request": "launch",
      "module": "app.framework.fastapi.main",
      "pythonArgs": ["-Xfrozen_modules=off"],
      "jinja": true,
      "console": "integratedTerminal",
    }
  ]
}
# Setup Venv
make setup

# Activate Venv
source .venv/bin/activate

# Install test dependencies with Poetry
(.venv) poetry install --only test

# Run Pytest in Venv
(.venv) make test

# Run Coverage in Venv
(.venv) make coverage
# Setup Venv
make setup

# Activate Venv
source .venv/bin/activate

# Install test dependencies with Pip
(.venv) pip3 install -r requirements/requirements-test.txt

# Run Pytest in Venv
(.venv) make test

# Run Coverage in Venv
(.venv) make coverage
# Run the App in Docker Container
make docker

# Run Pytest in Docker
make test-docker

# Run Coverage in Docker
make coverage-docker

Pytest

Scopus APIs Request Tests

Install the REST Client VsCode Extension to configure and send requests to Scopus APIs for testing.

REST Client

1. Access the client.http file.
2. Insert your API Key in @apikey =.
3. Click on Send Request.

Client File