Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/xpath transformer #398

Merged
merged 3 commits into from
Jan 9, 2020
Merged

Feature/xpath transformer #398

merged 3 commits into from
Jan 9, 2020

Conversation

kashifsoofi
Copy link
Contributor

Fixes #397 Added feature to select values from xml using XPath.
Implemented following as suggested

  • XPath.SelectSingleNode
  • XPath.SelectNodes
    Also implemented
  • XPath.Evaluate

Reason for using OuterXml in HandleBarsXPath.cs is as follows but happy to change :
Testing

<todo-list>
  <todo-item id='a1'>abc</todo-item>
  <todo-item id='a2'>def</todo-item>
  <todo-item id='a3'>xyz</todo-item>
</todo-list>

with /todo-list/todo-item[1] results in <todo-item id="a1">abc</todo-item>
using https://www.freeformatter.com/xpath-tester.html. I think it is the correct behaviour as to select text I would provide /todo-list/todo-item[1]/text(). However same experssion return only the text using XPath2SelectSingleNode.

@codecov
Copy link

codecov bot commented Jan 8, 2020

Codecov Report

Merging #398 into master will increase coverage by 0.27%.
The diff coverage is 98.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #398      +/-   ##
==========================================
+ Coverage   79.91%   80.19%   +0.27%     
==========================================
  Files         122      123       +1     
  Lines        4809     4882      +73     
==========================================
+ Hits         3843     3915      +72     
- Misses        966      967       +1
Impacted Files Coverage Δ
src/WireMock.Net/Transformers/HandleBarsHelpers.cs 100% <100%> (ø) ⬆️
src/WireMock.Net/Transformers/HandleBarsXPath.cs 98.61% <98.61%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3f802c3...59a65e7. Read the comment docs.

@StefH
Copy link
Collaborator

StefH commented Jan 8, 2020

Looks good.

Did you also test this new code in a real application/integration test ?

@kashifsoofi
Copy link
Contributor Author

Looks good.

Did you also test this new code in a real application/integration test ?

Not yet.

@kashifsoofi
Copy link
Contributor Author

Looks good.
Did you also test this new code in a real application/integration test ?

Not yet.

Tested and its working as expected.

@StefH StefH added the feature label Jan 9, 2020
@StefH StefH merged commit 368fdd4 into WireMock-Net:master Jan 9, 2020
@kashifsoofi kashifsoofi deleted the feature/xpath_transformer branch January 21, 2020 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question/Feature: Add support for selecting XPath in response template
2 participants