How to use specs2 to test spray-swagger REST API endpoints? - swagger

spray-swagger appears to be a good way to auto-generate documentation as well as client stubs for a REST API. Is there a way to automatically test these APIs using specs2?

Related

Ruby on Rails equivalent to Django's SchemaGenerator

I am currently looking into adding Swagger to an API that I work on. I found rswag, but from what I can tell, I would have to manually write specs for every endpoint in my API. This API has hundreds of endpoints, so this isn't very feasible.
Django REST Framework has SchemaGenerator which can generate an OpenAPI schema, either as a static file to commit and edit as you see fit or a dynamic endpoint which can be consumed by Swagger UI. Is there any equivalent for Ruby on Rails?
As a side note, I am also using jsonapi-resources. I'd be open to tools that are specific to JSON API.

Can I write API contract tests (consumer driven) using RestAssured framework?

I wanted to implement some contract tests and was looking at different frameworks like Pacto, Postman etc. I am familiar with RestAssured so just wanted to ask if it is possible to write api contract tests using Restassured and are there any good examples of it ?
Here is an article about that : https://hmh.engineering/how-to-write-and-validate-pact-contracts-using-junit5-and-restassured-72b578e7dd65

How to perform Ui functional automation testing using Restassured?

I need to automate my web application functionality using rest assured.
Means there are no endpoints to verify the functionality of login module on the homepage and I need to automate same login Page functionality using Rest Assured.
Please, anyone, tell me to know the solution of my this query.
Rest-Assured is just a REST testing tool, you can't use it to perform UI functional testing.
You should use one of the tools dedicated to that, like Selenium.
The best way to go is to split your testing in two separate projects.
Backend functional testing with Rest-Assured (Making REST calls).
Frontend functional testing with Selenium (Using Selenium).

How to generate Java REST client from Spring REST Docs like it is generated from swagger.json?

My team used swagger for documenting REST API.
As a QA engineer I was able to generate rest client from swagger.json that was published on remote server upon deploy and use the client for REST API integration testing.
Now we are about to switch from swagger to Spring REST Docs.
QUESTION:
Is there a way to generate java rest client from Spring REST Docs like it was possible for swagger?
If yes - how to do that?
If no - are there any alternative ways to get/generate REST API client.
There's actually a Spring Rest Docs extension now that generates an OpenAPI 2/3 spec which you can then use to do additional things - like generate a client
https://github.com/ePages-de/restdocs-api-spec

Skip API calls on tests

I make API calls when create a user but I don't want do this calls on test environment.
What do you do with on this situations? I have external APIs like Mailchimp and internal APIs to communicate with others apps, how do you to test or not this APIs?
Mocking API is the purpose of fakeweb presented in this railscast.
I think you need to mock your API calls then using some mocking libraries for Ruby.

Resources