Coder Social home page Coder Social logo

Comments (4)

AlexeyBuzdin avatar AlexeyBuzdin commented on May 28, 2024

Had a prototype with Object in GlobalWorld, but then you end up with all kind of Double/Float comparison problems.

Do you experience problem with?

Scenario: add highseas demo
Given let variable "intVal" equal to 123
Given request body "{"age":{(age)}}"

{(age)} will be inflated as Java String type, but in the JSON it will end up as number. Since you don't have any quotes for age in the JSON

from cukes.

aovercome1234 avatar aovercome1234 commented on May 28, 2024

@AlexeyBuzdin
yes, I agree with you very much. But when using this with DataTable, the table will transfer all the values into string type, take an example as below:

Scenario: prac intVal with dataTable 
    Given let variable "intVal" equal to "123"
    Given request body as below 
     |val|
     |{(intVal)}|

print the request body:
actual is: {"val":"123"}
but I want it as {"val":123}

Have you considered such a scenario with lots of params as below?

Given request body as below 
     |val1         |val2         |val3        |val4         |val5         |val6         |val7         |val8        |
     | {(intVal)} | {(intVal)} |{(intVal)} | {(intVal)} | {(intVal)} | {(intVal)} | {(intVal)} | {(intVal)} |

I try to change source code according by my own requirement with adding some flags as "(int)", but I failed, please give me some good ideas or suggestions, thanks so much.

Given request body as below 
     |val1               |val2                |val3              |val4               |val5               |val6               |
     | {(intVal)}(int) | {(intVal)}(int) |{(intVal)}(int) | {(intVal)}(int) | {(intVal)}(int) | {(intVal)}(int) | 

from cukes.

AlexeyBuzdin avatar AlexeyBuzdin commented on May 28, 2024

Hi, thanks, that's a valid point, will look into this.

Also maybe Given request body from file /myfile.json will be a good substitution for you?
You could then put the same {(intVal)} in the .json file.

Meanwhile feel free to join our Gitter chat for support: https://gitter.im/ctco/cukes-rest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

from cukes.

AlexeyBuzdin avatar AlexeyBuzdin commented on May 28, 2024

Hi @aovercome1234. Investigated the DataTable approach you've proposed and identified a big issue with nested properties there.

If you want to construct a simple json ie { "name": "john"} then DataTable will work fine. On the other hand if you want to create a nested object `{"name": {"firstname": "john", "lastname": "doe"}} then you'll be limited by Gherkin language. (here's a link to cucumber issue closed by the developers cucumber/cucumber-jvm#442)

So supporting DataTables is a very low priority for cukes-rest since only a small portion of requests can be effectively written in such a way. I will close the issue but will reopen it once/if we decide to support DataTables at all.

But big thanks for bringing this up! If you have any other question on cukes-rest, please don't hesitate to write, would be glad to help.

from cukes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.