I'm getting a response like:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Audits TotalResults="40885">
<Audit>
<Id>1319055</Id>
<Action>UPDATE</Action>
<ParentId>117351</ParentId>
<ParentType>test</ParentType>
<Time>2018-11-08 09:56:05</Time>
<User>t304628</User>
<Properties>
<Property Label="Execution Status" Name="exec-status">
<NewValue>Passed</NewValue>
<OldValue>No Run</OldValue>
</Property>
</Properties>
</Audit></Audits>
In my script I'm trying to verify the totalresults count (tried 2 different approaches):
WS.verifyElementPropertyValue(response,'TotalResults' ,'40885')
WS.verifyElementText(response,'TotalResults','40885')
The result however is:
Test Cases/Basic ALM REST API Test FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to verify element text (Root cause: Expected text is '40885' but actual element text is: 1319055).
Clearly there is something wrong because the actual value is coming from the <Id> node
What is happening here?
When I use:
WS.verifyElementText(response, 'Audit[0].Id', '1319055'), I'm getting:
est Cases/Basic ALM REST API Test FAILED because (of) (Stack trace: com.kms.katalon.core.exception.StepFailedException: Unable to verify element text (Root cause: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1.groovy: 1: unexpected token: Audit @ line 1, column 5.
def Audit[0] = new XmlSlurper().parseText(xmlText);return Audit[0].Id.text()
Can someone shed any light?