Scripted assertions in JDBC Requests - Issue
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2013
01:05 PM
07-10-2013
01:05 PM
Scripted assertions in JDBC Requests - Issue
Hello,
I have a test case with 8 steps - Data source, Groovy script, SOAP request, Delay, Groovy script, JDBC request1, JDBC Request2 and Data source loop. In each of the JDBC requests, I have a scripted assertion. I have a strange issue. If in any iteration, if the scripted assertion in any of the JDBC requests fail, In the next iteration, the same test step is marked as Failed though there is no issue and the assertions also pass. The later iterations are fine. If test step 6 fails in iteration 4, the same test step again fails in iteration 5 though all the assertions pass.
Following are the scripted assertions in my JDBC Requests.
Assertion in JDBC Request 1 -
Assertion in JDBC Request 2 -
Also wanted to add - This is very random and happens most of the times.
sometimes, if I make changes to the scripted assertions like adding a log statement or changing the else if to if statement, it works fine but resurfaces after some time. does this have anything with the cache? Once this issue occurs, it occurs even if I exit soapui Pro and get back in.
I posted the same earlier on Community forum too before I dug out my pro login credentials. I apologize.
I have a test case with 8 steps - Data source, Groovy script, SOAP request, Delay, Groovy script, JDBC request1, JDBC Request2 and Data source loop. In each of the JDBC requests, I have a scripted assertion. I have a strange issue. If in any iteration, if the scripted assertion in any of the JDBC requests fail, In the next iteration, the same test step is marked as Failed though there is no issue and the assertions also pass. The later iterations are fine. If test step 6 fails in iteration 4, the same test step again fails in iteration 5 though all the assertions pass.
Following are the scripted assertions in my JDBC Requests.
Assertion in JDBC Request 1 -
import com.eviware.soapui.support.XmlHolder
def holder = new XmlHolder( messageExchange.responseContentAsXml )
def totalRows = holder.getNodeValue('//Results/ResultSet/Row/TOTALROWS')
def expectedResult = context.expand( '${GetDataForGM#ExpectedResult}' )
def messageID = context.expand( '${JDBC_Request1#messageID}' )
if (expectedResult == "Pass") {
assert totalRows.toInteger() >= 1
}
else if (expectedResult == "Fail"){
assert totalRows.toInteger() == 0
}
Assertion in JDBC Request 2 -
import com.eviware.soapui.support.XmlHolder
def holder = new XmlHolder( messageExchange.responseContentAsXml )
def totalRows = holder.getNodeValue('//Results/ResultSet/Row/TOTALROWS')
def expectedResult = context.expand( '${GetDataForGM#ExpectedResult}' )
def messageID = context.expand( '${JDBC_Request2#messageID}' )
if (expectedResult == "Pass"){
assert totalRows.toInteger() == 0
}
else if (expectedResult == "Fail") {
assert totalRows.toInteger() >= 1;
}
Also wanted to add - This is very random and happens most of the times.
sometimes, if I make changes to the scripted assertions like adding a log statement or changing the else if to if statement, it works fine but resurfaces after some time. does this have anything with the cache? Once this issue occurs, it occurs even if I exit soapui Pro and get back in.
I posted the same earlier on Community forum too before I dug out my pro login credentials. I apologize.
14 REPLIES 14
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2013
02:17 AM
07-23-2013
02:17 AM
Hi.
I have created a project that perform similar operations as your test does, but I have been unable to reproduce this issue.
I added some artificial assertion failures in a Jdbc test-step to simulate the same kind of conditions. You may want to try something similar to see if that gives you any new insights into what may be causing the problem.
Which version of SoapUI are you using? I used 4.5.2 to test this, you may want to upgrade in case you are using an older version.
Regards,
Renato
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
I have created a project that perform similar operations as your test does, but I have been unable to reproduce this issue.
I added some artificial assertion failures in a Jdbc test-step to simulate the same kind of conditions. You may want to try something similar to see if that gives you any new insights into what may be causing the problem.
Which version of SoapUI are you using? I used 4.5.2 to test this, you may want to upgrade in case you are using an older version.
Regards,
Renato
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2013
12:11 PM
07-23-2013
12:11 PM
I am using version 4.5.2. I have tried everything from re-installing SoapUI Pro to recreating the tests. It still fails.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2013
05:53 AM
07-29-2013
05:53 AM
Hi,
I have also tried to reproduce your issue with almost exact setup but no luck.
I understand it is a bit frustrating, at the same time we are also unable to help you unless we can reproduce this issue.
I would suggest that you try building a simplified version of your project and then gradually add things and see at what point you start reproducing this issue. At that point it is probably easier to see what might have causing this. If you want I can also share my project with you.
Regards,
Shadid
SmartBear Sweden.
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
I have also tried to reproduce your issue with almost exact setup but no luck.
I understand it is a bit frustrating, at the same time we are also unable to help you unless we can reproduce this issue.
I would suggest that you try building a simplified version of your project and then gradually add things and see at what point you start reproducing this issue. At that point it is probably easier to see what might have causing this. If you want I can also share my project with you.
Regards,
Shadid
SmartBear Sweden.
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2019
03:26 PM
11-03-2019
03:26 PM
I am having a similar issue using ReadyAPI v2.8.2
I have a JDBC Request step which has a JDBC Status Assertion.
After that I have an XQuery Assertion using the ResponseAsXml from the JDBC Request step.
This is driven by a Data Source and Data Source Loop.
If any JDBC Request fails, the JDBC Status Assertion fails, and will continue to report as failed for the rest of the test loop. The Assertion passes as expected.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2019
01:27 AM
11-06-2019
01:27 AM
Hi @aw-iqa! This seems to be a very old thread. Did you face a similar issue and were you able to find a solution?
Please feel free to create a new thread if you still have any questions to the Community! Thank you!
Sonya Mihaljova
Community and Education Specialist

- « Previous
-
- 1
- 2
- Next »
- « Previous
-
- 1
- 2
- Next »