Karate is Returning Number Values as Floats
See original GitHub issueWhen using Javascript to parse or create a number, a float is returned by Karate, unless a double tilde ~~
is used. * def dealIdInteger = (parseInt(dealId, 10))
returns "dealId": 96486.0
, but * def dealIdInteger = (parseInt(~~dealId))
returns "dealId": 96486
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Karate is Returning Number Values as Floats #123 - GitHub
When using Javascript to parse or create a number, a float is returned by Karate, unless a double tilde ~~ is used.
Read more >How to convert "Number" into number In karate - Stack Overflow
Use parseInt() to convert string to number. An alternative is to just multiply the string with 1. e.g.
Read more >Karate | Test Automation Made Simple.
It returns a Results object that has all the information you need - such as the number of passed or failed tests. JUnit...
Read more >Variables and their type conversion using KarateDSL
You're reading the 6th chapter of my karate DSL series, which is designed to help you grasp different variables and their type conversions....
Read more >Root Beer Floats and Green Tea - Chapter 112 - desolateice ...
Karate to the Death, 58. Going Home, 59. We'll Find a Good Spot ... Returning to Newark, 110. ... You may have noticed...
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
for anyone finding this issue via google the documentation now has a section on how to tackle number / double / integer format conversion needs: https://github.com/intuit/karate#floats-and-integers
Sorry, can’t help you there. Maybe your dev team can help.