Search code examples
karateweb-api-testing

Karate JDBC Connection


In Karate script is there a way to cache the DB connections ? . To be more specific the DB connections are through a Java program , every time we make DB calls the connection call is also

  • def dbDemo=Java.type('tests.DataBaseAssertions')

The above line of code is used in all the feature files . Is there a way to cache this object so that all script can refer to that .

Application level


Solution

  • Sounds like you are looking for the callSingle() syntax, please refer to the docs:

    https://github.com/intuit/karate#hooks

    var result = karate.callSingle('classpath:jdbc.feature');