Forum Discussion

Sandyapitester's avatar
Sandyapitester
Frequent Contributor
9 years ago
Solved

in soapui how to validate the actual result with database result for the user id

Hi Guys,

 

in soapui how to validate the actual result with database result for  user id

 

 

Automation testing

 

Need to validate the userid response data with userid database data

 

if possible in sopaui if yes guide me with steps to setup the config and execution

 

 

 

 

 

  • Hi,

     

    Yes, I think what you're saying is very possible and a relatively common usuage of SoapUI.

     

    In essence, Iit sounds like what you need is to setup something like:

     

    TestCase

    1) Request TestStep (call your service)

    2) JDBC TestStep (query the same record in your DB and use Assertions to compare data to your response)

     

    More detailed:

    a) In the Request TestStep (SOAP or REST or HTTP depending on your service), make your request.

    b) In the JDBC TestStep, query the database for the record that your service request just returned in its response.

    c) Use Assertions in the JDBC TestStep to compare the record properties retrieved from the database to the values extracted from the response.

     

    Alterntively, in place of the JDBC TestStep, you could consider a Groovy Test Step to query the database and code based assertions to compare the values, but depending on your experience this may seem more complicated, but can be more flexible.

     

    To get the above approach to work, if you're new to SoapUI, you're probably gonna need to do a bit of reading on how to configure a JDBC TestStep e.g. supply connection string / credentials for your particular database. You may also want to look at SoapUI Property Expansions in order to extract the values from the service response in order to use them in your Assertions in the JDBC TestSteps. You can find details of these topics on the SoapUI wiki and on this forum.

     

    Hope this helps,

    Rupert 

2 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    Yes, I think what you're saying is very possible and a relatively common usuage of SoapUI.

     

    In essence, Iit sounds like what you need is to setup something like:

     

    TestCase

    1) Request TestStep (call your service)

    2) JDBC TestStep (query the same record in your DB and use Assertions to compare data to your response)

     

    More detailed:

    a) In the Request TestStep (SOAP or REST or HTTP depending on your service), make your request.

    b) In the JDBC TestStep, query the database for the record that your service request just returned in its response.

    c) Use Assertions in the JDBC TestStep to compare the record properties retrieved from the database to the values extracted from the response.

     

    Alterntively, in place of the JDBC TestStep, you could consider a Groovy Test Step to query the database and code based assertions to compare the values, but depending on your experience this may seem more complicated, but can be more flexible.

     

    To get the above approach to work, if you're new to SoapUI, you're probably gonna need to do a bit of reading on how to configure a JDBC TestStep e.g. supply connection string / credentials for your particular database. You may also want to look at SoapUI Property Expansions in order to extract the values from the service response in order to use them in your Assertions in the JDBC TestSteps. You can find details of these topics on the SoapUI wiki and on this forum.

     

    Hope this helps,

    Rupert