Local Testing- Backend

Introduction

This document will explain how local testing works on Back End apps.

1.Local Testing Framework Workflow

This is a workflow on how to use the Local Testing Framework (LTF). This workflow does not include all of the LTF’s capabilities and features. For requirements and full documentation please refer to npm LTF documenation.

NOTE: To update to latest version of Python SDK run pip install -U corva-sdk in the command line or within requirements.txt file, set corva-sdk==1.2.0 and run pip install -r requirements.txt

Prerequisites

  • Confirm that you have the latest Python SDK version here.

  • Install Node.js

  • Install Docker

  • Within the root directory of your app, install LTF using Node Package Manager by running following command in console:

    • npm i -g @corva/local-testing-framework

NOTE: To update to latest version of Python SDK run pip install -U corva-sdk in the command line or within requirements.txt file, set corva-sdk==1.2.0 and run pip install -r requirements.txt

What is the LTF

The LTF is a tool to help you develop and test Corva stream and scheduled apps locally by mimicking the lamba function retrieving real-time data.

What the LTF is Not  The LTF is not a unit testing tool. Please refer to Pytest
documentation for unit testing.

How It Works

LTF utilizes docker to spin up and run the following containers: MongoDB - data storage.

  • Redis - cache for state management

  • Corva API lite - lightweight server and API to fetch and store data

  • Lambda data app - stream or scheduled only (not applicable for task apps)

LTF performs following steps during the run:

  • Download all required docker images (MongoDB, Redis, Corva API Lite, your app)

  • Launch Mongo

  • Import source data into MongoDB launch redis

  • Launch Corva API lite

  • Prepare Lambda running environment

  • Generate event source from provided source data (real-time stream or scheduled events)

  • Create docker container for the data app

  • Start event loop

  • Shutdown all containers and exit

1 Like