Saturday, 17 December 2016

Restful Webservices - Manual Testing

Watch Demo


Prerequisite:
- Java
- Tomcat
- Chrome Extension : Advanced REST client
- JsonRestfulWebServicesCRUDExample.war

Set Path for JAVA_HOME
https://automation-home.blogspot.com/2016/08/java-8-installation-and-path-setting.html

Download tomcat and extract the zip file.
http://tomcat.apache.org/

Open the Chrome browser and download the Rest Client extension for Chrome- Advanced REST client
https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo

Download the 'JsonRestfulWebServicesCRUDExample.war' from GitHub
https://github.com/automationhome/JsonRestfulWebServicesCRUDExample/tree/master/JsonRestfulWebServicesCRUDExample/target

Once all the above installations are done perform below steps
- Copy the 'JsonRestfulWebServicesCRUDExample.war' to webapps folder of tomcat
- Start tomcat server and verify services are running
- Open the browser and check tomcat server is started by accessing the url http://localhost:8080

Open the rest client extension(i.e. Advanced REST client) and access the rest webservices by using below methods(i.e. URL's)

Get Method:
To retrieve all products: http://localhost:8080/JsonRestfulWebServicesCRUDExample/products
To retrieve product by id: http://localhost:8080/JsonRestfulWebServicesCRUDExample/product/<<NUMBER>>

Delete Method: 
To delete the product: http://localhost:8080/JsonRestfulWebServicesCRUDExample/product/<<NUMBER>>

PUT Method:
Create the product: http://localhost:8080/JsonRestfulWebServicesCRUDExample/products/
{
"id": 5,
"productName": "Chair Shoe",
"price": 5.8
}

POST Method:
Update the product: http://localhost:8080/JsonRestfulWebServicesCRUDExample/products
{
"id" : 5,
"productName": "Chair Shoe",
"price": 4.8
}

No comments:

Post a Comment