Call Java Function in JAR File

Speedy993Speedy993 Posts: 35

I have a java function outside of the message flow I am testing that takes a string, processes it, and then returns another string. I need to call this function and store the returned string for use in another test. Do I want to use the External Tool, Extension Tool or something else? How do I connect to the jar file?


  • jakubiakjakubiak Posts: 739 admin

    You can add the jar file to the System Properties preferences to register it with SOAtest. Then you would use an Extension Tool to call the Java function. As far as storing the returned string, there are a couple of ways you could do that. One way is to create a test variable in your test scenario, and then in your Extension Tool call the SOAtest Java API method to set the value of the test variable. Another way is to return the value from the Extension Tool method wrapped in XML tags (something like "value to return") and then use an XML Data Bank to store the value.

  • Speedy993Speedy993 Posts: 35

    Thanks for your reply @jakubiak. I have added the jar file to the System Properties and reloaded the classes. I have added a data source column as input and added the jar file as the Java class but I am not seeing any of the methods appearing in the dropdown. Is there something I am missing?

  • benken_parasoftbenken_parasoft Posts: 1,018 ✭✭✭

    I would use Groovy. Just write a small method in Groovy to call the java method and store the result in a test variable.

Sign In or Register to comment.