Orange-OpenSource / Orange-OpenSource/hurl

Print variable value on assert failure

Open
#2,155 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
19.2k
Forks
745
Avg merge
5h 3m
Merged PRs (30d)
60

Description

Problem to solve

When using a variable as value for a Header assert:

{
echo "GET https://hurl.dev"
echo "HTTP 200"
echo "x-frame-options:Hell{{var1}}"
} | hurl --test --variable "var1=o"

I want to be able to compare what I expect (evaluated value is Hello) and what I get (actual value is SAMEORIGIN), but I only get variable name:

-: Running [1/1]
error: Assert header value
  --> -:3:17
   |
 3 | x-frame-options:Hell{{var1}}
   |                 ^^^^^^^^^^^^ actual value is <SAMEORIGIN>
   |

So to be able to compare values, I have to search for this variable over Hurl file, executed command etc...

Proposal

I think we should print only value or both value and name to make it clearer, for example:

error: Assert header value
  --> -:3:17
   |
 3 | x-frame-options:Hello
   |                 ^^^^^ actual value is <SAMEORIGIN>
   |

error: Assert header value
  --> -:3:17
   |
 3 | x-frame-options:Hell{{var1}} --> Hello
   |                                  ^^^^^ actual value is <SAMEORIGIN>
   |

error: Assert header value
  --> -:3:17
   |
 3 | x-frame-options:Hell{{var1}}
   |                 -----------> Hello
   |                              ^^^^^ actual value is <SAMEORIGIN>
   |

error: Assert header value
  --> -:3:17
   |
 3 | x-frame-options:Hell{{var1}}
   |                 ^^^^^^^^^^^^ expected value is <Hello>
   |                                                 ^^^^^ actual value is <SAMEORIGIN>
   |

error: Assert header value
  --> -:3:17
   |
 3 | x-frame-options:Hello (value of Hell{{var1}})
   |                 ^^^^^ actual value is <SAMEORIGIN>
   |

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure with the Hurl input and the --test --variable command shown in the issue. Trace how the Header assert reports its expected value, then define the chosen display of the evaluated variable and actual response value; done means the failure output makes both values directly comparable.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.