This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

@restqa/restqdata

0.1.1 • Public • Published

restqdata

One of the key challenge of test automation is using up to data data, RestQData is a simple library to support your test automation by connecting to a specific dataset and serve it to you as a JSON object

Build


Features

  • Serve data from Google Sheet
  • Serve data from Confluence
  • Serve data from local csv file
  • NodeJs version
  • Server version

Usage

The Libary way

Setup

Install the library into your project:

npm i -S @restqa/restqdata

Example (Getting data from google sheets)

const RestQData = require('@restqa/restqdata')

let options = {
  channel: 'google-sheet',
  config: {
    id: 'your-google-sheet-id',
    apikey: 'your-service-account-api-key'
  }
}

const data = RestQData(options)
data.get('users', 3) // get the sheet named "users" and get the row number 3
  .then(response => {
    console.log(response)
    /*
    output:
      {
        firstname: "john",
        lastname: "doe",
        column: "value",
        ...
      }
    */
  })
  .catch(err => {
    console.log(err)
  })

Example (Get the location of a flat file stored)

// Let say the file 'avatar.png' is stored into the '/custom-storage' folder

const RestQData = require('@restqa/restqdata')

let options = {
  storage : '/custom-storage'
}

const data = RestQData(options)
data.storage('users', 3)
  .then(response => {
    console.log(response)
    /*
    output: /custom-storage/avatar.png
    */
  })
  .catch(err => {
    console.log(err)
  })

Options

  • storage (optional) Define a storage location where you are hosting custom files, default: /tmp/
  • channel (required) should be on the the following value : google-sheet, confluence, csv
Google sheets
Confluence
  • config.url (required) The url of your confluence server
  • config.space_key (required) The space identifier where the dataset page is located
  • config.auth.username (required) The authentication username
  • config.auth.password (required) The authentication password
  • config.prefix_title (optional) The prefix of your resource page , default: Dataset (example: to get the resource "user", the script will search for a page called "Dataset users")
Excel (csv)
  • config.folder (required) The folder where the dataset files are stored
  • config.delimiter (optional) delimiter userd in the csv, default: ,

The Server way

@todo


License

You can check out the full license here

This project is licensed under the terms of the MIT license.

Package Sidebar

Install

npm i @restqa/restqdata

Weekly Downloads

0

Version

0.1.1

License

ISC

Unpacked Size

31.4 kB

Total Files

22

Last publish

Collaborators

  • olivierodo
  • tonygo