SlideShare a Scribd company logo
1 of 6
Groovy Tutorials With SOAP UI
                                                                            1




(C ) All copy rights to Ravi Reddy, Dilip & Abdur (ravireddy76@gmail.com)
Presentation to illustrate to write web service integration test using
groovy in soap UI.

 I’m unable to find a valuable solutions in online forums to write a simple integration tests for web services.

 Here I want demonstrate how to write services integration test for restful end points using groovy in SOAP UI for
  simple CRUD operations.

Tools 2 Use                                                               C:Program Files (x86)SmartBearsoapUI-4.0.1

         •     SOAP-UI
         •     Jersey (JAX-RS) API’s
                 • jersey-client-1.8
                 • jersey-core-1.8
                 • jersey-server-1.8
                 • jersey-test-framework-1.1.5.1
                 • SOAPRestClient (Custom jar file)

Download and copy above jars (libraries) to lib of Soap UI
installation folder show in the image.



** Note : Ping me @: ravireddy76@gmail.com SOAPRestClient is custom jar file which consists of wrapper class to consume REST end points for
                   POST/PUT/DELETE/GET operations.




(C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)                                                                         2
»      Create a REST end point project in SOAP UI tool which is shown in below image
          Create a Test Suite called “ServiceIntegration-TestSuite”.
          Create a test case (Example: CustomerService-IntegrationTest show in image)
          Create a new Groovy script as a test case.




  In above example I’m showing a example for CRUD (Create, Read, Update, Delete) operations for a customer service.




(C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)                                                3
Below examples presenting CRUD operations for customer service integration test using groovy script in SOAP UI

            ** Note : use your REST end point with appropriate input either JSON/XML format.

             Create Customer
            def CREATE_CUSTOMER_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD-
                                            POC/services/customerService/addCustomer";
            def createCustomerLogRef = "Create Customer Information::";
            def customerJsonInput = buildJsonInput();
            ClientResponse createCustomerResponse = serviceResoruces.postResponse(CREATE_CUSTOMER_ENDPOINT,customerJsonInput);
            log.info(createCustomerLogRef+"Response Status = "+createCustomerResponse.getStatus());
            assert createCustomerResponse.getStatus() == 204
            log.info("----------------------------------------------------------------------------------------------");




             Update Customer
            def UPDATE_CUSTOMER_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD-
                                             POC/services/customerService/updateCustomer";
            def updateStepLogRef = "Update Customer Step::";

            ClientResponse searchCustomerForUpdate = getCustomerSearchResponse();

            /* Validate for whether customer information found or not for the given the ID to update.*/
            if(searchCustomerForUpdate.getStatus() == 204){
                   log.info("No Customer found for the given id to update.");
            }else {
                   log.info("~~~~!!!! Customer Information is Updated !!!!~~~~");

                      /* Format the json structure for update operation.*/
                      String searchByIdForUpdate = searchCustomerForUpdate.getEntity(String.class);
                      def jsonForUpdate = formatJsonStructure(searchByIdForUpdate);
                      ClientResponse updateCustomerResponse = serviceResoruces.putResponse(UPDATE_CUSTOMER_ENDPOINT,jsonForUpdate);

                      log.info(updateStepLogRef+"Response Status = "+updateCustomerResponse.getStatus());
                      assert updateCustomerResponse.getStatus() == 204
            }                                                                                                                     4



(C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)
 Delete Customer
def deleteCustomerLogRef = "Delete Customer::";
def DELETE_CUSTOMER_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD-
                                POC/services/customerService/deleteCustomer?customerId"+
                               IntegrationTestUtils.generateRangeRandomNumber(103,400);

ClientResponse deleteCustomerResponse = serviceResoruces.deleteResponse(DELETE_CUSTOMER_ENDPOINT);
log.info(deleteCustomerLogRef+"Response Status = "+deleteCustomerResponse.getStatus());

if(deleteCustomerResponse.getStatus() == 204){
             log.info("Customer Found To Delete.");
             assert deleteCustomerResponse.getStatus() == 204
}else{
             log.info("Customer Not Found To Delete.");
             assert deleteCustomerResponse.getStatus() == 500
}




 Find Customer
def searchByIdLogRef = "Search Customer By Id::";
ClientResponse customerSearchResponse = getCustomerSearchResponse();

/* Validate for whether customer information found or not for the given the ID.*/
if(customerSearchResponse.getStatus() == 204){
   log.info("No Customer found for the given id.");
}else {
   String searchByIdResponseXml = customerSearchResponse.getEntity(String.class);
   log.info(searchByIdResponseXml);
   assert customerSearchResponse.getStatus() == 200
}




                                                                                                     5



