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
237 stars 20 forks source link

Running tests in parallel #177

Closed sir-farfan closed 1 year ago

sir-farfan commented 1 year ago

Hello This plugin and it's cli have been quite helpful so far, we have over 20 test packages (.http files) for one project.

Currently, when I click the run button in the folder, it randomly runs them all but one at a time.

Is it possible to set some kind of concurrency queue so that runs a few in parallel?

AnWeber commented 1 year ago

Yes it is possible to design the test execution in parallel. I determine the list of all tests in advance and then execute them sequentially. https://github.com/AnWeber/vscode-httpyac/blob/main/src/provider/test/testRunner.ts#L29-L39

However, starting each Promise would be relatively complex, as not too many should be run at the same time and you need something like https://github.com/sindresorhus/p-queue to do this efficiently (p-queue is esm and not possible to use). Alternative would be to run it via the rateLimit metadata, which is a simplified algorithm for the same issue. I'll think about it once and see how it would go. There is also the risk that parts of httpyac are not threadsafe, so to speak. I would know no problems currently, but is not tested

AnWeber commented 1 year ago

Parallel test execution would be built in. However, I have not currently activated it. Just set the setting httpyac.testMaxConcurrency to a value > 1. I think I do have a problem with parallel execution when using @ref. But I need to check it more.