Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
'not a callable feature or js function' Error when calling JS function from feature file

While using Karate framework for API testing I am trying to call a method in one feature file from other like this:

    Scenario: Scenario description
  * def util = callonce read('UtilFunctions.feature')
  * def object = 
  """
    {"_yearsOffset":-20, "_daysOffset":0}
  """
  * def customerAge = call util.getDate(object)
  * print customerAge

The method just returns a date with a yearsOffset and daysOffset to move the date if desired.

When I execute this I have the following error:

not a callable feature or js function: [type: STRING, value: 30.03.2002]

Even though the value displayed in the log is correct and does what the function is asked to do, the execution fails.

Any guess? I am running out of ideas.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Here's a guess, you don't need to use call when simply invoking a function:

* def customerAge = util.getDate(object)

The call makes things a little bit easier to read only if it is a function

* def fun = function(x){ return { foo: x } }
* def customerAge = call fun 'bar'
# this will also work
# def customerAge = fun('bar')
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda