Karate Embedded Expression not working as expected for xml attribute
See original GitHub issueThis is : 3_PostData_Request.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope">
<S:Body>
<SucceededGetData RequestID="#(request_uuid)">some text</SucceededGetData>
<MessageDelivered OfferID="#(request_uuid)" />
</S:Body>
</S:Envelope>
This is the scenario file:
Scenario: test
* def UUID = function(){ return java.util.UUID.randomUUID() }
* def request_uuid = call UUID
* def req = read('classpath:3_PostData_Request.xml')
* print req
This is the result:
<S:Body>
<SucceededGetData RequestID="ab5bbb38-d462-42f5-afd2-49c47fd59365">some text</SucceededGetData>
<MessageDelivered OfferID="#(request_uuid)"/>
</S:Body>
</S:Envelope>
I would like to know why Karate is able to replace #(request_uuid) for xml element which has some text in it and why not for one without any text. How may I achieve replacement in both the cases seamlessely. I am using karate 0.7.0.1. Thanks !
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Karate Embedded Expression not working as expected for xml ...
I would like to know why Karate is able to replace #(request_uuid) for xml element which has some text in it and why...
Read more >Karate Embedded Expression not working as ... - Stack Overflow
yes this is a bug ! You have a workaround: * set response /Envelope/Body/MessageDelivered/@OfferID = request_uuid.
Read more >Karate | Test Automation Made Simple.
Karate is the only open-source tool to combine API test-automation, mocks, performance-testing and even UI automation into a single, unified framework.
Read more >https://raw.githubusercontent.com/intuit/karate/ma...
Feature: xml samples and tests Scenario: xml empty elements and null * def foo ... 2 Scenario: placeholders using xml embedded expressions *...
Read more >com.intuit.karate.Script.java Source code - Java2s.com
Here is the source code for com.intuit.karate. ... getAsString()); } catch (Exception e) { logger.warn("embedded xml-attribute script eval failed: {}", e.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I retestet the szenario of @PallaviMistry and it works with 0.7.0.2
Thanks!
released 0.8.0