(C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)
 Find All Customer

 def SEARCH_ALL_CUSTOMERS_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD-
 POC/services/customerService/getAllCustomers";
 def searchAllLogRef = "Search All Customers::";
 ClientResponse searchAllResponse = serviceResoruces.getResponse(SEARCH_ALL_CUSTOMERS_ENDPOINT);
 log.info(searchAllLogRef+"Response Status = "+searchAllResponse.getStatus());
 assert searchAllResponse.getStatus() == 200

 String searchResponseXml = searchAllResponse.getEntity(String.class);
 log.info("~~!!!! RESPONSE XML For All Customers !!!!~~~~");
 log.info(searchResponseXml);




 ** If you want full groovy script and SOAPRestClient jar please send me e-mail to ravireddy76@gmail.com. Also mean time I will try to upload the
 required libraries (jar) and code in GitHub.

                                                                                                                           Authors
                                                                                                                             Ravi Reddy
                                                                                                                             Dilip Ladhani




                                                                                                                                                6



(C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)

More Related Content

What's hot

SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
Phil Wicklund
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
Spiffy
 
Parallelminds.asp.net web service
Parallelminds.asp.net web serviceParallelminds.asp.net web service
Parallelminds.asp.net web service
parallelminder
 
Developing Web Sites and Services using Visual Studio 2013
Developing Web Sites and Services using Visual Studio 2013Developing Web Sites and Services using Visual Studio 2013
Developing Web Sites and Services using Visual Studio 2013
Microsoft Visual Studio
 

What's hot (20)

Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST API
 
ASP.NET 4.0 Roadmap
ASP.NET 4.0 RoadmapASP.NET 4.0 Roadmap
ASP.NET 4.0 Roadmap
 
Introduction to Vaadin
Introduction to VaadinIntroduction to Vaadin
Introduction to Vaadin
 
Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008Silverlight 2 for Developers - TechEd New Zealand 2008
Silverlight 2 for Developers - TechEd New Zealand 2008
 
SharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object ModelSharePoint 2010 Client-side Object Model
SharePoint 2010 Client-side Object Model
 
Vaadin
VaadinVaadin
Vaadin
 
Jsf
JsfJsf
Jsf
 
Oracle application framework (oaf) online training
Oracle application framework (oaf) online trainingOracle application framework (oaf) online training
Oracle application framework (oaf) online training
 
SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)SharePoint Client Object Model (CSOM)
SharePoint Client Object Model (CSOM)
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
 
Parallelminds.asp.net web service
Parallelminds.asp.net web serviceParallelminds.asp.net web service
Parallelminds.asp.net web service
 
oracle oa framework training | oracle oa framework training courses | oa fram...
oracle oa framework training | oracle oa framework training courses | oa fram...oracle oa framework training | oracle oa framework training courses | oa fram...
oracle oa framework training | oracle oa framework training courses | oa fram...
 
Creating & consuming simple web service
Creating & consuming simple web serviceCreating & consuming simple web service
Creating & consuming simple web service
 
Developing Web Sites and Services using Visual Studio 2013
Developing Web Sites and Services using Visual Studio 2013Developing Web Sites and Services using Visual Studio 2013
Developing Web Sites and Services using Visual Studio 2013
 
SFDC Inbound Integrations
SFDC Inbound IntegrationsSFDC Inbound Integrations
SFDC Inbound Integrations
 
Building RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPIBuilding RESTfull Data Services with WebAPI
Building RESTfull Data Services with WebAPI
 
Advanced SharePoint Web Part Development
Advanced SharePoint Web Part DevelopmentAdvanced SharePoint Web Part Development
Advanced SharePoint Web Part Development
 
Web controls
Web controlsWeb controls
Web controls
 
Deep Dive into Oracle ADF Transactions
Deep Dive into Oracle ADF TransactionsDeep Dive into Oracle ADF Transactions
Deep Dive into Oracle ADF Transactions
 
Mvc by asp.net development company in india - part 2
Mvc by asp.net development company in india  - part 2Mvc by asp.net development company in india  - part 2
Mvc by asp.net development company in india - part 2
 

Viewers also liked

WID (Websphere Integration Development) Guide
WID (Websphere Integration Development) GuideWID (Websphere Integration Development) Guide
WID (Websphere Integration Development) Guide
ravireddy76
 
Webservices testing using SoapUI
Webservices testing using SoapUIWebservices testing using SoapUI
Webservices testing using SoapUI
Testing World
 
Ppt of soap ui
Ppt of soap uiPpt of soap ui
Ppt of soap ui
pkslide28
 

Viewers also liked (14)

WID (Websphere Integration Development) Guide
WID (Websphere Integration Development) GuideWID (Websphere Integration Development) Guide
WID (Websphere Integration Development) Guide
 
Webservices testing using SoapUI
Webservices testing using SoapUIWebservices testing using SoapUI
Webservices testing using SoapUI
 
Testing web services
Testing web servicesTesting web services
Testing web services
 
