CurrentlYCurrently, I am using different approach automate rest services.
- Coverting JsonConverting JSON schema / JsonJSON files to javaJava Classes with help JSONschema2Pojo. 2.Using
- Using Spring Rest Template to make requests and get Responses as Java Object. private TestRestTemplate rest = new TestRestTemplate(); ResponseEntity response = rest.getForEntity("URL", Request.class);
private TestRestTemplate rest = new TestRestTemplate(); ResponseEntity<ResponceObject> response = rest.getForEntity("URL", Request.class);
From here you can get http Headers as
HttpHeaders headers = p.getHeaders();
ResponseHttpHeaders headers = p.getHeaders();
Response body as -
ResponceObject resBody = response.getbody();ResponceObject resBody = response.getbody();
On top of this if We can use cucumber. we can have a lot reusability of code.
This is more Object Oriented way. I strongly disagree creating manual JsonJSON files
More information can be found at.
http://www.jsonschema2pojo.org/ &
http://www.baeldung.com/spring-boot-testresttemplate
I am thinking creatingto create sample git projectGit projects on this.