Giter VIP home page Giter VIP logo

flightrecorder's Introduction

alt text

FlightRecorder (fltrec) is a solution for quickly saving and updating mock data json responses from your APIs. FlightRecorder is built around the Postman Newman CLI Tool. Simply reference your postman collection and environment files while running FlightRecorder and your json responses will be saved to the output directory you've specified.

Why Use FlightRecorder?

It's an easy way to create and update mock data for tests

There are a number of network request mocking frameworks available for both iOS and Android. FlightRecorder has built in support for OHHTTPStubs and okhttp/mockwebserver These frameworks allow you to test your app in a reliable way regardless of server state. These mocking frameworks are especially useful when testing UI elements that display responses from a backend service. Using mock responses you can gaurantee that the response will be the same every time so it's easy to write tests against. However, the drawback to these mock responses are that they can get stale. As useful as these tests can be, it's possible that things on the backend can change without you realizing it and leave your tests out of date. FlightRecorder provides an easy way to update all of you mock responses in one go.

Use Postman to automate mock response gathering

Getting all of the mock responses for a whole application can be tedious. However, if you create a postman collection (or already have one) to store all of the network requests your app makes you can regenerate your mock responses and server stubs with a single command!

Installation

npm install fltrec -g

Dependencies

Postman is used to create the API documentation used by FlightRecorder to generate mock server stubs and save responses from the live API.

Demo

alt text

How To

Usage: collection [options]

Options:


-e, --environment <environment>        the relative path to the environment file
-o, --output <output>                  The path to the output directory where you would like to save the network request body responses
-v, --verbose                          verbose logging
-m, --mustache <mustache>              default mustache template [swift, kotlin] or the relative path to the mustache template file
-r, --requestManager <requestManager>  the path to the output directory for the MockNetworkRequestManager
-x, --extension <extension>            extension for mustache template output (e.g. swift, kt, etc...)
-h, --help                             output usage information

Example

The Mock JSON Files are created through the use of a Postman Collection JSON file. You can easily see an example in action by changing directory to the Demo_MockServerOnly folder.

When you first clone this repo the only file in this directory will be the Star Wars API Postman Collection named: SWAPI.postman_collection.json

Postman Example

This postman collection includes folders which contain requests to various Star Wars API endpoints. This folder structure will be re-created and the responses to these requests will be placed in folders in the selected directory mirroring the structure in Postman.

Next, run this command in the terminal in the Demo_MockServerOnly directory: fltrec collection SWAPI.postman_collection.json

Now you should have a new folder in the current directory named api (mirroring what you see in postman) and that folder should be full of saved json responses from the Star Wars API.

folder structure

flightrecorder's People

Contributors

normand1 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

iamthatiam777

flightrecorder's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.