Most active commenters
  • gavinray(3)

←back to thread

460 points flykespice | 14 comments | | HN request time: 0.996s | source | bottom
1. jicea ◴[] No.44324928[source]
Hi Hurl maintainer here, happy to answer any question and get feedbacks!
replies(7): >>44325286 #>>44325359 #>>44325931 #>>44325991 #>>44326925 #>>44328252 #>>44328285 #
2. jiehong ◴[] No.44325286[source]
Thanks a lot for maintaining it!

Where do you see hurl in the next 2 years?

replies(1): >>44325379 #
3. hiddew ◴[] No.44325359[source]
Hurl is underappreciated for writing nice and maintainable HTTP-level test suites. Thanks for the tool!
4. jicea ◴[] No.44325379[source]
Obviously better IDEs integration, support for gRPC, Websocket would be very cool.

A favorite of mine is to be available through official `apt`: there has been some work but it's kind of stuck. The Debian integration is the more difficult integration we have to deal. It's not Debian fault, there are a lot of documentation but we've struggled a lot and fail to understand the process.

[1]: https://github.com/Orange-OpenSource/hurl/issues/366

replies(1): >>44327359 #
5. gavinray ◴[] No.44325931[source]
So, myself and many folks I know have taken to writing tests in the form of ".http" files that can be executed by IDE extensions in VS Code/IDEA.

Those basically go in the form

   POST http://localhost:8080/api/foo
   Content-Type: application/json

   { "some": "body" }
And then we have a 1-to-1 mapping of "expected.json" outputs for integration tests.

We use a bespoke bash script to run these .http file with cURL, and then compare the outputs with jq, log success/failure to console, and write "actual.json"

Can I use HURL in a similar way? Essentially an IDE-runnable example HTTP request that references a JSON file as the expected output?

And then run HURL over a directory of these files?

replies(2): >>44327779 #>>44328947 #
6. LadyCailin ◴[] No.44325991[source]
Can you organize with the VSCode rest client folk(s?) to come up with a standard for http files?
replies(1): >>44341319 #
7. airstrike ◴[] No.44326925[source]
Arguably off-topic but I just want to say few naming choices give me more satisfaction than Hurl
8. akdev1l ◴[] No.44327359{3}[source]
Looks like you don’t have Fedora package either

If I find time I could throw a spec file + ci/cd workflow to get you going that way too

9. xnorswap ◴[] No.44327779[source]
I like this approach.

Is your expected.json the actual response body, or is it an object containing body, status, header values, and time-taken, etc?

replies(1): >>44329257 #
10. nikeee ◴[] No.44328252[source]
I use Hurl for some time now and even contributed. What are the current chances for getting some form of includes?
11. digikata ◴[] No.44328947[source]
You can use hurl in this way. I have projects with a test directory of hurl files, one hurl file per test case. The cases can run one or more http requests. The hurl file can reference external files, capture values from responses for subsequent requests, validate status and outputs. Hurl has various test runner modes and will optionally output overall test results in various parsable formats if you have a larger reporting framework that you would like to hook into.
replies(1): >>44329272 #
12. gavinray ◴[] No.44329257{3}[source]
It's only the response body, but that's due to not having a usecase to validate headers or status code.

I really like it because it serves 3 purposes:

- API docs/examples that you can interact with

- Test cases

- Manually invoking API endpoints when working on the underlying code, in an iterative loop

13. gavinray ◴[] No.44329272{3}[source]
That's great to know! Do you have an example on-hand by chance?

If that's possible, I guess the only thing I'd request is interopability with the REST Client ".http" files that VS Code/JetBrains IDE's support then.

UPDATE: Found it, looks like you can do it via the below

    POST https://example.org/api/tests
    Content-Type: application/json
    file,insert_user.request.json;

    [Asserts]
    body == file,insert_user.expected.json;
So that just leaves the IDE integration bit.
14. mikmoila ◴[] No.44341319[source]
This is great idea.