All Projects → intuit → saloon

intuit / saloon

Licence: Apache-2.0 license
An E2E test seeder for enterprise web applications

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to saloon

software-testing-resource-pack
Various files useful for manual testing and test automation etc.
Stars: ✭ 38 (+26.67%)
Mutual labels:  test-automation, e2e-tests, testing-tools
Detox
High velocity native mobile development requires us to adopt continuous integration workflows, which means our reliance on manual QA has to drop significantly. Detox tests your mobile app while it’s running in a real device/simulator, interacting with it just like a real user.
Stars: ✭ 8,988 (+29860%)
Mutual labels:  test-automation, e2e-tests, testing-tools
Cypress
Fast, easy and reliable testing for anything that runs in a browser.
Stars: ✭ 35,145 (+117050%)
Mutual labels:  test-automation, e2e-tests, testing-tools
Tork
💞 Tests your Ruby code, in parallel, as you change it
Stars: ✭ 185 (+516.67%)
Mutual labels:  test-automation, testing-tools
Argus Eyes
A lightweight commandline tool for visual regression testing of UI components.
Stars: ✭ 158 (+426.67%)
Mutual labels:  test-automation, testing-tools
Vividus
Vividus is all in one test automation tool
Stars: ✭ 170 (+466.67%)
Mutual labels:  test-automation, testing-tools
Zunit
A powerful testing framework for ZSH projects
Stars: ✭ 140 (+366.67%)
Mutual labels:  test-automation, testing-tools
Recheck Web
recheck for web apps – change comparison tool with local Golden Masters, Git-like ignore syntax and "Unbreakable Selenium" tests.
Stars: ✭ 224 (+646.67%)
Mutual labels:  test-automation, testing-tools
Hitchhiker
a Restful Api test tool
Stars: ✭ 2,175 (+7150%)
Mutual labels:  test-automation, testing-tools
Mockito Scala
Mockito for Scala language
Stars: ✭ 231 (+670%)
Mutual labels:  test-automation, testing-tools
toster
DSL framework for testing Android apps
Stars: ✭ 31 (+3.33%)
Mutual labels:  test-automation, testing-tools
Mockito
Most popular Mocking framework for unit tests written in Java
Stars: ✭ 12,453 (+41410%)
Mutual labels:  test-automation, testing-tools
Swagger meqa
Auto generate and run tests using swagger/OpenAPI spec, no coding needed
Stars: ✭ 151 (+403.33%)
Mutual labels:  test-automation, testing-tools
Botium Core
The Selenium for Chatbots - Bots Testing Bots
Stars: ✭ 181 (+503.33%)
Mutual labels:  test-automation, testing-tools
Stryker Js
Mutation testing for JavaScript and friends
Stars: ✭ 2,043 (+6710%)
Mutual labels:  test-automation, testing-tools
Gauge
Light weight cross-platform test automation
Stars: ✭ 2,622 (+8640%)
Mutual labels:  test-automation, testing-tools
allure-nunit
Archived - Allure adapter for NUnit framework.
Stars: ✭ 45 (+50%)
Mutual labels:  test-automation, testing-tools
eat
Json based scenario testing tool(which can have test for functional and non-functional)
Stars: ✭ 41 (+36.67%)
Mutual labels:  test-automation, testing-tools
vividus-starter
VIVIDUS-based test project template
Stars: ✭ 43 (+43.33%)
Mutual labels:  test-automation, testing-tools
Stryker4s
Mutation testing for Scala. Work in progress...
Stars: ✭ 118 (+293.33%)
Mutual labels:  test-automation, testing-tools

saloon

Persona-Based Test Seeding

Build Status GitHub release Known Vulnerabilities

Are you:

  1. Tired of manually maintaining test data?
  2. Wishing you could reuse seeding logic across projects and test suites?
  3. Needing to speed up and add stability test data generation?
  4. Wanting to build a GUI for generating accounts?

Yeah?! Saloon is the one-stop shop!

What is Saloon?

Saloon is a Javascript library that can generate e2e accounts with enterprise data in mind. All you have to supply is a persona and each of its entity definitions...Saloon will handle the rest.

Saloon works by traversing the persona and asynchronously generating each entity resource according to the entity definition's instructions. Simple! :bowtie:

Other cool stuff:

  • Works with REST and GraphQL
  • Each entity has access to seeded parent data for simple retrieval of id's, auth tokens, etc
  • Expression engine for generating random data
  • Template engine for generating large data sets
  • Automatic retries on failed requests

Usage

  • Import the library.
  • Populate the definition registry
  • Seed with a persona
import saloon from 'saloon';

