1

I have an API, wherein the Param field, I need to pass the current date as a string.

And param filter = 'ORDER_DATE:"2021-01-31"'

I am trying to pass the current date for the ORDER_DATE field form a java method:

* def todaysDate = helper.getTodaysDate()

And print todaysDate // Prints 2021-02-04

Now I need to pass this "todaysDate " valuein the param filter field.

Following what I have tried so far:

And param filter = 'ORDER_DATE:#(todaysDate )' 
And param filter = 'ORDER_DATE:<todaysDate>'

From example table value.

In Both cases, it printed "todaysDate " instead of its value "2021-02-04"

1 Answer 1

1

It is just JavaScript:

And param filter = 'ORDER_DATE:"' + todaysDate + '"'

This can improve in the 1.0 version BTW:

And param filter = `ORDER_DATE:"${todaysDate}"`

Further reading: https://github.com/intuit/karate#rules-for-embedded-expressions

Sign up to request clarification or add additional context in comments.

1 Comment

Great.. eagerly waiting for the latest release.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.