The web (World Wide Web) was a prodigious success enabling computer to human interactions through Internet. Web used simple HTTP/HTML protocol and with its relative simplicity was the key factor to its success and was implemented across various OS and programming environments.
Web services took many of the ideas and principles from the Web and apply in computer to computer interactions. Web services are highly dynamic middleware podium and is envisioned to be the next generation for mainstreamed applications. Determining the quality of web services during and after development has become more important and Soap ui is the more popular tool used in that sector. Effective testing technique’s like creating customized plugin’s identified for the tool generally increase the efficiency, effectiveness and coverage of software testing.
Have you ever wondered, how to create functions/plugin’s in Java and use it as groovy in soap ui? Here is the solution for it.
Steps to create customized plugin in Soap ui:
- Install Eclipse IDE for Java developers and Click File -> New -> Java Project. Create a package and class to write functions in Java.
2. Write Java Functions in created class. Below is the list of functions I have worked on for plugin creation.
- Alarm
- pop up box with instructions
- Encryption/decryption
- Screenshot
- Timestamp
- Scheduler/Timer
3. Write Java functions as shown below:
4. Once the code is done, make sure it is successfully compiled and executed in Eclipse. Save the project.
CREATE JAR:
5. Right click on the saved project and click on Export -> JAVA -> JAR file and click NEXT.
6. Select the resources to Export and provide the Jar file export destination and click on NEXT button.
7. In this step, we can create a shortcut for JAR creation by saving the JAR description file, e.g. SoapUiJar.jardesc in the chosen folder as below. Click on NEXT and generate Manifest file followed by Finish button.
8. Now, the Jar file and jardesc file will be created successfully in the chosen destination folder. Next time when we need to create jar for the same project, right-click on jardesc file and click Create Jar option.
Access JAR file in Soap Ui:
9. Once the JAR file is ready, place it in the installation drive of soap ui tool in the below path: C:\Program Files\SmartBear\SoapUI-5.2.1\bin\ext.
10. Restart the soap ui, so that the plugins will be loaded successfully with soap ui.
11. In groovy script test step in soap ui, the customized functions can be called using below format.
Import <Package Name>.<Class Name>
<Class Name>.<Method Name>
On executing the groovy script, the functions written in JAVA project will be executed.
With the above approach, we were able to get access to JAVA function in Soap Ui. This helps testers to do advanced extensive testing of web services through Soap ui.