问题
This is related to this Karate Java Function problems
So I have a feature that calls a java method that makes a query to a database and it passes data to that method but as not all the data is made of only numbers I have to put it in quotes "Something"
but the method also gets the quotes and that results in my query to be empty, how can I escape the quotes to avoid receiving empty results?
Backslashes in def query = sql.identificacionCliente('<numeroCuenta>')
don't work.
回答1:
Mi inexperience shows, i had a bad concept about what the character escaping was for therefore i was asking the wrong question.
For a solution for this particular case in the example you would have something like this: e.g
|numeroCuenta|
|12345678K |
|123456789 |
just put the one that has letters in simple quotes and then remove the simple quotes on the method call. e.g
|numeroCuenta|
|'12345678K' |
|123456789 |
Before
def query = sql.identificacionCliente('<numeroCuenta>')
After
def query = sql.identificacionCliente(<numeroCuenta>)
来源:https://stackoverflow.com/questions/58826607/karate-how-to-escape-quotes-in-data-youre-passing-to-a-java-type-call