const definitions = [{
  type: 'restaurant',
  url: 'http://localhost:3000/api/restaurant'
}, {
  type: 'menu',
  url: 'http://localhost:3000/api/menu',
  body: data => ({ restaurantId: data.restaurantId })
}];

const persona = [{
  type: 'restaurant',
  params: {
    name: 'Bobs Burgers',
    owner: 'Bob Belcher',
    address: '123 Abc Rd, Long Island, NY'
  },
  children: [{
    type: 'menu',
    params: {
      name: 'Lunch Menu',
      startTime: '11:00',
      endTime: '14:00'
    }
  }, {
    type: 'menu',
    params: {
      name: 'Dinner Menu',
      startTime: '17:00',
      endTime: '23:00'
    }
  }]
}];

saloon.setDefinitions(definitions);
saloon.seed(persona)
  .then(output => {});

The example above will first seed the restaurant entity, followed by concurrently seeding both lunch and dinner menu entities.

Running the examples

There are two examples provided:

yarn install
yarn run example // A simple example backed by a local, mocked REST API.
yarn run example:graphql // A more complex example involving both REST and GraphQL API's.

Definitions

Definitions tell the seeder information about each resource defined in the persona. Think of each definition as each one of your REST APIs.

  • method (string|function) - HTTP method, defaults to "post"
  • endpoint (string|function) required - Resource URL
  • headers (object|function) - All headers required for the request
  • body (object|function) - Default request body, props can be overridden by the persona (REST ONLY)
  • query (string|function) - GraphQL query string (GRAPHQL ONLY)
  • variables (object|function) - Default GraphQL query/mutation variables (GRAPHQL ONLY)
  • throttle (number|function) - Throttle requests for this definition (some services can't handle concurrent requests)
export default {
  method: 'put', // {string|function} HTTP method for generating resource, defaults to "post".
  endpoint: 'http://localhost:3000/api/user', // {string|function} Resource API endpoint.
  headers: {},
  body: {},
  throttle: 100
};

All definition values can also be functions. This is useful when the endpoint, headers, or body require values from parent resources. The functions will receive a data argument with all parent resource data:

  • data (Object) - A flattened object with all previously seeded data.
export default {
  endpoint: data => `http://localhost:3000/api/user/${data.user.user_id}/return`,
  headers: data => {
    return {
      Authorization: `firmid=${data.firm.firm_id}`
    }
  }
};

Personas

A test suite will have a collection of personas to test different scenarios and use cases. Persona data is modeled as parent-child relationships.

  • type (string) required - Resource type, must have a definition with the same name
  • params (object|string) - Request body OR GraphQL variables
  • children (array) - An array of children resources which will be seeded after the parent is finished.
  • childrenTemplate (object) - A template for dynamically generating children.
  • childrenCount (number) - The number of children to generate, using the template
[
  {
    "type": "user",
    "params": {
      "username": "Homer_Simpson",
      "password": "DuffBeer1",
      "firstName": "Homer",
      "lastName": "Simpson"
    },
    "children": [
      {
        "type": "client"
      }
    ]
  }
]

Templates

As noted above, templates can be used via childrenTemplate and childrenCount to dynamically generate children resources.

[
  {
    "type": "user",
    "childrenCount": "3",
    "childrenTemplate": {
      "type": "client",
      "children": [
        {
          "type": "taxreturn"
        },
        {
          "type": "taxreturn"
        }
      ]
    }
  }
]

Expression Functions

There are number of expression functions available to dynamically generate test data, which can be called using double-braces. Expression functions are only available for REST entities. These functions are especially useful within childrenTemplate blocks. Here are all functions supported, with arguments and their defaults.:

  • {{address()}}
  • {{age()}}
  • {{bool()}}
  • {{ccExpDate()}}
  • {{ccNum(type = null)}}
  • {{company()}}
  • {{country(full = false)}}
  • {{date(american = true, string = true)}}
  • {{dollars(max = 999999999)}}
  • {{domain()}}
  • {{ein()}}
  • {{email(domain = null, timestamp = false)}}
  • {{firstName()}}
  • {{fullName()}}
  • {{gender()}}
  • {{guid(version = 4)}}
  • {{integer(min = -999999999, max = 999999999)}}
  • {{lastName()}}
  • {{paragraph(sentences = 4)}}
  • {{phone(country = 'us', dashes = true)}}
  • {{profession()}}
  • {{ssn(formatted = true)}}
  • {{ssnLastFour()}}
  • {{state(full = false, country = 'us')}}
  • {{url()}}
  • {{year(min = 1900, max = 2100)}}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].