question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does castlemock have support for XPATH math functions?

See original GitHub issue

Hello, folks,

I have been using Castlemock for a while, but only yesterday I felt the need to validate a xpath by a math function. I’m trying to validate if the system is sending a valid SOAP requisition to CastleMock. The system has to send a list of products, each one of them with an attribute called ValorTotal, as you can see below:

<Produtos>
     <!--Zero or more repetitions:-->
     <Produto>
        <!--Optional:-->
        <Codigo>1</Codigo>
        <Quantidade>5</Quantidade>
        <ValorTotal>0.50</ValorTotal>
     </Produto>
     <Produto>
        <!--Optional:-->
        <Codigo>2</Codigo>
        <Quantidade>1</Quantidade>
        <ValorTotal>0.50</ValorTotal>
     </Produto>
      <Produto>
        <!--Optional:-->
        <Codigo>3</Codigo>
        <Quantidade>1</Quantidade>
        <ValorTotal>0.50</ValorTotal>
     </Produto>
</Produtos>

In this case, I have to verify if the system is sending the list correctly. In order to do this, I tried to verify the sum of the values of all attributes called ValorTotal. Firstly, I validated the expression on Xpather, so I did as it follows:

image

You can see that it works, but putting this on castlemock XPath it simply doesn’t work. It doesn’t recognise the expression, so castlemock returns http code 500 (there’s no default response).

I want to know if math functions are recognised by the castlemock Xpath, and if they are, what am I doing wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
karldahlgrencommented, Aug 5, 2021

Hi again @wedla. Publishing images to Docker hub now works again. The latest version is now available on Docker hub.

1reaction
karldahlgrencommented, Aug 1, 2021

Hi @wedla. Thank you for creating this issue. This hasn’t been supported before, but I have now added support for this. I will include this in the next release. I can have the next release ready in a couple of days. Does that work for you?

Thanks! Best regards

Read more comments on GitHub >

github_iconTop Results From Across the Web

Multiple Input XPath Expressions · Issue #67 · castlemock ...
Is it possible to combine several XPath expressions? When not - it would be a nice feature to be added.
Read more >
The XPath functions we use most - Digital humanities
The replace() function can match regex patterns and perform more complicated replacements, including replacements that use capture groups (as we ...
Read more >
XPath and XQuery Functions and Operators 3.1 - W3C
The purpose of this document is to catalog the functions and operators required for XPath 3.1, XQuery 3.1, and XSLT 3.0 (at the...
Read more >
Castle Mock - Mock REST APIs and SOAP web-services
Castle Mock is a web application that provides the functionality to mock out RESTful APIs and SOAP web services. This functionality allows client-side ......
Read more >
Point and Click Testing with XPath | Working with SoapUI
XPATH assertions are very useful when validating your test runs. Using the Get Data point and click feature, you can quickly add assertions...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found