Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix asserts entries in JSON report #286

Closed
jcamiel opened this issue Oct 10, 2021 · 1 comment
Closed

Fix asserts entries in JSON report #286

jcamiel opened this issue Oct 10, 2021 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@jcamiel
Copy link
Collaborator

jcamiel commented Oct 10, 2021

If I run the following tests:

hurl --test --json /tmp/run.json assert_json.hurl

Where assert_json.hurl is in the integration/test folder, the asserts entries in /tmp/run.json seem broken:

[
  {
    "filename": "assert_json.hurl",
    "entries": [
      {
        "request": {
          "method": "GET",
          "url": "http://localhost:8000/assert-json",
          "headers": [
            {
              "name": "Host",
              "value": "localhost:8000"
            },
            {
              "name": "Accept",
              "value": "*/*"
            },
            {
              "name": "User-Agent",
              "value": "hurl/1.3.1"
            }
          ],
          "cookies": [],
          "queryString": []
        },
        "response": {
          "httpVersion": "HTTP/1.0",
          "status": 200,
          "cookies": [],
          "headers": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Content-Length",
              "value": "160"
            },
            {
              "name": "Server",
              "value": "Flask Server"
            },
            {
              "name": "Date",
              "value": "Sun, 10 Oct 2021 11:45:27 GMT"
            }
          ]
        },
        "captures": [],
        "asserts": [
          {
            "actual": "1.0",
            "expected": "1.0"
          },
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
          {},
...

The first assert entry :

         {
            "actual": "1.0",
            "expected": "1.0"
          },

has maybe not enough information. The assert result success of false is missing, and there is no information about the query, predicate etc...

In comparison, the hurl json export of this assert is:

{
           "query": {
              "type": "jsonpath",
              "expr": "$.count"
            },
            "predicate": {
              "type": "equal",
              "value": 5
            }
}
@lepapareil lepapareil added this to the 1.4 milestone Oct 12, 2021
@lepapareil lepapareil removed the 1.4.0 label Oct 12, 2021
@fabricereix
Copy link
Collaborator

Simple json objects have been added for each assert in #301
such as

{
    "success": false,
    "message": "Assert Failure\n  --> tests/error_assert_value_error.hurl:4:0\n   |\n 4 | header \"content-type\" equals \"XXX\"\n   |   actual:   string <text/html; charset=utf-8>\n   |   expected: string <XXX>\n   |",
    "line": 4
}

@fabricereix fabricereix added the bug Something isn't working label Oct 17, 2021
@fabricereix fabricereix changed the title Some asserts entries in json report are broken Fix asserts entries in JSON report Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants