Star

Created With

linkSpecs Section

Required section that provides a list of individual HTTP requests to run.

⚠️ Note: at least one spec is required for the suite to be valid.

specs/star-wars-service.yml
1linkmeta:

2link name: Star Wars suite

3linkconfiguration:

4link scheme: https

5link host: swapi.dev

6link base_path: /api

7linkspecs:

8link - name: Fetch info about Luke Skywalker

9link request:

10link path: /people/1/

11link method: get

12link accept: application/json

13link response:

14link status_code: 200

15link headers:

16link - name: content-type

17link value: !!js/regexp application/json

18link json_data:

19link - path: $.name

20link value: Luke Skywalker

21link after_test:

22link run_type: inline

23link inline:

24link function: !!js/function >

25link function() {

26link this.suite.person = JSON.parse(this.response.body);

27link }

28link - name: Fetch each movie that Luke Skywalker is in

29link loop:

30link type: dynamic

31link dynamic:

32link run_type: inline

33link inline:

34link function: !!js/function >

35link function() {

36link return this.suite.person.films;

37link }

38link before_test:

39link run_type: inline

40link inline:

41link function: !!js/function >

42link function() {

43link this.test.path_params = {

44link id : this.loopItem.match(/\/api\/films\/(\d+)\//)[1]

45link };

46link }

47link request:

48link path: /films/{id}/

49link method: get

50link accept: application/json

51link response:

52link status_code: 200

See also:



linkRetry

Use the retry spec level property to automatically retry the spec. Example use case is polling a job until in completed state after a while.

linkcount

How many times to retry this spec.

linkwait_before_each

Number of milliseconds (ms) between retry attempts.

1link - request:

2link path: /status

3link method: get

4link retry:

5link count: 3

6link wait_before_each: 10

7link response:

8link status_code: 200

Specs SectionRetrycountwait_before_each

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