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.

Karate is Returning Number Values as Floats

See original GitHub issue

When 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:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
ptrthomascommented, Jan 23, 2018

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

0reactions
ptrthomascommented, Sep 1, 2017

Sorry, can’t help you there. Maybe your dev team can help.

Read more comments on GitHub >

github_iconTop 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 >

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