Skip to content

Test & Data

Erick Jung edited this page Jun 29, 2020 · 2 revisions

Test & Data

  1. Overview
  2. Test
  3. Data

Overview

Mockingbird focuses on helping teams to test easily, so to accomplish this, a mock can be described as simple 'data' and grouped together in a testset, representing a full test scenario.

It's possible to select a data mock individually without selecting a testset.

If a data mock is selected/unselected after enabling a testset, this test will be unselected automatically.

Test

Adding a new testset

  1. Go to Settings screen
  2. Tap on Open Data Folder
  3. Open the test folder
  4. Create new testset JSON file (ex. /test/test01.json) following convention below
  5. Go to Test screen
  6. Tap on Options > refresh screen or restart mockingbird
  7. Done!

If it's the first time, tap on IMPORT button at Test screen, add new testset and tap REFRESH.

Testset JSON Convention:

{
    "title": "testset name",
    "description": "a description for this testset",
    "tests": [
        "data01",
        "data02"
    ]
}

'data01' is the name of JSON data file with mock information (you don't need to add .json extension).

Selecting a testset

  1. Go to Test screen
  2. Tap on any testset available to enable it
  3. Done!

Data

Adding a new data mock

  1. Go to Settings screen
  2. Tap on Open Data Folder
  3. Open the data folder
  4. Create new data JSON file (ex. /data/data01.json) following convention below
  5. Go to Data screen
  6. Tap on Options > refresh screen or restart mockingbird
  7. Done!

If it's the first time, tap on IMPORT button at Data screen, add new testset and tap REFRESH.

Data JSON Convention:

{
    "title": "data mock title",
    "group": "a group name",
    "description": "a description for this data mock",
    "type": "GET",
    "code": 200,
    "url": "/api/v1/record",
    "payload": "{json}"
}

The 'type' and 'url' are used for pattern matching, and 'code' and 'payload' are returned to the device.

The 'payload' should be a stringified JSON.

Selecting a data mock

  1. Go to Data screen
  2. Tap on any data available to enable it
  3. Done!

Changing data on the fly

While using mockingbird you can change data content on the fly, without need to open json, edit file and refresh screen, so you can play with data faster.

To change data on the fly you just need to:

  1. Select the specific data mock
  2. Change whatever you need on the editor
  3. Done!

You don't need to save or refresh anything using the real-time data editor.