How to prevent ReadyAPI from randomly changing how it stores empty XML elements?
Why does ReadyAPI change how it stores a blank XML tag from, say <con:properties/> to <con:properties></con:properties> If I make one change and save, I may see many of these differences, which complicates review of the code. I see this in projects where Composite project is false, and in projects where it is true. The representation of blank XML elements is one of many things about how ReadyAPI stores a project that seem to change at random with each new version or sometimes randomly within the same version. I have tried setting the flag "Pretty prints project files", but this is not sufficient to stop this noise. Is there some other flag I can set so that the method for encoding the project doesn't obscure actual logic changes when I look at the differences? Preferably something that gets remembered in the project, rather than depending on a user setting? References: The following are a few postings that seem relevant, but don't clean up the random XML representations. "Version control - Diff is very confusing for ReadyAPI projects?" https://community.smartbear.com/t5/API-Functional-Security-Testing/Version-control-Diff-is-very-confusing-for-ReadyAPI-projects/m-p/209420#M47734 - Answer: Yes, currently, if you change one thing in ReadyAPI, several things in different places of the project might change as well. "How do I minimize merge conflicts in a ReadyApi composite project when working as part of a team?"https://community.smartbear.com/t5/API-Functional-Security-Testing/How-do-I-minimize-merge-conflicts-in-a-ReadyApi-composite/m-p/141151 - No accepted answer - Recommendation to check the flag "Pretty prints project files" "While this allows you to see exactly what has changed when diff-ing versions, it does have the problem that this is an application setting, thus you have to make sure all users set this value manually on their copies of ReadyAPI (If a user does not set this in their copy ReadyAPI it will revert to saving on a single line). Ideally I would like to see this as a project setting."Solved1.7KViews0likes7CommentsI don't want the Optional elements in XML message to be automatically added by ReadyAPI
Good afternoon, I am using ReadyAPI 3.1.0 There was a big difference between my XML message yesterday and the message today. It looks as if ReadyAPI has automatically added all kind of optional elements in the message without me knowing about it. This is very disturbing! Example of message as defined yesterday: Example of the same message as it looks today:Solved1.6KViews0likes4CommentsGroovyUtils XMLHolder throwing Xpath syntax error when XML node value contains escaped character.
GroovyUtils throwing error when XML node value contains escaped characters. In my script, I'm accessing a node that contains the description of an error. That node when read by my XMLHolder throws this error: Caused by: java.lang.RuntimeException: net.sf.saxon.trans.XPathException: XPath syntax error at char 9 on line 2 in {\nInvalid part number}: Unexpected token name "part" beyond end of expression It appears that the node I'm reading contains the value "\n", and when the holder tries to read it, it throws the error. How can I read the node, with the escaped value, and not bomb out?3.8KViews0likes12CommentsHow to map repeating elements from xml response to datasink
I've been scouring the doc, and I can't seem to find a good answer here. Is there a way to map a repeating element from a response into a datasink automatically, rather than having to click getData and manually clicking each one? So, if I have 25 repeating elements. Widgets again. They all have the same attributes. A1, A2, A3. I want my sink to collect each of the attributes from each of the widgets, but I don't want to have to map it explicitly in the data sink property and the every one of the 25 widgets (x3 attributes) in my response. example: <widgets> <widget> <att1>abc</att1> <att2>xyz</att2> <att3>asd</att3> </widget> <widget> <att1>abc</att1> <att2>xyz</att2> <att3>asd</att3> </widget> ... </widgets> In my datasink, I'd like to map these out 1 element to 1 row in excel: excel row 1 (first widget): att1: abc,att2: xyz,att1: asd excel row 2 (second widget): att2: abc,att2: xyz,att1: asd Is there a way to do that?Solved2.7KViews0likes6CommentsHow can I map a datasource to values in a REST XML content (xml element values)?
How can I map a datasource to values in a REST XML content (xml element values)? I have a datasource with values; say parm1:value,parm2:value,parm3:value, etc. I have a REST POST request with XML content. I need to map the values in the datasource to the xml elements, so that each request iterates through my datasource (excel document) and fills the xml element values. I can't seem to find how I map them accordingly.Solved2.6KViews0likes8CommentsHow to create childNodes within childnode in sopaui (Using Groovy)
Hi, I am trying to create a child nodes within a child node dynamically using groovy script as below: <ns26:Entry> ns26:ContactType>ABPerson</ns26:ContactType> <ns26:FirstName>Axafoname</ns26:FirstName> <ns26:LastName>Bcaio</ns26:LastName> </ns26:Entry> <ns26:Entry> ns26:ContactType>ABPerson1</ns26:ContactType> <ns26:FirstName>Axafoname1</ns26:FirstName> <ns26:LastName>Bcaio12</ns26:LastName> </ns26:Entry> and so on....total 10 users. I am creating these nodes dynamically under parent tag<ns26:Results> and my code looks like as below: allRowsDataForCreatedParnters.find { String line -> if(line.contains(Ibnnumber)) { jsonObjectForPartner = jsonSlurper.parseText(line) parentnode = holderIban.getDomNode("//*:Results") xmldoc = parentnode.ownerDocument mainChild =parentnode.appendChild(xmldoc.createElement("ns26:Entry")) child = parentnode.appendChild(xmldoc.createElement("ns26:ContactType")) child2 = parentnode.appendChild(xmldoc.createElement("ns26:FirstName")) child3 = parentnode.appendChild(xmldoc.createElement("ns26:LastName")) //printing values dynamically child.appendChild(xmldoc.createTextNode(jsonObjectForPartner.ContactType)) child2.appendChild(xmldoc.createTextNode(jsonObjectForPartner.FirstName)) child3.appendChild(xmldoc.createTextNode(jsonObjectForPartner.LastName)) and my result is: <ns26:Results> <Entry/> <ContactType/> <FirstName>Derek</FirstName> <LastName>Pace</LastName> <LinkID>XTHCQG</LinkID> <Entry/> <ContactType/> <FirstName>test</FirstName> <LastName>testvv</LastName> I am not getting how to create main node "<ns26:Entry>". Can anyone help me to get result like below: Expected: <Parent Tag> <Child Tag> <elements> <elements> </child Tag> <ns26:Results> -----Parent Tag <ns26:Entry> -- Child tag <ns:26ContactType/> <ns:26FirstName>Derek</FirstName> <ns:26LastName>Pace</LastName> <ns:26LinkID>XTHCQG</LinkID> </ns26:Entry> <ns26:Entry> <ns:26ContactType/> <ns:26FirstName>test</FirstName> <ns:26LastName>testvv</LastName> </ns26:Entry> </ns26:Results> Attached actul expected result screenhot for referenceSolved2.4KViews0likes6CommentsLoop over an XML database i.e. a SOAP response
Hi Guys, I can't seem to get around how to loop over the values inside a SOAP request. I figure that I need an XML datasource. That's fine, but I really can't get it to work. I'm using XPath to query the XML, but I'm not even able to get a single value out of the SOAP response. I'm most likely just using the too incorrectly. Anyone that got this working?1.2KViews0likes2CommentsBuilding Agile XML with MarkupBuilder and JDBC Query Results
I just figured out how to do this, but I'm going to post it anyway since I think this script may be useful to others that are trying to do something similar... I'm trying to build a xml request dynamically based on jdbc query. import groovy.sql.Sql import oracle.jdbc.driver.OracleTypes com.eviware.soapui.support.GroovyUtils.registerJdbcDriver("oracle.jdbc.OracleDriver") import groovy.xml.MarkupBuilder import groovy.xml.XmlUtil //get environment specific(dev1, qa1, etc.) project db connection string properties def host = context.expand( '${#Project#dbhost}' ) def port = context.expand( '${#Project#dbport}' ) def serviceName = context.expand( '${#Project#dbservicename}' ) def username = context.expand( '${#Project#dbusername}' ) def password = context.expand( '${#Project#dbpassword}' ) def schemaName = context.expand( '${#Project#dbSchemaName}' ) //build connection string conString = ("jdbc:oracle:thin:@" + host + ":" + port + "/" + serviceName) //connect to db def con = Sql.newInstance(conString, username, password, "oracle.jdbc.driver.OracleDriver") //get order types, these are properties that were transferred from the data source def orderTypeCodes = context.expand( '${#TestCase#orderTypeCodes}' ) def locale = context.expand( '${TestData#locale}' ) //build query, removed details because they are not important. ordertypeCodes and locale are used in this query def query = ("SELECT ... ") //run query and set results def results = con.rows(query) //create writer def writer = new StringWriter() def builder = new MarkupBuilder( writer ) //define standard order structure def createOrder( builder, repeat, date, quantity, id, owningId, addedBy, lastModifiedBy, version ) { repeat.times{ builder.order{ builder.orderDate(date) builder.orderQuantity(quantity) builder.orderId(id) builder.owningId(owningId) builder.addedBy(addedBy) builder.lastModifiedBy(lastModifiedBy) builder.version(version) } } } //this is the root, not sure where this needs to go... builder.orders{} for ( i = 0; i < results.size(); i++ ) { createOrder(builder, 1, context.expand( '${#TestCase#date}' ), 1, results[i].ORDER_ID, results[i].OWNING_ID, context.expand( '${TestData#appUserID}' ), context.expand( '${TestData#appUserID}' ), 1) } return writer.toString() I'm trying to create this: <orders> <order> ... </order> <order> ... </order> <order> ... </order> </orders> But my script results in this: <orders /> <order> ... </order> <order> ... </order> <order> ... </order>Solved1.5KViews0likes1Commentrest service xml payload disappears from editor
I have a test case where in my tests I compare the response from an old service to the response from a new service. The endpoints to the two services are different. I'm supplying the request payload for the old service as XML and the payload for the new service is JSON. When I run the tests that I have set up, they are both successful. Each one calls the appropriate service and returns a valid response. The problem I'm having is that when I close the editor for the old service, the XML is not retained. The result is, every time I want to run the test I have to paste the XML into the request tab of the editor. Also, if I click form tab the XML values are deleted and I have to paste it again. If I click the outline or raw tab, the XML is retained. That is not happening on the tests for the new service. The JSON that I paste into the request tab is there when I reopen the editor. When I click the tabs (form, outline, raw) the JSON is retained. My workaround is that I open the tests for the old service and paste the XML into the editor for each test (there are four), then run the four tests. Then I run the tests for the new service. As long as I keep the tests for the old service open in the editor, the data is "cached", so the comparisons can be done. I have clicked around to see if there is a setting I can change to get the XML to stay in place, but I have not found anything. Granted, I am new to using ReadyAPI, so I'm not sure if I'm looking in the right place. I have searched to see if this is a known issue, and I cannot find this scenario described by anyone else. Can someone point me to a solution?1.3KViews0likes2Comments