Skip to content

Consecutive requests with CLI do not use #3

@diazjf

Description

@diazjf

When performing consecutive (one-after-another) requests using the CLI, post response variables are not captured.

Example

Collection: doggy_daycare_collection.zip

  1. We run the Create Dog request as follows:
fern@fern-zenbook:~/Collections/Doggy_DayCare/Doggy Daycare$ bru run Dogs/Create\ Dog.yml --env Local
Dogs/Create Dog (201 Created) - 30 ms

📊 Execution Summary
┌───────────────┬──────────────┐
│ Metric        │    Result    │
├───────────────┼──────────────┤
│ Status        │    ✓ PASS    │
├───────────────┼──────────────┤
│ Requests      │ 1 (1 Passed) │
├───────────────┼──────────────┤
│ Tests         │     0/0      │
├───────────────┼──────────────┤
│ Assertions    │     0/0      │
├───────────────┼──────────────┤
│ Duration (ms) │      30      │
└───────────────┴──────────────┘
  1. Run the Get Dog request as follows:
bru run Dogs/Get\ Dog.yml --env Local
Dogs/Get Dog (404 Not Found) - 15 ms
Tests
   ✕ should return 200 OK
      expected 404 to equal 200
   ✕ should return correct content type
      expected 'text/plain; charset=utf-8' to include 'application/json'
   ✕ should have valid dog fields
      expected 'dog not found\n' to have property 'name'
Assertions
   ✕ res.status: eq 200
      expected 404 to equal 200
   ✕ res.body.id: eq {{newDogId}}
      expected undefined to equal '{{newDogId}}'

📊 Execution Summary
┌───────────────┬──────────────┐
│ Metric        │    Result    │
├───────────────┼──────────────┤
│ Status        │    ✗ FAIL    │
├───────────────┼──────────────┤
│ Requests      │ 1 (1 Failed) │
├───────────────┼──────────────┤
│ Tests         │     0/3      │
├───────────────┼──────────────┤
│ Assertions    │     0/2      │
├───────────────┼──────────────┤
│ Duration (ms) │      15      │
└───────────────┴──────────────┘

We see the Get Dog request fail because {{newDogId}} is never set in Create Dog event hough it is part of the post script.

Other Questions

  1. Is it possible to see the response using the Bruno CLI?
  2. Do sequences (1,2,...) need to be set manually?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions