Javascript in SoapUI

Javascript in SoapUI How to do this?

You are allowed to write Groovy scripts in SoapUI! but since even Javascript is also supported in SoapUI how can we write javascript in SoapUI. Is there a simple example that would explain this in great detail. Is there any simple code to automate the testing process using javascript.

+6
source share
3 answers

To switch the project to JavaScript, click on the project, go to the window in the lower left corner. Select a script language field and update it to JavaScript.

As far as you can handle it, you really can do something. You can create a step or statement script. Some examples include the creation of a script to create variables or a circular response to check information. I did not find much to use JavaScript with soapUI, and ended up sticking with Groovy. I found it powerful and extensible through Java, if necessary.

If you need a concrete example of how to do something. I would recommend asking a more specific question with what you have tried so far.

+4
source

As long as I have ...

function myFunction() { log.info('Hello'); } myFunction(); 

The output is displayed in a script log when I determine how to test the loop, etc., will be published ...

0
source

I have not tried JavaScript, but I have developed my own Java classes that I use for complex response checks.

You do not need to change the scripting language in SoapUI. To call the Java class, I have a groovy step in my test that creates an instance of an object from my java class, and then I call the key method for the object. You can pass the objects that SoapUI passes to the groovy script, so that you can process the response.

The java scripts themselves are located in the bin / scripts folder in SoapUI.

When working on a java class, I use an external editor, for example, brackets. When I save the changes, SoapUI detects this change and recompiles the java class, so yup does not need to restart SoapUI after every setting in your class.

The smart bear site and other places have tutorials to help you get started.

0
source

All Articles