Soa testing soap ui (2)
Soa testing   soap ui (2)Soa testing   soap ui (2)
Soa testing soap ui (2)
 
Корпоративен софтуер в гаражни условия
Корпоративен софтуер в гаражни условияКорпоративен софтуер в гаражни условия
Корпоративен софтуер в гаражни условия
 
Новите възможности за SEO Станислав Димитров
Новите възможности за SEO Станислав ДимитровНовите възможности за SEO Станислав Димитров
Новите възможности за SEO Станислав Димитров
 
SoapUI
SoapUISoapUI
SoapUI
 
Groovy presentation
Groovy presentationGroovy presentation
Groovy presentation
 
Soap ui introduction
Soap ui introductionSoap ui introduction
Soap ui introduction
 
Presentation for soap ui
Presentation for soap uiPresentation for soap ui
Presentation for soap ui
 
Soap ui
Soap uiSoap ui
Soap ui
 
В поисках магической кнопки, или как воспитать SoapUI
В поисках магической кнопки, или как воспитать SoapUIВ поисках магической кнопки, или как воспитать SoapUI
В поисках магической кнопки, или как воспитать SoapUI
 
Learn SoapUI
Learn SoapUILearn SoapUI
Learn SoapUI
 
Ppt of soap ui
Ppt of soap uiPpt of soap ui
Ppt of soap ui
 

Similar to Groovy in SOAP UI

Playing with php_on_azure
Playing with php_on_azurePlaying with php_on_azure
Playing with php_on_azure
CEDRIC DERUE
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-cas
ellentuck
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30
fiyuer
 

Similar to Groovy in SOAP UI (20)

Yii Introduction
Yii IntroductionYii Introduction
Yii Introduction
 
A Node.js Developer's Guide to Bluemix
A Node.js Developer's Guide to BluemixA Node.js Developer's Guide to Bluemix
A Node.js Developer's Guide to Bluemix
 
Developing Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web ApplicationDeveloping Next-Gen Enterprise Web Application
Developing Next-Gen Enterprise Web Application
 
