Validate the float value range in karate framework

依然范特西╮ 提交于 2021-02-17 03:18:22

问题


My scenario is to check whether a field accepts range from 0.01 to 25000 .. it can be decimal value . What is way to do it in karate framework.. I used below regex which is not correct

regex [.0-9]*


回答1:


Just multiply by 1 to convert a string to a number

* def foo = '0.2'
* assert (foo * 1) < 0.3 

Also please read: https://github.com/intuit/karate#type-conversion



来源:https://stackoverflow.com/questions/58630846/validate-the-float-value-range-in-karate-framework

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!