vscode-restclient icon indicating copy to clipboard operation
vscode-restclient copied to clipboard

Executing the saved .http files on another tool

Open lalberto8085 opened this issue 3 years ago • 4 comments

I know this might be a little off topic, but I have created several files to manually test some API and would like to now use those same files to run automated tests.

Are there any tools I can use for this?

Thanks in advance

lalberto8085 avatar Jul 22 '21 16:07 lalberto8085

I don't know a way to do this in this extension (that's not really what it's for).

If you right click the request (one at a time) you can "Generate Code" which can give you powershell snippets. You can then copy / paste these into a ps1 to make an automated test.

asmith3006 avatar Jul 29 '21 10:07 asmith3006

you could try using https://httpyac.github.io/. It provides a cli tool, which is compatible with rest-client.

AnWeber avatar Aug 08 '21 19:08 AnWeber

https://github.com/api1st/httprun is a Windows/Linux command-line tool for executing the .http files that vscode-restclient uses.

api1st avatar Apr 11 '22 09:04 api1st

There's also HTTP Client CLI from JetBrains, which supports the same format.

Here's the command I use to run requests from CLI:

docker run --rm -t -v \
 		.:/workdir \
 		--network=my_project_network \
 		jetbrains/intellij-http-client \
 		requests.rest

You need to add a named docker-compose network for this to work:

networks:
    default:
        name: my_project_network

mindaugasw avatar Mar 29 '24 00:03 mindaugasw