Contributions
Re: Exporting/transferring assertion results
So the only remaining question now is: how do I fetch the result from an existing assertion that was added to a teststep in a groovy script?? It works when I use the (partial) script Anand provided me with: def result = testRunner.runTestStepByName( "Tryout" ) String status = result.getStatus().toString() log.info (status) But it does not work when instead of running the teststep from within the groovy I simply want to retrieve the result from the executed teststep: def result = testRunner.getTestStepByName( "Tryout" ) String status = result.getStatus().toString() log.info (status) In this case I get the following error: groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.panels.support.MockTestRunner.getTestStepByName() is applicable for argument types: (java.lang.String) values: [Tryout]2.3KViews0likes0CommentsRe: Exporting/transferring assertion results
If someone could already tell me how to look up the remainder of the statement where the ID is found, I would be halfway there and will possibly be able to figure out the rest declare namespace ns1='http://schema.xxxxx.com/bookings; if (//ns1:booking-reply/ns1:statement/ns1:message/ns1:r/ns1:f[@ft="ib1-21"] = ID123456) then copy the (//ns1:booking-reply/ns1:statement/ns1:message/ns1:r) part of the booking-reply containing that ID123456) to a property else 'ID not found' thx!2.3KViews0likes0CommentsRe: Exporting/transferring assertion results
Hmmm, I thought it through some more and think I'll add a additional check for the fact whether the ID is present or not in my groovy script prior to retrieving the xpath expression outcome. That way I can catch the scenario where the ID is not present beforehand and send a corresponding message. So then my only 2 remaining questions are: - When the ID is found and passes my first check, the built-in Xpath match I established via the gui will also find the ID and compare it to the expected result. However, if it does not match (so Xpath match = failed): how can I export not only the pass/fail status but also that portion of the XML containing the ID that did not match the expected result? - If I understand correctly you get the assertion result (pass/fail) via .getStatus For this you apparantly need to run the teststep itself from within the groovy script via def result = testRunner.runTestStepByName( "Operation-name" ). The way I would like to work is to run my teststep manually (by pressing play in the interface) and after that just retrieve the value from the teststep. Simply replacing runTestStepByName with getTestStepByName is apparently not how this is done, so I would like to know how to do this2.3KViews0likes0CommentsRe: Exporting/transferring assertion results
Thx so much for your reply Anand! Very much appreciated It's close to what I was looking for except for a couple of things: - Instead of adding an assertion through the groovy script, I want to use an existing assertion that I created through the soapui gui. I think therefore it is not necessary to perform def assertion = testRunner.getTestCase().getTestStepByName("Operation-name").addAssertion("XPath Match") - Instead of running the teststep from within the groovy-script, I would like to run the teststep manually and only retrieve the failed or passed status. I tried to use def result = testRunner.getTestStepByName( "Operation-name" ) instead of def result = testRunner.runTestStepByName( "Operation-name" ) for this, but it does not seem to work. - The way you have described it, I will not be able to see the difference as to why the assertion failed only that it failed or not. However, in my case the assertion can fail either because the expected result did not match, or because the ID was not found that should contain the content to be verified. I'll include my (sligthly altered) Xpath expression for your reference declare namespace ns1='http://schema.xxx.com/c-account'; /ns1:statement-reply/ns1:o-statement/ns1:uic-message/ns1:r[ number( ns1:f[@ft='od1-23'] ) = 123456 ] So you see that in my case, only if the content for a certain field matches the value 123456, the expected result should match. But here the Assertion will not only fail if the expected result is not met but it will also fail if 123456 is not found2.3KViews0likes0CommentsExporting/transferring assertion results
Hi, I'm a novice user of SoapUI pro with limited programming skills but would like to see if the following is possible I'm currently performing a REST request. The reply to that request contains a specific ID. I have added an Xpath assertion to look up that specific ID and when it is found that portion of the XML containing the ID should be equal to the expected result. The question now is: - If the Xpath expression fails (ID is not found) is there any way to return a message such as "ID not found" to a property? - If the Xpath expression fails (ID is found, but content does not match expected result), can I export the part that was actually found to a property? - If the Xpath expression is succesfull (ID found and contents match), can I return a message such as "Xpath OK" to a property? Thank you very much in advance for your help! If any additional information is needed, please ask5.4KViews0likes12CommentsRe: Schema compliance assertion export
Hi Robert, you're right, I was running the steps individually so I could monitor the output directly. Running the testcase in its entirity, the preceding teststep is found by the script so thx for that... I do however get some unwanted results from the script though. When I run a testcase where I know a schema compliance issue will be raised, the result from the script is for example: "[Lcom.eviware.soapui.model.testsuite.AssertionError;@c8010f", which is not quite the same as the more specific "org.apache.xmlbeans.XmlException: error: Unexpected element: CDATA" I get in the standard assertion. It might well be ofcourse that c8010f is an error code for this particular schema compliance deviation but is there some way this can be verified or is there another way to get the more specific message? Strangely enough though, even when a reply conforms to the schema and therefore passes the schema compliance without error raised, I still get a similar message with the script ([Lcom.eviware.soapui.model.testsuite.AssertionError;@630657) as opposed to the built-in assertion that just lights up green...1.1KViews0likes0CommentsRe: Schema compliance assertion export
Hi Dain, thx very much for your reply! Unfortunately I'm getting an error when executing because of def result = testRunner.results[testRunner.results.size()-1] The error is: java.lang.ArrayIndexOutOfBoundsException: negative array index [-1] too large for array size 0. Changing the -1 value still puts it out of bounds... Only when I do not put a value does the script run but I don't believe I'm getting the desired outcome. The testrequest directly precedes the script in SoapUI as per your suggestion...1.1KViews0likes0Comments