vscode-restclient
vscode-restclient copied to clipboard
How to write tests on top of the requests?
How can we write acceptance tests using rest clients. Lets say if i have 50 request how can i test all those 50 calls are success. with some test cases.
How to execute all http calls from cli.
@dhmuralikrishna nice suggestion, I think this feature is quite useful, and I will consider it carefully. Thanks
Compared to postman rest client is very flexible. Don't need to jump in multiple tabs.You did a great job. With postman collection and newman we can run the test through cli. it would be nice if we do the same with rest client.
@dhmuralikrishna nice suggestion, I'd like to keep this request open and wait to see if others vote this up.
Here's a good project to model: https://github.com/eykrehbein/strest
I'd like to see the benefits of this project and strest joined in a single project or have this project leverage an api of strest.
This would be great. I'm thinking something like another divider for assert results:
GET ....
<<<
assert {{response.headers.ContentType == "application/json"}} assert {{response.body.items.length >= 5}}
It would just have an additional data when running it on its own with pass fail. But running it for the whole file would give pass or fail for each.
Plus a compatible cli that can run a set of files.
This has been my go to rest client. Thank you
I've switched to using strest and wrote this plugin: https://github.com/jgroom33/vscode-strest-client
That looks good. I'll check it out. Thanks
assert {{response.headers.ContentType == "application/json"}}
+1 looks more flexible/natural than strest's approach where you code your validations as an AST.
Where is the parser located for the http language? If that could be moved out to a separate package it would be easy to contribute with tooling for testing.
I created a very specific needs that has very similar format with vscode-restclient since I like it's approach. It's still incomplete since we're only using this in our project and we add features as needed. testhttp will also run dependencies, for example you run a test it will run all required calls to populate the variable plus importing a different file to use it's variables too.
I would also like to see a way to implement these tests in a CI system like Jenkins.
@Huachao - It would be worth looking at how httpYac does assertions. https://httpyac.github.io/guide/assert.html
This allows those calls to show up and be run through VS Code's native testing infrastructure. The ability to "run all" via this infrastrucuter is huge. I'd love to see some alignment around the assertion formats. 👍🏻
Cheers!