Star

Created With

linkSpec Config Section

Controls basics about where the endpoint lives (e.g. server, port).

These settings apply to all specs in an entire suite file.

1linkmeta:

2link name: Make sure Google loads

3link locate_files_relative: true

4linkconfiguration:

5link host: api.mycompany.com

6link scheme: http

7link port: 1337

8link base_path: /api/v3

9linkspecs:

10link - name: Fetch users

11link request:

12link method: get

13link path: /users

14link response:

15link status_code: 200

16link# http://api.mycompany.com:1337/api/v3/users



linkscheme

What protocol (scheme) to use. Generally, http or https



linkhost

What server to use.



linkport

A custom port to use. Note that it must be a number.



linkbase_path

An optional base path to prepend to each URL.



linkcustom_configuration

Dynamically set any of the configuration using either an inline or external JS function.


linkJS Inline Function

See also:

1linkconfiguration:

2link scheme: https

3link port: 443

4link base_path: /api

5link custom_configuration:

6link run_type: inline

7link inline:

8link function: !!js/function >

9link function() {

10link if (process.env.NODE_ENV === 'dev') {

11link this.scheme = 'http';

12link this.port = 1337;

13link this.host = 'localhost;

14link return;

15link }

16link this.host = `${process.env.NODE_ENV || 'www'}.yourcompany.com`;

17link }

18link# NODE_ENV=dev --> http://localhost:1337/api

19link# NODE_ENV=qa --> https://qa.yourcompany.com/api

20link# NODE_ENV="" --> https://www.yourcompany.com/api


linkJS Inline Async function

See also:

1linkconfiguration:

2link host: yourcompany.com

3link scheme: https

4link port: 443

5link base_path: /api

6link custom_configuration:

7link run_type: inline

8link inline:

9link function: !js/asyncFunction >

10link async function() {

11link this.scheme = 'http';

12link this.port = 3027;

13link }

14link# https//yourcompany.com:3027/api


linkJS Module

See also:

1linkconfiguration:

2link host: yourcompany.com

3link scheme: https

4link port: 443

5link base_path: /api

6link custom_configuration:

7link run_type: module

8link module:

9link module_path: config/test.js

10link function_name: configureForEnv # --> 'this'bound to suite object, e.g. this.host, this.port, etc.

Spec Config Sectionschemehostportbase_pathcustom_configurationJS Inline FunctionJS Inline Async functionJS Module

Home

Getting Startedchevron_right
Basicschevron_right
Requestchevron_right

Request Basics Headers Cookies Query Parameters Path Parameters

Payload Bodychevron_right

File Uploads Auto-Retry Additional Options

Response Validationchevron_right

Overview

Assertionschevron_right

Status Code Headers & Cookies

Bodychevron_right
Hooks & JSchevron_right

Overview

Function Typeschevron_right
Suite-Level Hookschevron_right
Spec-Level Hookschevron_right
Contextchevron_right
DRY & Reusing Specschevron_right
Command Line Interface (CLI)chevron_right