AnWeber / vscode-httpyac

Quickly and easily send REST, Soap, GraphQL, GRPC, MQTT and WebSocket requests directly within Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=anweber.vscode-httpyac
MIT License
222 stars 20 forks source link

Runner-like function to run load tests in VS Code extension? #229

Open victor-marino opened 9 months ago

victor-marino commented 9 months ago

First of all, apologies if this is already possible currently. I'm loving the extension so far, and I've been reading the docs today and trying out all the options I could see. But I couldn't find a way to do this.

Is there any way to:

  1. Run one request or group of requests multiple times?
  2. Obtain a report showing the result code and duration of each request?

I know I can just run all the requests in a given file from start to finish. But I can't do multiple iterations. And even if I could, there doesn't seem to be a clear way to see how many of those requests returned a 200 OK vs a timeout, or a 404 or a 429, short of analising responses one by one.

Ideally, when running a load test I'd like to specify:

  1. The number of iterations
  2. The delay between requests
  3. Whether I want to run them concurrently (all at once) or sequentially (wait for the previous response before launching the next request)

It'd be great if we could see the result presented nicely in a dedicated panel on the right.

Here's the report table I had developed for an Insomnia plugin I was contributing to... right before they pushed me out with their new business model: load_test

This would be really useful to me, as this kind of features are harder to find in other GUI-based tools, or are partially locked behind a subscription like Thunder Client does.

Is there any way to do something like this currently? If not, do you think this could be added?

AnWeber commented 9 months ago

I don't currently have such behavior integrated in vscode, however it would be possible. If you use httpyac directly, you can currently already execute all files of a folder and output the result as JSON. Since everything uses the same API, this would also work in vscode.

httpyac **/*.http --all --json

I also support --repeat, but in a modified way. I create exactly one request and fire it several times in a short amount of time with no delay. But it seems you want the repeat rather after the whole test run. in addition, this currently doesn't play nicely with the JSON output, since not all repeated requests are listed individually, and instead are merged into the JSON output.

In summary, it could work out, but would be a bit of work to get it cool in GUI.

AnWeber commented 9 months ago

@victor-marino The behavior is relatively simple to implement.

victor-marino commented 9 months ago

Thanks a lot for your response @AnWeber, and the orientation on how to implement this.

I don't yet have any experience with TypeScript or VS Code extensions whatsoever, so it may take me some time to wrap my head around the code and its general architecture, even if the added functionality is trivial to implement πŸ˜…

But I will start looking into it whenever I get some spare time, as I'd love to contribute to this project (and of course learn something new along the way!). I may ping you with a question or two in the future if that's OK πŸ˜‰

By the way, if I may ask: judging by the open-source nature and MIT license of the project, I take it you have no plans of monetizing the extension in the future?

I only ask because I've realized pretty much every API client that has a GUI has moved or will move to a subscription model in the future, so I'm just wondering if the same will happen to this kind of projects that are in-between a GUI and a CLI app, sort of.

AnWeber commented 9 months ago

By the way, if I may ask: judging by the open-source nature and MIT license of the project, I take it you have no plans of monetizing the extension in the future?

I will squeeze every penny out of the project:-). Just kidding. Postman/ Insomnia was too closed for me too. That's why I started the project for fun. A central thought of the whole project was also an extensibility, so that even without my help, everything can be built in (that hindered me at vscode-restclient). No future plans for pricing, for sure. I promise. You just have the danger that I'm almost a lone wolf. There is no active community. And there would be several ideas to develop the project further and not much coding time.

I commit my POC for the creation of such a table in OutputChannel httpyac.log, that may help you (see release v6.7.1)

image
victor-marino commented 9 months ago

I will squeeze every penny out of the project:-). Just kidding. Postman/ Insomnia was too closed for me too. That's why I started the project for fun. A central thought of the whole project was also an extensibility, so that even without my help, everything can be built in (that hindered me at vscode-restclient). No future plans for pricing, for sure. I promise. You just have the danger that I'm almost a lone wolf. There is no active community. And there would be several ideas to develop the project further and not much coding time.

0% expectations, 10% chance of success, 1000% improvement potential. Sounds like my cup of tea 😎

I commit my POC for the creation of such a table in OutputChannel httpyac.log, that may help you (see release v6.7.1)

Wow, that's awesome! Thanks a lot. I'll try to look into this when my workload goes down a bit and I get some spare time, but no promises! You know, 0% expectations 😬

And thanks in general for being open and supportive towards my proposal. I see the "not interested" attitude in too many open source projects nowadays!