Heroku pop-behind-the-sense
Heroku pop-behind-the-senseHeroku pop-behind-the-sense
Heroku pop-behind-the-sense
 
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
Global Windows Azure Bootcamp : Cedric Derue playing with php on azure. (spon...
 
Playing with php_on_azure
Playing with php_on_azurePlaying with php_on_azure
Playing with php_on_azure
 
REST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion AetherREST Development made Easy with ColdFusion Aether
REST Development made Easy with ColdFusion Aether
 
Working With The Symfony Admin Generator
Working With The Symfony Admin GeneratorWorking With The Symfony Admin Generator
Working With The Symfony Admin Generator
 
Web internship Yii Framework
Web internship  Yii FrameworkWeb internship  Yii Framework
Web internship Yii Framework
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
The State of the Developer Ecosystem - .NET Conf Madrid 2018
The State of the Developer Ecosystem - .NET Conf Madrid 2018The State of the Developer Ecosystem - .NET Conf Madrid 2018
The State of the Developer Ecosystem - .NET Conf Madrid 2018
 
Redispresentation apac2012
Redispresentation apac2012Redispresentation apac2012
Redispresentation apac2012
 
VBA API for scriptDB primer
VBA API for scriptDB primerVBA API for scriptDB primer
VBA API for scriptDB primer
 
Jasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-casJasigsakai12 columbia-customizes-cas
Jasigsakai12 columbia-customizes-cas
 
70562 (1)
70562 (1)70562 (1)
70562 (1)
 
Cucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criteriasCucumber - use it to describe user stories and acceptance criterias
Cucumber - use it to describe user stories and acceptance criterias
 
Apex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong FoundationsApex Enterprise Patterns: Building Strong Foundations
Apex Enterprise Patterns: Building Strong Foundations
 
How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30How to disassemble one monster app into an ecosystem of 30
How to disassemble one monster app into an ecosystem of 30
 
Coding Naked 2023
Coding Naked 2023Coding Naked 2023
Coding Naked 2023
 
Salesforce and sap integration
Salesforce and sap integrationSalesforce and sap integration
Salesforce and sap integration
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 

Groovy in SOAP UI

  • 1. Groovy Tutorials With SOAP UI 1 (C ) All copy rights to Ravi Reddy, Dilip & Abdur (ravireddy76@gmail.com)
  • 2. Presentation to illustrate to write web service integration test using groovy in soap UI.  I’m unable to find a valuable solutions in online forums to write a simple integration tests for web services.  Here I want demonstrate how to write services integration test for restful end points using groovy in SOAP UI for simple CRUD operations. Tools 2 Use C:Program Files (x86)SmartBearsoapUI-4.0.1 • SOAP-UI • Jersey (JAX-RS) API’s • jersey-client-1.8 • jersey-core-1.8 • jersey-server-1.8 • jersey-test-framework-1.1.5.1 • SOAPRestClient (Custom jar file) Download and copy above jars (libraries) to lib of Soap UI installation folder show in the image. ** Note : Ping me @: ravireddy76@gmail.com SOAPRestClient is custom jar file which consists of wrapper class to consume REST end points for POST/PUT/DELETE/GET operations. (C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com) 2
  • 3. » Create a REST end point project in SOAP UI tool which is shown in below image  Create a Test Suite called “ServiceIntegration-TestSuite”.  Create a test case (Example: CustomerService-IntegrationTest show in image)  Create a new Groovy script as a test case. In above example I’m showing a example for CRUD (Create, Read, Update, Delete) operations for a customer service. (C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com) 3
  • 4. Below examples presenting CRUD operations for customer service integration test using groovy script in SOAP UI ** Note : use your REST end point with appropriate input either JSON/XML format.  Create Customer def CREATE_CUSTOMER_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD- POC/services/customerService/addCustomer"; def createCustomerLogRef = "Create Customer Information::"; def customerJsonInput = buildJsonInput(); ClientResponse createCustomerResponse = serviceResoruces.postResponse(CREATE_CUSTOMER_ENDPOINT,customerJsonInput); log.info(createCustomerLogRef+"Response Status = "+createCustomerResponse.getStatus()); assert createCustomerResponse.getStatus() == 204 log.info("----------------------------------------------------------------------------------------------");  Update Customer def UPDATE_CUSTOMER_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD- POC/services/customerService/updateCustomer"; def updateStepLogRef = "Update Customer Step::"; ClientResponse searchCustomerForUpdate = getCustomerSearchResponse(); /* Validate for whether customer information found or not for the given the ID to update.*/ if(searchCustomerForUpdate.getStatus() == 204){ log.info("No Customer found for the given id to update."); }else { log.info("~~~~!!!! Customer Information is Updated !!!!~~~~"); /* Format the json structure for update operation.*/ String searchByIdForUpdate = searchCustomerForUpdate.getEntity(String.class); def jsonForUpdate = formatJsonStructure(searchByIdForUpdate); ClientResponse updateCustomerResponse = serviceResoruces.putResponse(UPDATE_CUSTOMER_ENDPOINT,jsonForUpdate); log.info(updateStepLogRef+"Response Status = "+updateCustomerResponse.getStatus()); assert updateCustomerResponse.getStatus() == 204 } 4 (C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)
  • 5.  Delete Customer def deleteCustomerLogRef = "Delete Customer::"; def DELETE_CUSTOMER_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD- POC/services/customerService/deleteCustomer?customerId"+ IntegrationTestUtils.generateRangeRandomNumber(103,400); ClientResponse deleteCustomerResponse = serviceResoruces.deleteResponse(DELETE_CUSTOMER_ENDPOINT); log.info(deleteCustomerLogRef+"Response Status = "+deleteCustomerResponse.getStatus()); if(deleteCustomerResponse.getStatus() == 204){ log.info("Customer Found To Delete."); assert deleteCustomerResponse.getStatus() == 204 }else{ log.info("Customer Not Found To Delete."); assert deleteCustomerResponse.getStatus() == 500 }  Find Customer def searchByIdLogRef = "Search Customer By Id::"; ClientResponse customerSearchResponse = getCustomerSearchResponse(); /* Validate for whether customer information found or not for the given the ID.*/ if(customerSearchResponse.getStatus() == 204){ log.info("No Customer found for the given id."); }else { String searchByIdResponseXml = customerSearchResponse.getEntity(String.class); log.info(searchByIdResponseXml); assert customerSearchResponse.getStatus() == 200 } 5 (C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)
  • 6.  Find All Customer def SEARCH_ALL_CUSTOMERS_ENDPOINT = "http://mlaptop.ravi.net:8080/JerseyRestFul-DBCRUD- POC/services/customerService/getAllCustomers"; def searchAllLogRef = "Search All Customers::"; ClientResponse searchAllResponse = serviceResoruces.getResponse(SEARCH_ALL_CUSTOMERS_ENDPOINT); log.info(searchAllLogRef+"Response Status = "+searchAllResponse.getStatus()); assert searchAllResponse.getStatus() == 200 String searchResponseXml = searchAllResponse.getEntity(String.class); log.info("~~!!!! RESPONSE XML For All Customers !!!!~~~~"); log.info(searchResponseXml); ** If you want full groovy script and SOAPRestClient jar please send me e-mail to ravireddy76@gmail.com. Also mean time I will try to upload the required libraries (jar) and code in GitHub. Authors Ravi Reddy Dilip Ladhani 6 (C ) All copy rights to Ravi Reddy, Dilip (ravireddy76@gmail.com)