Simple example with dependency

{
    "name": "update_user_details",
    "description": "Update user details",
    "url": "/api/v1/users/{userId}",
    "method": "PUT",
    "variables": {
        "newUserName": "{dataset.names}"
    },
    "payload": {
        "name": "{newUserName}"
    },
    "dependencies":[{
        "api": "create_a_user",
        "variable": {
            "userId": "response.id",
            "oldUserName": "response.name"
        }
    }]
}

Simple example with assertions

{
    "id": "f06b299a-82d0-4e27-af7f-8b46ca23d7d4",
    "app": "{appName}",
    "name": "users_crud2",
    "endpoints": [
        {
            "name": "01_get_all_users",
            "description": "List all users",
            "url": "/api/v1/users",
            "method": "GET",
            "expect": {
                "status": 200,
                "headers": {
                    "content-type": "application/json"
                },
                "response": {
                    "There should be more than 10 users": "{response.length} > 10",
                    "Atleast one user should be admin": "{response.all.isAdmin}.filter(isAdmin => isAdmin).length === 0",
                    "All users have an ID of 32 characters": "{response.all.id}.every(id => id.length === 36)"
                },
                "timing": {
                    "total": "<700",
                    "firstByte": "<300"
                }
            }
        }
    ]
}

Datasets and variables usage

{
    "id": "319ac86a-f2d7-4cb4-a7fc-5910fe0154d4",
    "app": "demo",
    "name": "users_demo",
    "endpoints": [
        {
            "name": "create_a_user",
            "description": "Create a new User",
            "url": "/api/v1/users",
            "method": "POST",
            "scripts": {
                "before-endpoint": "variables.spells = [...new Array(10)].map(() => '{dataset.spells}'); return { variables }"
            },
            "variables": {
                "userName": "{dataset.harrypotter}",
                "password": "[a-zA-Z0-9]{7,15}"
            },
            "payload": {
                "name": "{userName}",
                "country": "{dataset.countries}",
                "motto": "{lorem_5000}",
                "favorites": {
                    "spells": "{spells}",
                    "quote": "{dataset.quotes}",
                    "gameOfThronesCharacter": "{dataset.got}",
                    "marvelCharacter": "{dataset.marvel}",
                    "starWarsCharacter": "{dataset.starWars}",
                    "celestialObject": "{dataset.space}",
                    "pokemon": "{dataset.pokemon}"
                }
            },
            "expect": {
                "status": 201
            }
        }
    ]
}

Scripts lifecycle

{
    "id": "some unique Id",
    "app": "exampleApp",
    "name": "e_scripts_lifecycle",
    "scripts": {
        "before-scenario": "logger.log('Lifecycle Hook: before-scenario')",
        "after-scenario": "logger.log('Lifecycle Hook: after-scenario')",
        "before-each": "logger.log('Lifecycle Hook: before-each')",
        "after-each": "logger.log('Lifecycle Hook: after-each')",
        "after-globals": "logger.log('Lifecycle Hook: after-globals')"
    },
    "endpoints": [
        {
            "name": "sample_api_for_scripts",
            "description": "Sample API to show lifecycle hooks",
            "url": "/api/v1/test",
            "scripts": {
                "before-endpoint": "logger.log('Lifecycle Hook: before-endpoint')",
                "after-endpoint": "logger.log('Lifecycle Hook: after-endpoint')",
                "after-dependencies": "logger.log('Lifecycle Hook: after-dependencies')"
            }
        }
    ]
}

Github API v3 sample tests

{
    "id": "some unique Id",
    "app": "exampleApp",
    "name": "e_github_api_v3_repos_crud",
    "endpoints": [
        {
            "name": "01_get_all_repos",
            "description": "Load all repositories that the user has access to",
            "url": "/users/{username}/repos",
            "method": "GET",
            "variables": {
                "username": "sarathm09"
            },
            "headers": {
                "User-Agent": "Vibranium"
            }
        },
        {
            "name": "02_create_a_repo",
            "description": "Create a new repository with a random name",
            "url": "/user/repos",
            "method": "POST",
            "payload": {
                "name": "{repoName}",
                "description": "{repoDescription}",
                "homepage": "https://github.com",
                "private": false,
                "has_issues": true,
                "has_projects": true,
                "has_wiki": true
            },
            "variables": {
                "repoName": "{dataset.names}",
                "repoDescription": "{dataset.quotes}"
            },
            "expect": {
                "status": 201,
                "response": {
                    "Verify that the the repo name is same": "'{response.name}' === '{repoName}'"
                }
            },
            "headers": {
                "User-Agent": "Vibranium"
            }
        },
        {
            "name": "03_delete_a_repo",
            "description": "Delete a newly created repository",
            "url": "/repos/{username}/{reponame}",
            "method": "DELETE",
            "dependencies": [
                {
                    "api": "02_create_a_repo",
                    "variable": {
                        "reponame": "name",
                        "username": "owner.login"
                    }
                }
            ],
            "expect": {
                "status": 204
            },
            "headers": {
                "User-Agent": "Vibranium"
            }
        }
    ]
}