Doorgaan naar hoofdcontent

Automatic SOA black box testing with soapUI

With the introduction of soapUI 3.5.1 it is possible to check database and JMS sources.
This can also be very useful for automatic blackbox testing of your OSB services.
I used it wihin my projects to check if correct soap responses were returned, the correct data was written to a database
and with the use of HermesJMS I was able to inject JMS messages.
This blog describes how i used soapUI for this.

Install required software

  • Install soapUI 3.5.1 (see also http://www.eviware.com/nightly-builds)

  • Install required JDBC drivers
    For the use of JDBC steps you have to install the correct driver: see here
    You need to close soapUI and put the driver jar file within the SOAPUI/bin/ext directory and start soapUI again.
    Note that within the logging you can see that soapUI picks up the jar file.

  • Install HermesJMS 1.13

Setup Test Suite

  • Right-click a project and select New TestSuite and enter name for the suite
  • Right-clik the TestSuite and select new TestCase
    A testcase contains several test steps
  • Right-click a test case and you can add several test steps

SOAP Request Step
  • Right-click Insert Step
  • Select Test Request
  • Fill in the request


Note: Within the red box you see that some Groovy scripting is inserted (${ <groovy script> }). In this case a rondom number between 0 and 9999999.

JDBC Request step
Next we will check that the Employee is inserted within a particular database
  • Right-click -> Add Step -> JDBC Request



  • Select the JDBC Request to add a database call
  • Enter the needed fields, example


In the upper part of the dialog you can fill in properties that are dynamic and can be used
within the SQL Query. In this case a sofinumber property is used.
Next the Configuration for the database is filled in. Dependant on the used Driver a different
Connection String is required.
The SQL Query in the example gets all employees with a particular sofinumber. Note that the ":" is used in front of the dynamic property (sofinumber).
How data can be transfered to this property from previous steps i will explain next.

Property Transfer step
With a property transfer step we transfer the input request sofinumber to the property within the JDBC step.
  • Right-click Add Step -> Property Transfer
  • Add Property Transfer
  • enter a name for the transfer
Now you have to define the source and target of the transfer. You use XPath expressions to select elements.
  • First we fill in the source (Step: Nieuwe Employee, Property: Request)

You also have to use an XPath expression to select the SofiNumber.
  • Select the ns icon to import all namespaces that are known within the step.
We now select the SofiNumber element from within the Request step.
  • Fill in the next XPath expression

  • Select in Target the JDBC Request step
  • Select as property the sofinumber property. Note that this is the property you defined earlier within the JBDC step.

The next steps must be defined now:


Because the sofinumber of an exmployee must be unique we can add an Assertion to the JDBC step as follows.
  • Double-click on JDBC Request step
  • Click on Assertions
  • Click on Add an Assertion
  • Select XPath Match
The result of a select statement is in the form of:
<Results>
  <ResultSet>
    <Row>*
In this case we only expect 1 row, so this is how we will setup the assertion.
  • Fill in the next fields


This concludes this simple automatics test steps within soapUI that can also be used to blackbox test your SOA services.
Next time I will include an example that uses a JMS Queue as the transport instead of soap over HTTP.

Reacties

  1. Cool! Now I don't have to write Groovy Script to get stuff from the DB.

    BeantwoordenVerwijderen
  2. One annoying thing: Instead of "jdbc:oracle:thin://@::", it should be "jdbc:oracle:thin:/@::". That extra slash caused me about 15 minutes worth of frustration. :) Good post regardless.

    BeantwoordenVerwijderen
  3. @thetestingblog.com:

    Thanks for the remark, sorry i wasted 15 mins of your precious time ;)

    Thx
    Roger

    BeantwoordenVerwijderen
  4. Great!
    But how do I delete the test employee again from the DB after the test?
    I dont want to fill up the db with test users...

    BeantwoordenVerwijderen
  5. @eerie Just make JDBC step with truncate table commands and the columns are removed from your database. Or use other JDBC commands as you like.

    Hope this helps?
    Regards Roger

    BeantwoordenVerwijderen

Een reactie posten

Populaire posts van deze blog

Microservices mindmap

"The tree" - See also   my photo page When you are fairly new within the Microservices land, there are a lot of terms fired at you. So also for my own understanding i have made a mindmap. I think it has a good status now, so that i can share it with you. As always feedback is very welcome ! You can download the mindmap here .

OSB 10gR3 and SWA and MTOM

This blog is about using soap with attachments and the use of MTOM within the OSB (10gR3). A service is created that accepts a soap with attachment (DocumentService) and translates it to a service that accepts a binary element. MTOM is used for performance reasons for the second. Some notes: * For the use of attachments you need RPC-style document instead of the usual document-style. This due to the fact that the document-style limits a message to a single . * A service can not have both SWA and MTOM within OSB. First a WSDL is setup for the DocumentService: The $attachments variable holds the attachments and the body holds the attachment data. Also other data is stored within the attachment element (see h

Installing Oracle SOA Suite/JDeveloper 11g

This post guides you through the installation of the Oracle SOA Suite 11g with JDeveloper 11 with the use of Oracle XE database (for Windows). Note: It is assumed that Oracle XE database is already installed. Required downloads Oracle Weblogic Server 10.3.1   SOA Suite   Repository Creation Utility JDeveloper Studio The detailed steps are nicely described here . The next picture gives a nice overview of the directory structure created. Step1 -  Create Schemas for Oracle SOA Suite and Oracle BAM (RCU) Unzip the files Run bin/rcu.bat At the Database Connection Details fill in the XE details. If you encounter the next fault you have probably not started the XE database.   Ignore all warnings Click OK Select all components I ran into the following problem: When you click Ok you see the following error: And this is about the Processes DB Init parameter that is wrong. To fix this goto the Database Home page, Sql Editor and execute the following statements: a