Forum Discussion

kriti123's avatar
kriti123
New Contributor
11 years ago

Running an external sql script file from SoapUi

hi all,

I am able to connect to MySQL database through SoapUI's JDBC feature and perform some simple insert and delete query on the tables. However to make life easier, I have already two SQL files (config.sql and data.sql), which creates schema, tables and fills it.

The goal is to "Run both the script file from SoapUI". Is this feature available in basic SoapUI(NOT the PRO Version)?

Can this be done, if yes, a guide will be appreciated. By this way, the manual working of updating the database everyday will be reduced.

Thanks,
Kriti

2 Replies

  • GiscardN's avatar
    GiscardN
    Frequent Contributor
    Hi,

    That is not possible to run your external SQL script from the JDBC TestStep.
    What you could do is to have a loop in which your DataSource will provide at each iteration the query that should be run until your entire script is finished, and each time you would retrieve it in you JDBC TestStep SQL Query using property expansion. That could be a workaround.

    Regards,

    Giscard
    SmartBear Support
  • kriti123's avatar
    kriti123
    New Contributor
    Hi,

    Thanks for the reply. But I was looking for a solution which can be achieved by Basic Version and not the ProVersion.

    I coded a groovy script which could do, what you have suggested but It was way too complicated. It was successful in executing one script line but not all (coz of unavailability of looping).

    And with also the pro version, I had to first modify the script file (because of so many commented line), the pro version doesn't ignore the comments in the sql query editor(only when it gets the value from property transfer) and complains about the SQL syntax exception when the comment is transferred using property transfer from the script file..phew..... ....Now the effort of mine has shifted to first remove all the comments from the script file (which is bad bad)and then use your suggestions.

    Let me know, if you have some option (where i don't have to modify my script file)

    Thanks,
    Kriti