Orange-OpenSource / Orange-OpenSource/hurl

Have a nice diff when comparing bodies

Open
#86 2 comments 2 reactions 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

It looks like when using body assertions there is no simple way to compare actual and expected values.

E.g. : I make a request that returns body

{
    "id": 0,
    "name": "Frieda",
    "picture": "images/scottish-terrier.jpeg",
    "age": 3,
    "breed": "Scottish Terrier",
    "location": "Lisco, Alabama"
}

In my hurl file is as follows :

# Get a doggy thing:
GET https://example.net/api/dogs/

HTTP/1.1 200
{
    "id": 0,
    "name": "Julien",
    "picture": "images/scottish-terrier.jpeg",
    "age": 3,
    "breed": "Scottish Terrier",
    "location": "Lisco, Alabama"
}
<img width="1033" alt="Capture d’écran 2020-11-20 à 14 55 40" src="https://user-images.githubusercontent.com/113336/99807944-77a2ee80-2b40-11eb-8855-ce559a130fcf.png">

The output is

error: Assert Body Value
  --> ./integration/test-files/nominal/edito/accessory-orange.hurl:36:1
   |
36 | {
   | ^ actual value is < {
    "id": 0,
    "name": "Frieda",
    "picture": "images/scottish-terrier.jpeg",
    "age": 3,
    "breed": "Scottish Terrier",
    "location": "Lisco, Alabama"
} >

Would it be possible to have a simple way to diff the actual and expected ? Like what is possible with JUnit failed string comparisons.

Capture d’écran 2020-11-20 à 14 56 41

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

Use integration/test-files/nominal/edito/accessory-orange.hurl as the reproduction, focusing on its failing body assertion. Trace how the CLI reports the actual value for that assertion, then define done as showing a readable diff between the expected and actual bodies when they differ.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.