Compare test step
Purpose The process of testing often requires to compare test results to expected values. When we need to check a specific value, we can use assertions. However, there are often occasions when we need to compare one documents to another (e.g. XML, JSON). I propose to introduce a new type of test step: Compare test step. Functionality Compare test step would allow: Select documents: users would select source and target document from test step requests, responses, properties and other document holders in SoapUI environment, similarly as the Property Transfer test step does. Type of comparisson: the user could choose whether the documents have to be identical (both structure and values) or similar (only the structure should be same). Also the user could choose to ignore differences in whitespaces, attributes, or namespaces, or even data types which to ignore (e.g. xsd:dateTime is typically different). List of items to compare/ignore: the user could list the items which should be ignored, represented by XPath statements. Also there would be an opposite option: a list of XPath statements to check and to ignore the rest of the documents. Suggestions The Compare test step can utilize the XMLUnit library for XML and thus expose its function via SoapUI user interface. The Compare step can be similarly used for JSON documents.9KViews8likes3CommentsNeed help! with empty response when I using the external XML as response.
Hi, I'm the beginner for SoapUI. I have a problem when using the external XML file for dynamic responses. It returns an empty message for the response but it appears on the log.info. 1. I created the request "Req_NAME_ID1" 2. I created the response and force it reads the XML from specifying the path. def resultRespXML = new File("C:\\Users\\Administrator\\Desktop\\Temp\\Test\\mockResponses\\Resp_0000202130123310_0057076200.xml") log.info resultRespXML context.content = resultRespXML 3. Run and see the log. It shows the message log from log.info 4. But it doesn't show the data at the Response. Please help me. Regards, DanSolved4.3KViews0likes8CommentsGroovyUtils 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.8KViews0likes12CommentsSOAP UI Return XML Dumping with Invalid Characters
Introduction:Hello Community! I hope I am posting in the correct place. Precursory Information:I am currently using SOAP UI Free to attempt to validate a WSDL. I have a service that looks like this: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header> </SOAP-ENV:Header> <SOAP-ENV:Body> ...SOAP BODY HERE... </SOAP-ENV:Body> </SOAP-ENV:Envelope> This sends out ok, and I get a return message. Precursory Explination: The way myreturn code is designed is to send a response with an XMLattached. I've done research on Request/Reponsewith attachment's in SOAP UI, and it looks like it can do it. I've read the documentation on attachment's, and done additional research on SOAP UI but I cannot find my exact issue. Issue: When returning the XML, I am recieving a bunch of invalid characters, along with a 'dump' of the attached xml. It looks like: ) ) [Invalid Character Here]uuid:XXXXXXX-YYYY-ZZZZ-AAAA-123456789123 <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body/></soapenv:Envelope> [Invalid Character Here]XXXXXXYYYYYYYYYZZZZZZZZZZ11111112222222233333333333/xml ...CORRECT XML THAT IS SUPPOSED TO BE ATTACHED HERE... Note: I am not sure how much I am allowed to share of the code/digits - but the ...CORRECT... is a correct XML I am expecting, and the XYZA and 1234... are all characters that change every time. Is there a way to prepare SOAP UI for this attached XML and not get this dump? I won't be able to validate this the way it is. What I have tried: I have tried adjusting all of the settings in the Request Properties windows with no luck. Has anyone experienced this? Could someone help me prepare my SOAP UI for the attached XML, rather than dump different characters and the contents? Thanks in advance!Solved3.7KViews1like3CommentsStore a value from XML/XPath output of a REST query in a SoapUI property for later use
I'm new to SOAP, REST, and SoapUI. I'm working to build a test case that simulates a user login & then extracts the user list from the server. My log in command is working, and I get the XML output I want: <MGRestTokenResponse xmlns="http://schemas.datacontract.org/2004/07/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"> <Message>success</Message> <Token>---THIS IS THE DATA I WANT---</Token> </MGRestTokenResponse> I'm trying to get the Token value stored in a SecurityToken property inside SoapUI but nothing is working. I've tried using XmlToolBox to get an XPath result and I've been given: /MGRestTokenResponse[@xmlns="http://schemas.datacontract.org/2004/07/"]/Token/text() or /MGRestTokenResponse[@xmlns="http://schemas.datacontract.org/2004/07/"]/Token/text() but nothing I'm trying is working. The environment I'm working in is REST only. How do I extract values from the responses & transfer them to a property?Solved2.9KViews0likes5CommentsHow 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.4KViews0likes6CommentsCustomize request XML parsing
Hi, is there a way of customizing the request XML parsing process in SOAP UI? I have already tried to check out the sources and intervene there butthe codebase has proven to be a bit overwhelming to understand - I wasn`t able to understand where the configuration for the XML parser is set. I`m trying to use it to demonstrate XXE payloads for a university project and it seems most of the popular payloads are not working on requests sent via SOAP UI, probably due to parser configuration... Basically I need to find how to turn off the anti-XXE measures. There is an attachment to show what I mean to do... Thanks2.1KViews0likes4CommentsConvert XML to Json format - jScript
Hey guys, I curretly have an XML file that I use to map some test data so I could create another XML file and send it somwhere. Current XML format is: <Mappings> <Test id="Test_1000_test"> <TestIdMapping>Test_1001_test1</TestIdMapping> <TestIdMapping>Test_1002_test2</TestIdMapping> </Test> <Test id="Test_2000_test"> <TestIdMapping>Test_2001_test1</TestIdMapping> <TestIdMapping>Test_2002_test2</TestIdMapping> <TestIdMapping>Test_2003_test3</TestIdMapping> </Test> <Mappings> Basically I am mapping 1001, 1002 to 1000....... I would like to switch this file to JSON and have it in TestComplete instead of reading it from the outside (external XML). What's is the best way to it ? I have an idea in head but I would like your opinion. Please note that file could have up to few hundreds tests.1.9KViews0likes11Comments